Jump to content


Start and stop Video from button?

Recommended Posts


Maybe a simple question. But how do I start and stop a HTML5 video from a button in an HTML5 ad?


I have looket in the forum but found nothing so simple ;-)




Link to comment
Share on other sites

Hello olleka, and Welcome to the GreenSock Forum!


This is not really a GSAP API question. We try to stay focused on answering questions about the GSAP API and GSAP Plugins. This is more of a question on how to use the HTML5 <video> element. Which you can find more out about here:


HTMLMediaElement: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement


But to answer your question, the following can be used for pausing a <video> element, it presumes you have an id named video:

<video id="video" width="480" height="280" autoplay> 
    <source src="my-video.mp4"> 
    <source src="my-video.ogv"> 
// using jQuery

// native javascript
var video = document.getElementById("video");

Happy Tweening :)

  • Like 1
Link to comment
Share on other sites

Ok, I understand. Thank you!




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