Jump to content
Search Community

Not Receiving certain video loader Events.

HarryBrook test
Moderator Tag

Recommended Posts

Hi,

 

I have a series of LoaderMax videos playing and the VIDEO_CUE_POINT events are working fine but for some reason the VIDEO_COMPLETE and BUFFER_EMPTY events do not seem to be firing. Could you offer any advice given the example below? I've checked many times and can't see an error with my code.

 

I've cut out the main stuff. I can post more if anything else is needed.

 

Thank you.

 

import com.greensock.*;


// example of 2 queues of which the loaders below are attached to

var VideoQueue:LoaderMax = new LoaderMax({name:"VideoQueue", onProgress:progressHandler, onComplete:completeHandler, onChildComplete:_childCompleteHandler, onError:errorHandler, maxConnections:3});

var VideoQueue1:LoaderMax = new LoaderMax({name:"VideoQueue1", onProgress:progressHandler, onComplete:completeHandler, onChildComplete:_childCompleteHandler, onError:errorHandler, maxConnections:2}); // example of 2 queues

// all the below are added at the same time at the beginning of the first video.
// is this adding too many at one time?


s_intro.addEventListener(VideoLoader.VIDEO_CUE_POINT, cuePointHandler); // working fine
s_1a.addEventListener(VideoLoader.VIDEO_CUE_POINT, cuePointHandler); // working fine
s_1b.addEventListener(VideoLoader.VIDEO_CUE_POINT, cuePointHandler); // working fine


s_intro.addEventListener(VideoLoader.VIDEO_BUFFER_EMPTY, _videoBufferEmpty); // this is an example of my BufferEmpty Listeners which aren't working.

s_intro.addEventListener(VideoLoader.VIDEO_COMPLETE, s_intro_end);
s_1a.addEventListener(VideoLoader.VIDEO_COMPLETE, s_1_end);
s_1b.addEventListener(VideoLoader.VIDEO_COMPLETE, s_1_end);
s_2a.addEventListener(VideoLoader.VIDEO_COMPLETE, s_2_end);
s_2b.addEventListener(VideoLoader.VIDEO_COMPLETE, s_2_end);
s_3a.addEventListener(VideoLoader.VIDEO_COMPLETE, s_3_end);
s_3b.addEventListener(VideoLoader.VIDEO_COMPLETE, s_3_end);


// Below is an example of the VIDEO_COMPLETE functions that are not receiving anything whatsoever without any errors.


function s_intro_end(event:LoaderEvent):void {

trace("End of INTRO") //

if (decision_A == false) {

showVideo(s_1a);

trace("playing Option A");

} else if (decision_A == true) {

showVideo(s_1b);

trace("playing Option B");
}
}

// And Finally the Buffer Empty function that also isnt working:


function _videoBufferEmpty(event:LoaderEvent):void {

trace("Buffer Empty");
trace(event.data);
MonsterDebugger.trace(this, "Buffer Empty");

if (videoStarted == true) {

_currentVideo.addEventListener(VideoLoader.VIDEO_BUFFER_FULL, bufferingFull);
_currentVideo.addEventListener(LoaderEvent.PROGRESS, bufferingProgress);

addChild(bufferScreen);// tween in
TweenMax.to(bufferScreen, 0.2, {alpha:1});
addChild(progressbarBuffer);
TweenMax.to(progressbarBuffer, 0.3, {alpha:1});

MonsterDebugger.trace(this, "add Buffer and Progress Listener | add bufferScreen");

}
}


 

 

Have I done anything wrong here?

Link to comment
Share on other sites

first, please make sure you are using the latest version of LoaderMax.

 

second, I'm not a video buffer expert, but I made a little example to track the buffer progress of a video and the firing of the VIDEO_BUFFER_EMPTY and VIDEO_COMPLETE events.

 

You can simply paste the following code into an fla

 

import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.*;
import flash.events.Event;
import flash.events.MouseEvent;


var video:VideoLoader = new VideoLoader("http://adobe.edgeboss.net/download/adobe/adobetv/gotoandlearn/beapurr.mp4", {container:this});
video.addEventListener(VideoLoader.VIDEO_BUFFER_EMPTY, bufferEmptyHandler);
function bufferEmptyHandler(e:LoaderEvent):void{
trace("*** VIDEO_BUFFER_EMPTY fired ***");
}

video.addEventListener(VideoLoader.VIDEO_COMPLETE, videoCompleteHandler);
function videoCompleteHandler(e:LoaderEvent):void{
trace("*** VIDEO_COMPLETE fired ***");
removeEventListener(Event.ENTER_FRAME, bufferTrace);
}

//click to jump ahead of the buffer
addEventListener(MouseEvent.CLICK, clickHandler)
function clickHandler(e:MouseEvent):void{
trace("click -- jump ahead of the buffer --");
trace(video.duration);
video.gotoVideoTime(video.duration - 2);
}

//constantly monitor the buffer
addEventListener(Event.ENTER_FRAME, bufferTrace)
function bufferTrace(e:Event):void{
trace("bufferProgress = " + video.bufferProgress);
}

video.load();

 

Do the following:

 

export the swf.

watch the buffer fill up

a few seconds after the video starts to play click the screen anywhere

this will force the video to jump to nearly the end of the video (beyond what has been buffered)

you will see a single trace of "VIDEO_BUFFER_EMPTY fired"

the buffer will proceed to fill

the video will proceed to play

the video will get to the end in 2 seconds

a VIDEO_COMPLETE event will fire and trace

 

If you continue to have trouble with the events, please upload a very simple demonstration that we can test.

Link to comment
Share on other sites

Thank you very much for this, I noticed an error in the way I had set out the loadermax variables and so the VIDEO_COMPLETE's are working great.

 

Unfortunately the BUFFER_EMPTY's are still not triggering my buffering screen. I am expecting them to be fired when the video pauses due to insufficient download speed, is this the correct usage? And might there be another way of detecting if the video is buffering if this cannot be solved? Otherwise i can try and make a condensed sample for you.

 

Thanks again!

Link to comment
Share on other sites

Yep, it sounds like you're understanding correctly - the buffer empty events should be dispatched when the buffer is empty. Please do post a very simple example that demonstrates the problem so that we can publish on our end. Thanks!

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