Jump to content
Search Community

OnProgress not working after switching bufferMode to false

Nickbee test
Moderator Tag

Recommended Posts

I saw a post on this issue and saw that the class was updated but I'm running into it also. Just to be sure I downloaded the latest version (VERSION: 1.781 of the core).

 

Here's how I init the loader:

 

private function loadFlv():void
	{

		_flvLoader = new VideoLoader(_flvPath, {name:"flvLoader", bgColor:0xFFFFFF, autoPlay:false, bufferMode:true, width:_flvWidth, height:_flvHeight, volume:1, onProgress:progressHandler, onComplete:flvBufferComplete});
		_flvLoader.load();
	}

 

on Buffer Complete

 

private function flvBufferComplete(evt:LoaderEvent):void
	{
_videoPlayer = LoaderMax.getLoader("flvLoader");
		_videoPlayer.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete);
		//switch bufferMode to false so the loading progress will display correctly
		_videoPlayer.bufferMode = false;

       	             //a bunch of other stuff

				//seekerLoadProgress******************************************************
				_seekerLoadProgress = new BarRect();
				_seekerLoadProgress.x = _leftContentWidth;
				_seekerLoadProgress.y = _flvHeight;
				TweenLite.to(_seekerLoadProgress, 0, {tint:0x999999});
				addChild(_seekerLoadProgress);
				_isProgressReady = true;
				//***********************************************************************


	}

 

and my progress function

 

		private function progressHandler(evt:LoaderEvent):void
	{
		if(_isProgressReady)
		{
			if (_videoPlayer.status == LoaderStatus.COMPLETED) 
			{
				_seekerLoadProgress.width = _seekerWidth;
			}
			else
			{
				var pcent:Number = Math.ceil(evt.target.progress);
				_seekerLoadProgress.width = _seekerWidth * pcent;
			}
		}
	}

 

Through on-Screen traces I can tell that the progressHandler is not firing after setting bufferMode = false. Am I doing something wrong?

 

Thanks!

Link to comment
Share on other sites

here's a simple example of the issue. You'll see the gray bar that's added to the stage never adjusts as the file loads. Am I doing something completely wrong?

 

I didn't upload an FLV, but used one at 400 x 226...

 

Thanks!!!!

Link to comment
Share on other sites

Ah yes, good catch. In that particular scenario, the ENTER_FRAME handler that was checking the loading progress had been removed since the loader had completed (while in bufferMode) - I just had to check for that condition and add it back in the bufferMode setter. It should be all fixed in the latest version (uploaded a few minutes ago).

 

Download it at

Link to comment
Share on other sites

I downloaded the new files and unfortunately it's still behaving the same way.

 

Let me know if you need anything else from my end.

I just tested your example and it works perfectly for me. Keep in mind that if you're loading a local file, there's a VERY good chance that it will have COMPLETELY loaded (not just the buffer) by the time the bufferMode completes, so you shouldn't expect to get more PROGRESS events or a second COMPLETE event in that case. You can easily sense if it's fully loaded by checking the "progress" value after you set bufferMode to false. Like:

 

function flvBufferComplete(evt:LoaderEvent):void {
   videoPlayer.bufferMode = false;
   if (videoPlayer.progress         trace("not done loading...will continue to dispatch PROGRESS events and another COMPLETE event.");
   } else {
       trace("the video has fully loaded. No further PROGRESS or COMPLETE events will be dispatched.");
   }
}

 

Or check its status property instead of progress - either one should work just fine.

 

Does that clear things up?

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