Jump to content
Search Community

VideoLoader Bug?: Sound plays although autoPlay is false

bildschirmsport test
Moderator Tag

Recommended Posts

Hi,

 

first of all thanks for creating LoaderMax. It makes my life so much easier and it immediately replaced my loading queue, which got stuck featurewise a long time ago. ;)

 

While working with the VideoLoader I experienced an issue which I'm not quite sure is related to LoaderMax. I set up a queue of several VideoLoader instances which should cache a FLV. After the first one is loaded only this one should play, while the others remain silent in the cache. After the first video is finished the second in the queue is played. And so on. You get the point.

 

Here's the simplified version of my code:

_queue = new LoaderMax();
for( var i:int = 0; i < array.length; i++ )
{
_queue.append( new VideoLoader( "video"+i+".flv", { name:String(i), id:_vos.length, autoPlay:false, smoothing:true, bufferTime:5,
							bgColor:0x000000, width:716, height:403, scaleMode:ScaleMode.PROPORTIONAL_INSIDE } ) );
}
_counter = 0;
_queue.getLoader(String(_counter)).addEventListener( LoaderEvent.COMPLETE, handleVideoLoadingComplete );
_queue.load( );

private function handleVideoLoadingComplete( event:LoaderEvent ):void 
{
VideoLoader(event.target).removeEventListener( LoaderEvent.COMPLETE, handleVideoLoadingComplete );
playVideo( _counter );
}

private function playVideo( counter:int ):void 
{
_counter = counter;
var loader:VideoLoader = VideoLoader( _queue.getLoader(String(counter)) );

if( _activeVideo != null )
{
	_activeVideo.pauseVideo();
	removeChild( _activeVideo.content );
	_activeVideo.playProgress = 0;
	_activeVideo = null;
}

if( loader.status != LoaderStatus.COMPLETED )
{
	loader.addEventListener( LoaderEvent.COMPLETE, handleVideoLoadingComplete );
	loader.prioritize( true );
}
else
{
	_activeVideo = loader;
	addChild( _activeVideo.content );
	_activeVideo.playVideo();
}
}

 

I removed a lot of my code to illustrate to the issue I'm experiencing, which is that although I set the VideoLoader to autoPlay:false sometimes the sound of another video can be heard while the first one is playing. But only for a few seconds, like the autoPlay value set to late. Or is the bug in my code? Can I improve it in any way to make sure videos are only played when I want them to? My workaround for now would be to set the volume to 0 when appending the VideoLoader instances to the queue.

 

Any help appreciated. Thanx.

David

Link to comment
Share on other sites

Good catch - yeah, that actually has to do with a workaround that's necessary since Flash has problems pausing a NetStream that hasn't fully buffered yet. I just updated VideoLoader to silence the audio initially. Please download the latest and greatest and let me know if that fixes it for you.

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