HTML5 Video pause and rewind
You can get a reference to your jquery video element upon opening it (or closing the popup) and pause it using pause(), and then set the "currentTime" property to 0 to go back to the beginning.
Here's a reference to the documentation for currentTime.
here's a code sample:
var mediaElement = document.getElementById("video"); mediaElement.pause(); mediaElement.currentTime = 0;
To have a proper stop
(pause & rewind) functionality you could do the following:
var video = document.getElementById('vidId');// or video = $('.video-selector')[0];video.pause();video.currentTime = 0;video.load();
Note: This is the only version that worked for me in chrome using nodejs
(meteorjs
) in the backend, serving webm
& ogg
files
Just call the pause()
method of the video element. To reset the time, set currentTime
to 0 (or any other value if needed, in seconds).