restart html video with javascript
17,673
Solution 1
You can use currentTime property as follow
var vid = document.getElementById("myVideo");
vid.currentTime = 0;
Solution 2
You can use:
var video = document.getElementById('vidId');
video.pause();
video.currentTime = 0;
video.load();
Author by
John Smith
Updated on June 27, 2022Comments
-
John Smith almost 2 years
I have a tag in my html code with a locally stored video in it (not a link from youtube). I know there is a way to play/pause the video from javascript by using
.pause()
and.play()
. Lets say I have a button that I would like to reset the video (skip to beginning). Is there a function for that in javascript/ jquery? If not then how can I achieve this?Thanks to everyone in advance.
-
John Smith over 7 yearsWhat does .load() exactly do?