Jump to content
Search Community

Video Loading and Playback

doogie test
Moderator Tag

Recommended Posts

I'm bulk loading videos and then playing them.  That part works.  But after a video has been played once it will play back very fast almost every time after that.  I have no idea why.  Any help appreciated.

package {

public class VideoClass extends MovieClip {
private var vid1_vid:ContentDisplay;
private var vid1_ldr:VideoLoader;

private var vid2_vid:ContentDisplay;
private var vid2_ldr:VideoLoader;

private var vid3_vid:ContentDisplay;
private var vid3_ldr:VideoLoader;

//store video paths
private var vid1_BT:String;
private var vid2_BT:String;
private var vid3_BT:String;
private var videoArray:Array = new Array();

public function VideoClass(_videoArray:Array) {
   videoArray = _videoArray;

for (var i:uint = 0; i < 7; i++) {
   if (i == 0) {
      vid1_BT = videoArray[i];
   } else if (i == 1) {
      vid2_BT = videoArray[i];
   } else {
      vid3_BT = videoArray[i];
   } 
}


//activate the loaders we need
LoaderMax.activate([ImageLoader, SWFLoader, VideoLoader]); 

var urls:Array = [vid1_BT, vid2_BT, vid3_BT];
var queue:LoaderMax = LoaderMax.parse(urls, 
 {maxConnections:1,
  //onProgress:_progressHandler, 
  onComplete:_queueCompleteHandler 
  //onChildComplete:_childCompleteHandler
  },
 {autoPlay:false});
queue.load();
}


private function _queueCompleteHandler(event:LoaderEvent):void {
//vid1 video
vid1_ldr = LoaderMax.getLoader(vid1_BT);
vid1_vid = LoaderMax.getContent(vid1_BT);
vid1_vid.x = vid1_vid.y = 0;

//vid2 video
vid2_ldr = LoaderMax.getLoader(vid2_BT);
vid2_vid = LoaderMax.getContent(vid2_BT);
vid2_vid.x = vid2_vid.y = 0;

//vid3 video
vid3_ldr = LoaderMax.getLoader(vid3_BT);
vid3_vid = LoaderMax.getContent(vid3_BT);
vid3_vid.x = vid3_vid.y = 0;


vid1_ldr.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete, false, 0, true);
vid2_ldr.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete, false, 0, true);
vid3_ldr.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete, false, 0, true);
}

public function addVideo(_vid:String) {
   switch (_vid){
   case "vid1":
      addChild(vid1_vid);
      vid1_ldr.playVideo();
      vid1_ldr.gotoVideoTime(0);
      break;

   case "vid2":
      addChild(vid2_vid);
      vid2_ldr.playVideo();
      vid2_ldr.gotoVideoTime(0);
      break;

   case "vid3":
      addChild(vid3_vid);
      vid3_ldr.playVideo();
      vid3_ldr.gotoVideoTime(0);
      break;
   }
}

private function onVideoComplete(e:*) {
   var vid = e.target.content;
   removeChild(vid);
}

}
}

Link to comment
Share on other sites

Hi,

 

I see you posted in another thread as well.

Looking at your code, nothing jumps out as cause for a video to play faster than normal.

Please provide a simple file that we can publish with all necessary assets.

 

In the case of videos, sometimes the manner in which they are encoded plays a factor, so it is necessary to have your fla and videos. 1 or 2 small videos should be fine. 

 

If your files are too big to upload, you can use a service like http://ge.tt (free and easy, no signups)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...