Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
azuki

How to delay the start of a video?

Recommended Posts

I apologize if this has already been answered, I searched the forums and the docs and couldn't find an answer!

 

I'm simply loading a video using VideoLoader and would like to delay the start of the video, which is set to autoplay immediately. I'd prefer not to wait until the video is completely loaded.

 

Is there a way to append a videoLoader.load(); into a timelineLite so I can queue it up with some other animations?

 

Thanks!

Link to comment
Share on other sites

Sure. It would look something like this:

 

var video:VideoLoader = new VideoLoader("myFile.flv", {autoPlay:false, container:this});
video.load();

var tl:TimelineMax = new TimelineMax();
tl.append(...append your tweens...);
tl.addCallback(video.playVideo, 5); //plays the video at the 5-second point

 

Does that answer your question?

Link to comment
Share on other sites

yes it does, thank you!

Is 'addCallback' something only TimelineMax, versus TimelineLite, offers?

 

As a side note, I've been using Greensock quite a bit and learning more and more as I go along. Whenever I'm stumped, I go through the Docs, Tips, Forums, Google, basically every resource save posting on the forums because, from what I've read, it's just you moderating this thing (impressive, btw). Is there another resource I'm missing or is this it and the answer to this question just passed me by?

 

thanks again

Link to comment
Share on other sites

yes it does, thank you!

Is 'addCallback' something only TimelineMax, versus TimelineLite, offers?

 

Exactly - addCallback() is one of the extra features that TimelineMax adds compared to TimelineLite. Technically you could do the same thing by inserting/appending a TweenLite instance that has an onComplete into TimelineLite (don't forget to set immediateRender:false and overwrite:false), but TimelineMax's addCallback() makes it simpler.

 

As a side note, I've been using Greensock quite a bit and learning more and more as I go along. Whenever I'm stumped, I go through the Docs, Tips, Forums, Google, basically every resource save posting on the forums because, from what I've read, it's just you moderating this thing (impressive, btw). Is there another resource I'm missing or is this it and the answer to this question just passed me by?

Well I certainly don't blame you for having a question like this, but yes, you could find all of this information in the ASDocs. I can't, of course, answer every possible question specifically in there, but the ASDocs cover addCallback() and how to stop a VideoLoader from playing automatically (autoPlay:false) and how to start video with a playVideo() call, etc. Don't feel bad about posting a question here - that's what the forums are for. It's always super helpful, though, if you can try to keep the questions concise and provide a sample FLA if at all possible. I don't say that because you did a bad job of this at all (you didn't) - I say it more for others who are reading this :) If you read many of my responses, the #1 repeated thing by far is "could you please post a sample FLA that demonstrates the issue" :)

 

Enjoy the tools. I'm glad to hear they've been helpful 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.
×