Skip to main content
Known Participant
March 2, 2010
Question

Stream.onStatus event notifications

  • March 2, 2010
  • 1 reply
  • 857 views

We've encountered conceptual difficulties figuring out which stream

is currently being played / started / finished using the onStatus handler for the

Stream Object.

The documentation it is written that the only event which returns details about

the stream currently being played is "NetStream.Play.Start"

This is very peculiar and does not allow internal monitoring of

finished streams...

We are creating dynamic playlists on the FMS and there is

a need to know which stream has just finished playing, not only

a general notification that A stream stopped playing such as
NetStream.Play.Completed or NetStream.Play.Switch (returned from the onPlayStatus handler

of the Stream object)

The best solution would be, to be able to define a custom

handler function to be executed at the end of playing a certain

stream (live or recorded) which will allow perfect

action being taken when the stream reaches its designated end.

for example:

myStream.play("stream name", 10, -1,false,myFunction);


where myFunction would be a customer handler evoked when the stream
reaches its end on the server's playlist Queue.

Is there a way to accomplish the above using FMS 3.5.0 - 3.5.3?

    This topic has been closed for replies.

    1 reply

    Janaki Lakshmikanthan
    Adobe Employee
    Adobe Employee
    March 2, 2010

    Hi,

    NetStream.play() method does not allow you to take the extra parameter to call a custom method. Using the status messages like "NetStream.Play.Start" and "NetStream.Play.Stop", you will have to call your custom method to monitor the streams in the playlist.

    Regards,

    Janaki L

    Known Participant
    March 2, 2010

    we are switching between a main stream and smaller streams which are ads,

    generating alot of Stop / Start / Completed / Switch Events which do not

    signify the actual "finish" of a stream.

    a 20 min stream switched in the middle will send all the above events when resumed / started

    /finished, so its impossible to really know when the stream actually finished and

    assume an action.

    let me explain, how we create a playlist:

    mainStream1.flv - is 10 min stream.

    1. starting the stream s.play("mainStream1.flv",0, 100,false) - playing it for 100 seconds
    2. s.play("ad1.flv",0,-1,false) - playing an ad after 100 seconds played on the first stream
    3. s.play("mainStream1.flv",100,200,false) - resuming the main stream from 100 till 200, after ad1.flv finished
    4. s.play("ad2.flv",0,-1,false) - playing another ad when the main item reaches second 200
    5. s.play("mainStream1.flv",200,-1,false) - resuming the main stream when the ad finished

    now, in the code, the above scenario would look like this:
    s.play("mainStream1.flv",0, 100,false);
    s.play("ad1.flv",0,-1,false);
    s.play("mainStream1.flv",100,200,false);
    s.play("ad2.flv",0,-1,false);
    s.play("mainStream1.flv",200,-1,false);

    FMS sends 3 Completed Events for the mainStream1.flv. 3 started events
    and 2 Switch events.

    I hope the above explicates the difficulty i'm implying....

    Participating Frequently
    March 2, 2010

    With respect to your example, Play.Stop would be issued only once and hence you can conclude that stream had stopped. I suppose that should solve your problem, have you tried that. If there is something else you want, please let us know.