Looping to Live Stream - onPublish?

Hello everyone,
I'm an extreme newbie, and I finally have my videos looping, but I want them to stop looping and cut to a live stream whenever we go live with our broadcast. Can someone go into detail as to the code I need to switch from the looping videos to the live stream? I'm pretty sure it's done with onPublish, but again, I'm a newbie so I need all the help I can get.
Here is my main.asc. Thanks in advance!
application.onAppStart = function(){
this.clientStream = Stream.get("clientPlayStream");
this.clientStream.play("myfile", 0, -1);
application.onStatus = function(info){
if(info.code=="NetStream.Play.Stop") {
//do some code in here to restart the stream
this.clientStream.play("myfile", 0, -1);
}

Yes... you can use application.onPublish and application.onUnpublish to handle it.
application.onPublish = function(client, stream){
if(stream.name == "therightlivestream"){
this.clientStream.play("therightlivestream", -1, -1);
application.onUnpublish = function(client, stream){
if(stream.name == "therightlivestream"){
this.clientStream.play("myfile", 0, -1);

Similar Messages

  • Loop a short flv before the live stream begins

    Hi,
    Using FMS 3.02 and FME 2.5 is it possible to run a looping
    flv that the clients can see, before the live stream begins, and
    when the live stream finishes, an exit flv video plays?
    cheers

    Besides, can I draw data from DataBase (say, MS SQL Server) on server side? Can server-side ActionScript do this?

  • Running a live stream from an XML playlist

    I have just successfully installed Adobe FMS on my server.
    I would now like to know how to program a script to run a continuous live stream, of MP4 videos, from an XML playlist.
    Can anyone tell me how to do this? ...or provide me a good tutorial? (I am a complete newbie to ActionScript.)
    Thanks in advance...

    application.allowDebug = true;
    application.onAppStart = function(){
    this.userID =0;
    this.playObj = new Object();
    this.timObj = new Object();
    this.passCli = new Object();
    this.couObj = new Object();
    this.couObj.count = 1;
    application.so0 = SharedObject.get("so",false);
    this.dates = new Object;
    this.dates.dat0 = new Date().valueOf()+"a";
    this.dates.dat1 = new Date().valueOf()+"b";
    this.dates.dat2 = new Date().valueOf()+"c";
    this.dates.dat3 = new Date().valueOf()+"d";
    this.myStream = new Object;
    this.myStream.st = Stream.get (this.dates.dat0.toString());
    this.myStream.st1 = Stream.get (this.dates.dat1.toString());
    this.myStream.st2 = Stream.get (this.dates.dat2.toString());
    this.myStream.st3 = Stream.get (this.dates.dat3.toString());
    this.int0
    this.int1
    this.int2
    this.int3
    this.int4
    this.lock0=0;
    this.lock1=0;
    this.lock2=0;
    this.lock3=0;
    this.lock4=0;
    listen();
    function listen(){
    clearInterval(application.int3);
    application.int0 = setInterval(time,1000,application.myStream.st);
    application.myStream.st.onStatus = function(info){
    if(info.code == "NetStream.Play.Stop"&&application.lock0==0){
      trace("code0"+info.code);
      clearInterval(application.int0);
      application.timObj.tim = 0;
      application.int1 = setInterval(time,1000,application.myStream.st1);
      application.couObj.count = 2;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      listen1(application.myStream.st1);
      application.lock0=1;
      function listen1(mystreamst1){
      mystreamst1.onStatus = function(info){
    if(info.code == "NetStream.Play.Stop"&&application.lock1==0){
      trace("code1"+info.code);
      mystreamst1 = null;
      clearInterval(application.int1);
      application.timObj.tim = 0;
      application.int2 = setInterval(time,1000,application.myStream.st2);
      application.couObj.count = 3;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      listen2(application.myStream.st2);
      application.lock1=1
      function listen2 (mystream2){
    mystream2.onStatus = function(info){
    trace("code2"+info.code);
    if(info.code == "NetStream.Play.Stop"&&application.lock2==0){
      clearInterval(application.int2);
      application.mystream2 = null;
      application.timObj.tim = 0;
      //application.int3 = setInterval(time,1000,application.myStream.st3);
      application.couObj.count = 4;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
         application.lock2=1;
      listen3(application.myStream.st3);
      function listen3(mystream3){
    mystream3.onStatus = function(info){
    trace("code3"+info.code);
    if(info.code == "NetStream.Play.Stop"&&application.lock3==0){
      trace("yes yes yes yes yes yes");
      clearInterval(application.int3);
      application.couObj.count = 1;
      mystream3 = null;
      application.timObj.tim = 0;
      //application.int4 = setInterval(time,1000,application.myStream.st);
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      application.lock0=0;
      application.lock1=0;
      application.lock2=0;
      application.lock3=0;
    application.dates.dat0 = new Date().valueOf()+"e";
    application.dates.dat1 = new Date().valueOf()+"f";
    application.dates.dat2 = new Date().valueOf()+"g";
    application.dates.dat3 = new Date().valueOf()+"h";
    application.myStream.st = Stream.get (application.dates.dat0.toString());
    application.myStream.st1 = Stream.get (application.dates.dat1.toString());
    application.myStream.st2 = Stream.get (application.dates.dat2.toString());
    application.myStream.st3 = Stream.get (application.dates.dat3.toString());
    application.myStream.st.play(application.playObj.vid[0],0,-1,0);
    application.myStream.st1.play(application.playObj.vid[1],0,-1,0);
    application.myStream.st2.play(application.playObj.vid[2],0,-1,0);
    application.myStream.st3.play(application.playObj.vid[3],0,-1,0);
    listen();
    ///here next
    application.onConnect = function(client){
    application.acceptConnection(client);
    application.passCli.cli = client;
    client.call("setUserID",null,this.userID);
    this.userID++;
    if(application.clients.length == 1 ){
    videoArray = new Array();
    var playlist = new XML();
    playlist.ignoreWhite = true;
    //parse xml play list for individual elements
    playlist.onLoad = function( success ) {
    if(playlist.loaded == true) {
    if (playlist.firstChild.hasChildNodes()) {
    for (var aNode = playlist.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
    if (aNode.nodeType == 1) {
    //create array from parsed xml elements.
    videoArray[aNode.attributes.id] = aNode.attributes.name ;
    //pass array out of onload function
    application.playObj.vid = videoArray;
    application.myStream.st.play(application.playObj.vid[0],0,-1,0);
    application.myStream.st1.play(application.playObj.vid[1],0,-1,0);
    application.myStream.st2.play(application.playObj.vid[2],0,-1,0);
    application.myStream.st3.play(application.playObj.vid[3],0,-1,0);
    pass0(videoArray);
    //play first video on playlist
    playlist.load("http://www.privatechatnow.com/fmsuser/playlist.xml");
    }//end onetime if statement
    function pass0(videoArray){
      //receive array
      //play intial video
      if(application.clients.length == 1){
    // application.playObj.vid=videoArray;
    playcurr(application.passCli.cli);
    for (var key in application.playObj){
    trace(key + ": " + application.playObj[key]);
       //put currently playing videio into object
      //isolate playlist switching loop for each connected client
      //listen to currently playing stream with onStatus
      //change to next video in playlist
      //use onStatus and current duration and seek to scrub to cuurently playin video each time a user connects.
      //continue untill playlist is played then loop back to first video in playlist.
        //onConnect play currently playing video
    if (application.clients.length >1){
    playcurr(application.passCli.cli);
    //message client with currently play flv
    //message client when flv changes
    //message client with metadata
    application.onPublish = function(clientObject, streamObject){
    trace("Stream name :: "+streamObject.name);
    function switchStream(so0){
    if(application.couObj.count == 1){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[0].length;
        nextlen = application.playObj.vid[1].length;
    so0.send("playSecond",application.playObj.vid[0],clength,currlen,nextlen);
    if(application.couObj.count == 2){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[1].length;
    nextlen = application.playObj.vid[2].length;
        so0.send("playSecond",application.playObj.vid[1],clength,currlen,nextlen);
    if(application.couObj.count == 3){
    clength = application.timObj.tim-3;
    currlen = application.playObj.vid[2].length;
      nextlen = application.playObj.vid[3].length;
        so0.send("playSecond",application.playObj.vid[2],clength,currlen,nextlen);
    if(application.couObj.count == 4){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[3].length;
      nextlen = application.playObj.vid[0].length;
        so0.send("playSecond",application.playObj.vid[3],clength,currlen,nextlen);
    function playcurr(client){
    trace("count = "+application.couObj.count.toString());
    if(application.couObj.count ==1){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[0].length;
      nextlen = application.playObj.vid[1].length;
        client.call("playZero",null,application.playObj.vid[0],clength,currlen,nextlen); 
    if(application.couObj.count ==2){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[1].length;
      nextlen = application.playObj.vid[2].length;
        client.call("playZero",null,application.playObj.vid[1],clength,currlen,nextlen); 
    if(application.couObj.count ==3){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[2].length;
      nextlen = application.playObj.vid[3].length;
        client.call("playZero",null,application.playObj.vid[2],clength,currlen,nextlen); 
    if(application.couObj.count ==4){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[3].length;
      nextlen = application.playObj.vid[0].length;
        client.call("playZero",null,application.playObj.vid[3],clength,currlen,nextlen); 
    application.onDisconnect = function(oldclient){
    if(application.clients.length ==0){
    this.userID--;
    function time(myStream){
    application.timObj.tim = myStream.time;

  • How do I use multiple cameras to live stream through FME?

    I am looking to live stream pool tournaments from multiple angles but don't know what software or hardware I might need. Anybody have any good how to advice or links they might share? I stream through Ustream.tv if that makes a difference. Should I look for something different? Thanks

    I am working on getting just the counter working by using
    the program posted previously, and I am running into issues. Periodically I get
    the error:
    Error -200141
    occurred at DAQmx Read (Counter DBL 1Chan 1Samp).vi
    Possible reason(s):
    Data was overwritten
    before it could be read by the system.
    If Data Transfer
    Mechanism is Interrupts, try using DMA. Otherwise, divide the input signal
    before taking the measurement.
    It seems to work better if I use cascaded counters, but I need timer 0 for
    analog channels when I run this code along with the program for the other
    measurements.
    I have tried averaging, and selecting different values for the millisecond
    timer, and these did not seem to have an effect.
    I tried different DAQms configurations and "Counter DBL 1Samp" seemed
    to work the best.
    The program will work for a while and then it will give me the above error
    message.
    If I use counter 0 as a cascaded counter input, the program runs fine. If I run
    this with other analog channels, it errors out because the analog channels use
    counter 0.
    If I use counter 1 as a cascaded counter input, it seems to work better than a
    single channel, but it will still error out with the above error.
    If I use only counter 1, I get the error above even faster.
    Also, none of the
    configurations give measurements outside the While Loop.
    The only place I can add a speed dial for the front panel is within the While
    Loop.
    Is there someway to get the signal to continuously send out of the while loop?
    I thought if I could get the signal out of the while loop, I could condition it
    anyway I wanted without the program erroring out.
    Any suggestions would be much appreciated.
    Thank you.
    Attachments:
    Counter_error.jpg ‏45 KB

  • Live Streaming from Video File

    Hi everyone,,, im newbie in programming streaming video with flash....ater reading documentations i tried the instructions on doc, i got a question that i've not been solved. How to make a "live streaming" from "video file". It likes a live streaming from camera but it uses video file  as the source.... many thanks

    Do you mean you have video file but you want to publish it as live stream , am i right? If yes following is the solution, but before that let me clarify you will need server to do it , i mean there is no way Flash client (i.e. .swf file running in Flash Player) can publish file from local disk.
    Now let me tell you how to do it from server:
    Place your video file under "streams" folder of your application i.e. say "myVideo.flv" under  <FMS root>/applications/myApp/streams/_definst_
    Now write following code in your main.asc file (this file would be under <FMS root>/applications/myApp )
    var mystream;
    application.onAppStart = function(){
         mystream = Stream.get("livestream");
         mystream.play("myVideo",0,-1,true);
    This will publish "myVideo" file as live stream under name of "livestream". Client would have to subscriber using NetStream and
    use ns.play("livestream",-1,-1)
    You might have to write some extra code if you want to loop same file else once play of recorded file gets over , live publish will automatically stop.
    let me know if this solves your problem

  • Start/stop/restart live stream - do stream files need to be removed first?

    When streaming a live event if something happens and we need to stop our encoder and then restart it again.
    Do we need to delete the stream files created in the 'application/event/' directory and also delete the f4f stream,bootstrap, etc... files too?
    If we don't delete the stream files before restarting the live stream. It will only play about 10 seconds of the stream then just hang buffering.
    What is causing this?
    My application log shows no access when I restarted the stream.
    2013-09-04
    09:02:21
    3960
    (s)2641173
    onPublish : cfhsstream4
    2013-09-04
    09:02:21
    3960
    (s)2641173
    Stream name is: cfhsstream4 and live event is: cfhs
    2013-09-04
    09:02:21
    3960
    (i)2611173
    Event level recording configuration: General[flags: 3, keyframe interval: 60000, max size: -1, max length: -1, io buffer size: 0], Fragment[frag duration: 4000, seg duration: 0, duration precision: 0, allowed drift: 1000, frame rate: 0.000000, frames per interval: 0, intervals per frag: 1, frame precision: 1, disk management duration: 0.000000], ContentProtection[enabled=false(overridable)]
    2013-09-04
    09:02:21
    3960
    (s)2641173
    f4f:cfhsstream4 - NetStream.Publish.Start
    2013-09-04
    09:02:21
    3960
    (s)2641173
    f4f:cfhsstream4 - NetStream.Play.Reset
    2013-09-04
    09:02:21
    3960
    (s)2641173
    f4f:cfhsstream4 - NetStream.Data.Start
    2013-09-04
    09:02:22
    3960
    (s)2641173
    f4f:cfhsstream4 - NetStream.Record.Start
    2013-09-04
    09:02:23
    3960
    (s)2641173
    f4f:cfhsstream4 - NetStream.Record.NoAccess
    2013-09-04
    09:02:23
    3960
    (s)2641173
    f4f:cfhsstream4 - NetStream.Record.Stop
    2013-09-04
    09:02:23
    3960
    (s)2641173
    f4f:cfhsstream4 - NetStream.Record.NoAccess
    Thanks,
    Dave

    I have a similar issue like Mr Dave explained. If need to stop, start, stop and restart again, the encoder is sending, but in player not shows nothing. Then we need to stop and disconnect in encoder, and remove the stream file in /event and the cache files in livestream folder for after then restart the streaming. Only after this action, the streaming works fine and the streaming shows again in player.
    Have other way to solve this issue without need all that actions? Note that I use the Adobe FME to live streaming and encoding in HDS http streaming
    I hope for a help
    Thanks
    Pedro
    Message was edited by: asaweb2013

  • Help understand Visual Communicator Live Streaming

    Up to know I run live streaming through our Steaming server using FMS and Flash Media Live Encoder as we only needed one camera for live video feeds.
    We are looking at the ability now to use 2 live cameras and also the ability to snap in pre recorded video during live feeds and also provide lower third titles.
    I am looking at:
    Adobe Visual Communicator 3
    Wirecast 4
    CutFour
    All of these provide the possible live switching I need.
    I'm at the moment looking at the Trial version of Visual communicator and I am struggling getting my head around a few things.
    I can hook up 2 -3 Sony A1 HD cameras in SD no problem and running it though FMS is fine. During test streams clicking on the cameras using the mini switcher is straight forward.
    howevr I am struggling to work out how to do the following:
    Add prerecorded video clips to Camera 3? ( in the Setup Tab it says " No Camera found - please connect a camera or replace with Photo or video Clip) How do I replace with a Video Clip?
    How do I add premade titles, so that during the live feed I can put lower third titles in?
    Finally, How do Provide an intro looping video to play before the live feed starts?
    Any instructions would be appreciated

    Hi there
    The forums are user-to-user. The older incarnation of the forums used to have a disclaimer on each page. Now there is one that appears at:
    http://forums.adobe.com/index.jspa
    If you want to bring something to Adobe's attention, you need to use the proper channel. That channel is the Wish Form/Bug Reporting form.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Time shifting and record live stream

    Hellow everyone,
    I would like to stream videos for my viewers and them have a abiliti to timeshifting live stream.
    Can I use live application for timeshifting? Or I should use livepkgr to do that.
    For archive and play on the VOD mode I like to stream live and record at same time. in the livepkgr I see in the stream folder create a stream file with the f4f extention automaticaly whoever in the live application I should call application.record on the FMS to save live stream on the server.
    Please advise me the better solution to archive and time shifting.
    Many Thanks.

    livepkgr application for for HTTP streaming...
    f youjust want to stream over rtmp use live application and code to record the stream...recording is pretty simple in AMS just call Stream.get() s.record(...) s.play() where s is the stream which you are recording...
    application.onPublish = function(clientObj, streamObj) {      trace("recording started...");       var strName = "recorded_" + streamObj.name;      var s = Stream.get(strName);      if (s == undefined )           return;         s.onStatus = function(info)      {           trace(info.code);      }           if (!s.record("record"))      {           s.trace("record failed.");      }            s.play(streamObj.name, -1, -1, true); }

  • Quicktime live streams stop and then repeat

    Hi, I'm using firefox 2.0.0.11 and Quicktime 7.3.0
    I'm trying to listen to a live stream from a radio station that is a .wax live stream. Everything works fine, however, when the playback marker reaches the right side of the quicktime screen, the stream stops and it returns to the beginning and repeats what it's just played. I'd really like to listen to the whole stream until I decide to stop it. Can anyone help?
    Simon

    The same thing happened to me, EXCEPT, for me, I realized that if I NEVER touch the controller during the live stream it doesn't stop and loop. It keeps going until the feed ends.
    For me, it ONLY stops and loops if I try to use the controller while viewing the live stream.
    This is certainly not a fix, but a possible temporary solution for some, while Apple works on fixing this BUG.

  • Recording H.264 Live Stream on the Server

    I have seen several questions which were close to what I am looking for, but haven't found an answer that worked. I work at a school, and we use a NewTek TriCaster to stream live events through FMS 3.5, which I am hoping to upgrade to AMS 5 to allow HLS. We have been streaming a single H.264 encoded feed through the server as a live stream which works well. They have recently asked if it is possible to archive that recording on the server. I was able to get everything to work correctly when I switched to using the VP6 codec, but as long as we were streaming with H.264, I could not get the server to record it correctly. Here's what I have tried:
    This code works for the VP6, but the H.264 doesn't record the video:
    application.onPublish = function (clientObj, streamObj)
         var s = new Stream("archive");
         s.record();
         s.play(streamObj.name);
    This worked and created an flv file, but caused a few other issues due to the encoding of the VP6 and having to re-encode the video to H.264 before putting the file online.
    Based on suggestions I was reading, I tried this with the H.264 stream:
    application.onPublish = function (clientObj, streamObj)
         var s = new Stream("mp4:archive.f4v");
         s.record();
         s.play(streamObj.name);
    This created an f4v file, but I could not play it. When I tried to open it in Adobe Media Encoder, it gave an error that it did not support the compression type.
    Thanks.

    You should use a H.264 compitable encoder..
    FMS only delivery content, player only player the stream..
    Flix Engine, from On2, have the H.264 encoder..

  • User Auth. for Live Streaming with Media Encoder 2.5 and FMSS

    Hi,
    i am currently thinking of buying the Flash Media STREAMING
    Server (~995 $) and in order to see if this is the right choice, i
    also take a look at the Wowza Media Server for comparison.
    I want to support Live Streaming from Events with Flash Media
    Encoder 2.5 and for this i'll need a user authentification for
    giving access to special publishing Users only. Wowza Media Server
    supports a User Authentification by parsing the connecting URL,
    witch is delivered by the Media Encoder on starting a Connection,
    and therefor grants or denies access to the publishing function.
    Only Users with the right Access Persmissions, which is written
    trough a password and the onPublish Comand in the url, can publish
    Live Streams. Everyone can watch the Live Stream, if no restriction
    to the onConnect Command was made.
    The Problem in this case is, i will need seperate Application
    folders for every user who should be able to start a live stream.
    This would be a horrible effort...
    more info ==>
    http://www.wowzamedia.com/forums/showthread.php?t=1281
    Is there a similar way to support authorisation for starting
    publishing a LiveStream to the Flash Media Streaming Server, or do
    i need the Flash Media Interactive Server?
    How can i restrict access to users, who should not be able to
    start a live stream on my FMSS?
    Thx for your help,
    Tobi

    quote:
    Is there a similar way to support authorisation for starting
    publishing a LiveStream to the Flash Media Streaming Server, or do
    i need the Flash Media Interactive Server?
    Unfortunately no, there isn't. I struggled with same issue
    earlier, and we were forced to purcahse the Interactive edition. As
    the 'Streaming' version only runs Adobe-signed apps, there is no
    way to change things that happen within the onConnect handler.
    Furthermore, guys at Adobe haven't provided any possibility for
    even simple access control through configuration files for built-in
    apps that come along with the Streaming Server edition.
    - Jakki

  • Archiving live stream at FMS and injecting metadata: VP6 good h264 not

    When I record a live stream at FMS, one in which I've injected  metadata in my main.asc file, the archived file plays back fine.  The  metadata plays back too.  I'm able to retreive it just fine - if I  encode VP6.
    If I encode h.264 the file plays back but  the metadata does not.  The fact that the archived file is created and  plays back tells me things are wired correctly.  The only thing I  changed is the format.
    According to FMS docs (http://help.adobe.com/en_US/FlashMediaServer/3.5_SS_ASD/WS5b3ccc516d4fbf351e63e3d11a11afc9 5e-7e42.html#WS5b3ccc516d4fbf351e63e3d11a11afc95e-7f35)
    ..."The recording format is determined by the filename you pass to the Stream.get()
    method."
    So my record code looks like the following:
    application.onPublish = function(client, stream) {
         trace("onPublish");
         s = Stream.get("mp4:streamname.f4v");
         if(s){
             s.record();
         this.doRepublish(this.nc, stream);
    My code that injects the data in to the stream looks like this:
    Client.prototype.sendDataEvent = function(data) {
         trace("Call to sendDataEvent...");
         this.newStream = Stream.get("mp4:streamname.f4v");
         this.newStream.send("onTextData",data);
    All must be wired  correctly because the metadata comes through during the live stream.  On  play back of the archive though, the metadata doesn't appear to be  there.
    Any thoughts?
    Thanks

    My apologies on the s.play() confusion.  I had been trying different versions of the code and posted the one without it.
    Whether I include s.play() or not the file gets created.  Here are the various versions of the onPublish() function I've tried (differences in red):
    1.
    application.onPublish = function(client, stream) {
        trace("onPublish");   
        s = Stream.get("mp4:streamname.f4v");
        if(s){
            s.record();
            s.play("mp4:streamname.f4v");
        this.doRepublish(this.nc, stream);
    2.
    application.onPublish = function(client, stream) {
        trace("onPublish");   
        s = Stream.get("mp4:streamname.f4v");
        if(s){
            s.record();
            s.play(stream);
        this.doRepublish(this.nc, stream);
    3.
    application.onPublish = function(client, stream) {
         trace("onPublish");   
         s = Stream.get("mp4:streamname.f4v");
         if(s){
             s.record();
         this.doRepublish(this.nc, stream);
    All produce the same result - an archived file called mp4:streamname.f4v in my streams folder.  This file plays back fine but does not play back the commands.
    On your other question, about things working fine for VP6, it works fine for FLV.  A file called streamname.flv is produced.  This file plays back fine and does indeed play back commands baked into the file as well.  This is what makes me believe the code is not the problem.  If it works perfectly for one format, there would seem to be very little I could do in my code to break things for the other.
    Can you try this using the record() code snippets in the live docs Stream.record() section?
    http://help.adobe.com/en_US/FlashMediaServer/3.5_SS_ASD/WS5b3ccc516d4fbf351e63e3d11a11afc9 5e-7e42.html#WS5b3ccc516d4fbf351e63e3d11a11afc95e-7f35
    All you'd need is the code snippets there to record your live stream and another server side function to inject commands into that live stream. Here is that function:
    Client.prototype.sendDataEvent = function(data) {
        trace("Call to sendDataEvent...");
        this.newStream = Stream.get("mp4:streamname.f4v");
        this.newStream.send("onTextData",data);
    Do something simple like call onTextData and pass some text in the data parameter.  Then on the client side viewer, handle the onTextData method.  It will receive the text.  Display it in a text area or something.
    If you record while injecting this text into your stream, the text should display on playback of the archived file.  It will if you encode VP6/FLV, but not if you encode H.264/F4V.
    Let me know what you discover.

  • Clearing application buffer after a live stream ends

    Hi there, I'm sure this has been asked and answered a million times, but searching for "application" "buffer" "cache" "live" and "hls" isn't giving me any answers, so let's get to it...
    After I end a live stream (which I do using FMLE 3.2 and FMS 4.5) and I then start a new live stream with the same application name, the HLS stream just loops the last 30 seconds of the old stream. To prevent this, after I end a stream, I have to go to applications\livepkg\streams\_definst_\ and delete the buffered data there. Only then can I start a new stream with the same name as the old stream. Now... that can't be normal, can it? Is there a switch somewhere I can set to tell FMS to cut it out and stop buffering old streams?
    Thanks,
    Raul

    You can use "record" mode rather than default mode of "append". You just need to publish using streamname - livestream%i?adbe-live-event=liveevent&adbe-record-mode=record.
    Though "append" should also work - can you let me know what do you see in FMS core logs / application logs. Also are you changing encoding settings when you republish/restart?

  • Live Streaming from static video file

    Hi everybody,
    I'm using Amazon Cloud & Flash MMedia Server 4.5.
    I would like to take one of my exits videos (a static file), and turn it into a live stream. People can view this video (synchronous). I'm using Flash Media Live Encoder 3.2, but it only capture video from devices as camera...
    How I can do it?
    Cheers.

    Hi Huy,
    Please find the zip attached where I have written the scripts for you to deploy on your local FMS server, in context of option 2:
    You may like to follow these steps:
    1. unzip the folder.
    2. deploy FLVpublishonLoad (in case your recorded file is a FLV use case) on your lcoal server
    3. deploy toPublish on your remote aws server
    4. make sure to correct the path for aws in FLVPublishonLoad application @ line#19:
    // Please mention your aws instance hostname instead of localhost , and application name ....
    nc.connect("rtmp://localhost/toPublish");
    5. go to admin console of your local development server and load the instance of FLVPublishonLoad as shown in the howtoLoadfromAdminConsole.png image attached for refrence purpose.
    6. it will automatically connect to the "toPublish" app on your remote server and start publishing your local vod file as a live stream to your aws instance
    7. start your subscriber app and subscribe to the stream you have used in FLVPublishonLoad app for Stream.get() method, see line#29 and the subscriberScreenExample.png file attached for the illustration purpose.
    few points to note here:
    1. I have removed the sample.flv and "sample1_1500kbps.f4v" for keeping the zip size lower.
    2. You need to put your stream name at line#55 where you call mystream.play()
    3. The stream name that you specify in Stream.get() will be used by subscribers.
    4. if your use case is mp4, then please use "MP4PublishonLoad" instead of "FLVPublishonLoad" application.
    =============
    As I am unable to attach the files here therefore copy-pasting the code for you and others to be re-used:
    =======
    main.asc code for FLVPublishonLoad:
    var nc;
    var ns;
    application.onAppStart = function()
        trace("hello client: ");
        publishIt();
    function publishIt()
        trace("publishing");
        nc = new NetConnection();
        // Please mention your aws instance hostname instead of localhost , and application name ....
        nc.connect("rtmp://localhost/toPublish");
        nc.onStatus = function(info)
            trace(info.code);
        ns = new NetStream(nc);
        // Exact stream name available for subscribers .....
        mystream = Stream.get("myvodfile");
        mystream.onStatus = function(sinfo)
            trace("mystream.onStatus: "+sinfo.code);
            if(sinfo.code == "NetStream.Publish.Start")
                attach_retVal = ns.attach(mystream);
                if(attach_retVal==true)
                        trace("stream attach was successful ...");
                        startPublish();
                else
                    trace("The attempt to attach stream source to NetStream failed");
        // Please put the stream name here inside double-quotes that you want to publish and is available there in streams/_definst_ folder ......
        mystream.play("sample",0,-1,true);
    function startPublish()
        ns.publish(mystream.name,"live");
    main.asc code for MP4PublishonLoad:
    var nc;
    var ns;
    application.onAppStart = function()
        trace("hello client ");
        publishIt();
    function publishIt()
        trace("publishing");
        nc = new NetConnection();
        // Please mention your aws instance hostname instead of localhost , and application name ....
        nc.connect("rtmp://localhost/toPublish");
        nc.onStatus = function(info)
            trace(info.code);
        ns = new NetStream(nc);
        // Exact stream name available for subscribers .....
        mystream = Stream.get("mp4:myvodfile.f4v");
        mystream.onStatus = function(sinfo)
            trace("mystream.onStatus: "+sinfo.code);
            if(sinfo.code == "NetStream.Publish.Start")
                attach_retVal = ns.attach(mystream);
                if(attach_retVal==true)
                        trace("stream attach was successful ...");
                        startPublish();
                else
                    trace("The attempt to attach stream source to NetStream failed");
        // Please put the stream name that you want to publish and is available there in streams/_definst_ folder ......
        mystream.play("mp4:sample1_1500kbps.f4v",0,-1,true);
    function startPublish()
        trace("#### " + mystream.name);
        ns.publish("mp4:" + mystream.name,"live");
    main.asc code for "toPublish" app
    =====================
    application.onPublish = function(clientObj, streamObj)
        trace("published: " + streamObj.name);
    =====================
    Please revert back to me in case of further query.
    Regards,
    Shiraz Anwar

  • Encode archive of live stream on FMS 4

    I thought by what I have initially read that this was possible, but I am not sure.
    What we would like to do is create an archive (f4v or mp4) on the FMS 4 server any live stream that is pushed from our endpoints.  Primarily as a backup and if necessary - an editable file within CS4 or CS5.
    We are at a University and capture lecture powerpoints natively and sometimes need to edit the files.  flv is not enough and we would like to take afvantage of mp4 and the FMS server while we use it for overflow as a recorder.
    Can anyone clarify if this can be done?
    Thanks
    -Brian

    Recording can be triggered via client-side publish call, or via server-side script.  From the publish cmd, you specify "record" option.  For example,
    ns.publish("mp4:foo", "record"); // ns is a NetStream, "mp4:" prefix tells FMS to record using MP4 container
    Otherwise, if you want to trigger the record via server-side as Jay says, you can simply publish the stream as,
    ns.publish("mp4:foo");
    then from server-side AS, do something like,
    // this handler is called when a stream is published
    // clientObj is the client that is publishing the stream
    // streamObj is the stream that is being published
    application.onPublish = function(clientObj, streamObj)
        streamObj.record("record"); // start recording the stream

Maybe you are looking for