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