Jump to content
Search Community

Bug?: resume() does not work with VideoLoader

bildschirmsport test
Moderator Tag

Recommended Posts

Hi,

 

I continued experimenting with the VideoLoader and came across a strange issue. The context is that I have a queue with several VideoLoader instances, some initially paused and others not. I want to cache the first two videos, then start the first video and and continue loading the rest. All instances are appended to a LoaderMax instance. I need the VideoLoader instances in a LoaderMax instance, because I work with the queue in another part of my application where it would be handy to have them in an array like storage. The queue code looks more or less like this:

 

_queue = new LoaderMax({ name:"queue", auditSize:true, onComplete:handleQueueEvents });
_queue.append( new SWFLoader( fontSWF, { name:"fonts", context:currentLoaderContext } ) );
_queue.append( new SWFLoader( appSWF, { name:"app", context:currentLoaderContext } ) );

var videoQueue:LoaderMax = new LoaderMax({ name:"videoQueue" });
for( var i:uint=0; i{
videoQueue.append( new VideoLoader( videos[i], { name:String(i), autoPlay:false, bufferMode:false, paused:i>2 } ) );
}
_queue.append( videoQueue );
_queue.load( );

private function handleQueueEvents( event:LoaderEvent ):void 
{
var videoQueue:LoaderMax = _queue.getLoader("videoQueue") as LoaderMax;
for( var i:int = 0; i < videoQueue.numChildren; i++ )
{
	var loader:VideoLoader = videoQueue.getLoader(String(i)) as VideoLoader;
	// 1)
	if( loader.paused ) loader.resume();
	// 2)
	loader.load();
	// 3)
	loader.vars.paused = false;
}
// 3)
videoQueue.load();
}

 

So, the problem is that I couldn't find a way to resume/load the initially paused loaders.

1) Although loader.paused returns true, the loader can not be resumed with loader.resume();

2) loader.load() doesn't load the video either.

3) This was a kinda desperate approach. I tried setting the paused attribute of the vars object to true and then load the queue again. Already loaded VideoLoader instances would be skipped, and the unpaused instances would be loaded. Then again I realized the vars Object is only there to initialize the loader and doesn't have an affect on the loader when changed afterwards. Right? And videoQueue.load() doesn't work because the status is 2 (LoaderStatus.COMPLETED). So calling load() doesn't make sense to the queue.

 

Did I something wrong? Or did I misunderstood the init attribute paused? I'm really stuck right now. Can you help?

 

Thanx.

David

Link to comment
Share on other sites

You should definitely be able to resume() and/or load() a paused VideoLoader - I just triple-checked on my end and it worked perfectly for me. I wonder if there's something else going on in your code. Could you send me a simple example FLA that demonstrates the problem (please include your video(s) too). You're using the latest version, right?

 

And for the record, yes, if you resume() or load() a paused loader, it will toggle its paused state to false. You should not need to do anything fancy or implement funky workarounds. The latest version of LoaderMax should also allow you to load() a LoaderMax that has a status of COMPLETE but its children were unpaused after it completed (it's smart enough to recognize that and allow the load()).

Link to comment
Share on other sites

Hi Jack,

 

I think I boiled it down to the point where I can say there definitely is a bug in the VideoLoader class. The problem seems to be related to the autoPlay attribute within the vars object. Here the code:

 

_queue = new LoaderMax({ name:"queue", auditSize:true, onComplete:handleQueueComplete, onProgress:handleQueueProgress });
_queue.append( new SWFLoader( fontsURL, { name:"fonts", context:currentLoaderContext } ) );
_queue.append( new SWFLoader( appURL, { name:"app", context:currentLoaderContext } ) );
_queue.append( new VideoLoader( flvURL, { name:String(1), autoPlay:false, smoothing:true } ) );
_queue.load();

 

In the code above the queue is never finished. At least the onComplete function is never called and the progress value never reaches 1. When I change autoPlay to true everything works like a charm. I also tested this with the code I initially posted and with autoPlay:true for the VideoLoader instances it works.

 

Hope this helps.

David

Link to comment
Share on other sites

I'm still baffled - I tested it and it worked perfectly even with autoPlay:false which is why I asked if you'd be so kind as to send me an example FLA and video(s) that reproduce the problem so that I could just open the FLA, hit publish, and see the problem. That's SUPER helpful in trying to troubleshoot. You are using the latest version of all the classes, right? Not a beta version?

Link to comment
Share on other sites

Ok, I'll try to extract an example from my project and send you FLA. But right now "deadlines are looming". ;) Maybe I'll get to it later this evening. I'm using the latest classes and I tried it with the SWC from my GreenSock account and with the classes downloaded at www.loadermax.com. Same result.

 

I'll get back to you with an example FLA as soon as possible.

Thanks for your support.

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