Jump to content
Search Community

Video Loader+Sequence+Best Practice

leadbased test
Moderator Tag

Recommended Posts

I am trying to debug a LoaderMax that has a for loop of various sized clips (5) acting as container for VideoLoaders

The idea is LoaderMax - onComplete the container/VideoLoaders fade up and run in a sequence of 1st playing, 2nd playing, etc in a loop

When I try to test the project, I get wildly different results each time ie: 2,3,4 load and display, but since 1 isn't, no play (and many other permutations)

would it be better for me to make individual (hard-coded) VideoLoaders for each rather than dynamic (for loop) and to work with onChildComplete instead?

perhaps with each loading and then allowing the next to load?

 

here is the code

private function _initGrid ():void{
		 trace("_initGrid ()")

		_queue = new LoaderMax({name:"videoQueue", onChildComplete:_completeChildHandler,onProgress:_progressHandler, onComplete:_completeHandler, onError:_errorHandler, auditSize:true});

		var _num:int = 1
		for (var i:int = 0; i < _gridClips.length; i++)
		{

			_videoClip = _masterContainer.addChild(new (getDefinitionByName(_gridClips[i]) as Class))as MovieClip
			_videoClip.name = "VideoClip"+_num

			_videoClip.addEventListener(MouseEvent.ROLL_OVER, _showVideoControls, false, 0, true);
			_videoClip.addEventListener(MouseEvent.ROLL_OUT, _hideVideoControls, false, 0, true);

			_videoClip.x = _gridX[i]
			_videoClip.y = _gridY[i]
			_videoClip.width = _gridWidth[i]
			_videoClip.height = _gridHeight[i]

			_loader = new VideoLoader(_videoDirectory+_num+".flv", {name:"poppy-video-"+_num, container:_videoClip, width:_videoClip.width, height:_videoClip.height, centerRegistration:true,scaleMode:"stretch", bgColor:0xFFFFFF, autoPlay:false, volume:0, estimatedBytes:1048576,checkPolicyFile:true});
			// ADD FRAME
			_videoFrame = new VideoClipFrame()
			_videoClip.addChild(_videoFrame)
			_videoFrame.width = _videoClip.width
			_videoFrame.height = _videoClip.height

			_queue.append( _loader );
			_num++
		}
		_queue.load();

	}

Link to comment
Share on other sites

I don't quite understand the "wildly different results" comment - could you describe it a bit more? I didn't see the code where you play them and loop them - it sounds like maybe there's a logic problem in there?

 

If you are using an CHILD_COMPLETE events to trigger things, keep in mind that by default, LoaderMax has a maxConnections of 2 which means it will try to have 2 loaders loading simultaneously in the queue to maximize performance. That means the 2nd loader in the queue could complete before the first one. For example, if the first one is a 10MB video and the 2nd one is 1MB, the 2nd one will almost surely complete before the first. Then it'll move on to the next one in the queue (#3) and if that one is also small, that one could complete too before the first one is done. And so on. You can, of course, set maxConnections to 1 if you want everything to load sequentially.

 

In any case, it would be super helpful if you could post an example FLA that demonstrates the issue (the simpler the better). And please make sure you're using the latest version of all the LoaderMax classes (I updated them yesterday).

Link to comment
Share on other sites

Hi-

 

I thought I would chime in here since I am working on a similar project where I literally need to 'sew' together possibly hundreds of clips (40k - 200k) and it needs to be seamless and quick. After playing around with this awesome new tool, I came up with a method that seems to work pretty well.

 

 

Create a LoaderMax and queue up all your videos.

 

Watch the progress event, when it gets to say 4-5% (depends on how many videos you are loading and how quickly they are loaded) then start playing the first video, on the pause event, start up the next one and hide the last clip.

 

 

 

This method is working really well for me and my video set, thought it might be of use to others as well :)

 

Thanks,

 

Kevin Miller

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...