NetStreamPlayTransitions.SWITCH for different streams?

533 views Asked by At

i have an rtmp folder with videos, I am trying to do a seamless change to next video using nestsream play2 method. have tried using the fast switching of NetStreamPlayTransitions.SWITCH like below.

        private var FName:Array = ["1av.flv","2av.flv","3av.flv","4av.flv","5av.flv"];
        private var opts:NetStreamPlayOptions = new NetStreamPlayOptions();

// on init of net connection

            video.attachNetStream(stream);
            stream.play(FName[counter]);

// counter increments at playstop of current.
//on playstop of current video. i am calling the new stream function

        public function newStream(address:String):void
        {
            opts.oldStreamName=FName[counter-1];
            opts.streamName = address;
            opts.transition = NetStreamPlayTransitions.SWITCH;
            opts.offset = -1;
            stream.play2(opts);                 
        }

The problem is the switching is not happening. offset=-1 is supposed to be fast switching. The idea is to make a seamless transition to the next video.
if we dont use any transition method or use

opts.transition = NetStreamPlayTransitions.RESET;

its the same as not using any. It just switches normally. RTMP is supposed to provide a relatively faster transition , i am looking for a seamless option .

what am i missing here?

1

There are 1 answers

2
Jonathan Dunlap On

You're always going to have a second or smaller delay between switching streams due to network lag and processing speed. I would instead instance a second NetStream and begin playing that object while the first stream object stops/fades-out. However, if number of connections is a concern, a hack for this might be to use a sound fx between NetStream switches- masking the delay.