Jump to content
Search Community

Start and stop Video from button?

olleka test
Moderator Tag

Go to solution Solved by Jonathan,

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

  • Solution

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"> 
</video> 
// using jQuery
$("#video")[0].pause();

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

Happy Tweening :)

  • 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.
×
×
  • Create New...