Jump to content
Search Community

pause video after several seconds ad resume timeline

one2gov test
Moderator Tag

Go to solution Solved by Dipscom,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

How to pause video after 2 seconds and continue timeline? 

// start the video and pauses the timeline
timeline.addPause("+=0", video.play, null, video);

// resume animation after video ends
timeline.to(video, 3, { opacity: 0, scale: 1.2 });


// just to see that video.play is actually triggering a real play event on the video
video.addEventListener("play", function() {
  output.innerHTML = "video start";
});

// resumes the animation when the video is paused
video.addEventListener("pause", function() {
  // resume the animation
  timeline.resume();
  
  output.innerHTML += "<br/>video stop";
});

See the Pen ZBLQYd by one2gov (@one2gov) on CodePen

Link to comment
Share on other sites

  • Solution

Thanks for the example pen, made it very clear your intentions.

 

:)

 

One way is by expanding the callback in your .addPause() like so:

// start the video and pauses the timeline
timeline.addPause("+=0", function() {
  video.play();
  // Pauses the video after two seconds
  TweenMax.delayedCall(2, video.pause, null, video);
});
  • Like 3
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...