Jump to content
Search Community

Replay video (VIDEO_COMPLETE)

mhulse test
Moderator Tag

Recommended Posts

Hello,

 

I hate to ask another question, but...

 

I am using the VideoLoader(). LOVE IT!

 

Quick question... Using this code:

 

_video = new VideoLoader('video.flv', { name: 'video', container: _videoContainer, alpha: 0, autoPlay: true, width: stage.stageWidth, height: stage.stageHeight, scaleMode: 'proportionalInside', volume: 0, bgColor: 0x000000, onInit: onMetaData, onComplete: onVideoLoaded });
_video.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete, false, 0, true);
...
_queue = new LoaderMax({ name: 'mainQueue', onProgress: progressHandler, onComplete: completeHandler, onError: errorHandler });
_queue.append(_video);
_queue.load();

 

As you can see above, I am using "VideoLoader.VIDEO_COMPLETE"; Is there a better way to determine if the video has ended?

 

Also, this is what I am using for a replay button:

 

_video.gotoVideoTime(0)
_video.playVideo();

 

Is there a better way to do that? :)

 

Sorry if noob questions.

 

Thanks so much!

 

Cheers,

Micky

Link to comment
Share on other sites

Two comments:

 

1) Just so you know, you do not need to put your VideoLoader into a LoaderMax instance to load it - all of the loaders in LoaderMax can be used as standalone loaders. Only use a LoaderMax instance if you need a queue (multiple loaders). Well, I mean it's fine to do otherwise but there's no real benefit. So you can do _video.load(); and you can also define onProgress and onComplete directly in the VideoLoader, etc.

 

2) You can just use the second parameter of gotoVideoTime() to force it to play, like _video.gotoVideoTime(0, true); instead of adding a playVideo() after it (although that's perfectly acceptable if you like it more).

Link to comment
Share on other sites

Excellent tips Greensock! Thank you!!!

 

I actually was planning on adding more loaders to my project, but currently I just have one video to load. I will be sure to nuke the queue. :)

 

I was under the assumption that onComplete was for when the video was fully loaded? Looking at the docs, I don't see anything that would let me know when a video has reached the end of its video play (i.e. finishes playing). Not a huge deal, because "VideoLoader.VIDEO_COMPLETE" does the trick. Basically, I just want to change my navigational buttons (change play icon to a replay icon) when the video finishes playing. :)

 

"_video.gotoVideoTime(0, true);" is perfect! Exactly what I was looking for. I missed this bit in the docs... Sorry about that, I should have read more closely.

 

THanks again Greensock! You have been so helpful. I owe you one. :)

 

Cheers,

Micky

Link to comment
Share on other sites

I was under the assumption that onComplete was for when the video was fully loaded? Looking at the docs, I don't see anything that would let me know when a video has reached the end of its video play (i.e. finishes playing).

Oh, yes, you were correct - if you want to know when the video has finished playing, you listen for the VIDEO_COMPLETE event. You had it exactly right.

Link to comment
Share on other sites

Awesome!!! Thanks again Greensock!

 

I love your code! Like I said, as soon as I have the extra $$ I plan on becoming a member! On top of getting some cool extras, I really want to help support your work. :)

 

Have an excellent weekend!

 

Cheers,

Micky

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