Jump to content


Possible to play part of a video on button press with GSAP?

Moderator Tag

Recommended Posts

Hey everyone. Is there any way to animate a video so that if for an example a button is pressed, it will play 2 seconds of the video, and then pause the video again? And then when another button is pressed, it will play another two seconds of the video? 

Any help is appreciated. Thanks! 

Link to comment
Share on other sites

Hey man, thanks for the reply! I tried out your method, and it works great for what I want to achieve. However, I do have a problem, and it occurs on your codepen example too. 

Sometimes it pauses the video randomly. It especially happens when the whole sequence has been played through and I wanna play it again. Not sure what is causing this, or if there is a fix. 

Once again, thanks for your help, you are a true wiz.

Link to comment
Share on other sites

20 minutes ago, JimmyK said:

Sometimes it pauses the video randomly


Then maybe it's buffering. The canplaythrough event is just an estimate. You might need to download the video. Google how to create a BLOB and use that as a video source.


But video is super complicated, and well beyond the scope of this forum. Here's a good place to start learning about all the different properties and events available.




  • Like 1
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.