How to make use of play2() function in order to perform fast stream switching of videos?

As the Documentation says: "The default value of offset is -1, which defaults the switching behavior to standard. In this mode, the server determines a good transition point between the streams forward in time from the point it receives the switch call, and switches at that point."

So you have to change the 'offset' parameter to a value higher than the current playback time (Netstream.time). If the value is less, a NetStream.Play.Failed status event is sent.


It could be that the server is trying to find the nearest i-frame to the current offset and that takes time. If you know what FPS is and the time between two i-frames is you could try to seek to a time very near to the next or previous i-frame, that would speed up the search and serving.

more info on i-frame: http://en.wikipedia.org/wiki/Video_compression_picture_types