Friday, 9 September 2011

AS3: FLVPlayback activeVideoPlayerIndex and multiple videos

Working on an old-school project that had an annoying flicker when switching between video's, here is a sample of the code:

function setVideoSequence(url1in:String, url2in:String):void {
   movFLV.flvPlayback.activeVideoPlayerIndex = 0;
   movFLV.flvPlayback.source = url2in;
   movFLV.flvPlayback.activeVideoPlayerIndex = 1;
   movFLV.flvPlayback.source = url1in;
   movFLV.flvPlayback.visibleVideoPlayerIndex = 1;
   movFLV.flvPlayback.play();
   url2 = url2in;
   movFLV.flvPlayback.addEventListener(fl.video.VideoEvent.COMPLETE, loadNextVideo);
}

function loadNextVideo(e:fl.video.VideoEvent):void {
   movFLV.flvPlayback.activeVideoPlayerIndex = 0;
   movFLV.flvPlayback.visibleVideoPlayerIndex = 0;
   movFLV.flvPlayback.play();
}

No comments:

Post a Comment