Skip to main content

Stop HTML5 Video Playback in JavaScript

Stopping HTML5 video playback is a simple process that involves using the pause() method. This method pauses the video playback and resets the playhead to the beginning of the video. Here is an example of how to stop video playback using JavaScript:

var videoPlayer = document.getElementById("myVideoPlayer");
videoPlayer.pause();
videoPlayer.currentTime = 0;
var players = document.getElementsByTagName("player");
for(var i = 0; i < players.length; i++) {
    players[i].pause();
    players[i].currentTime = 0;
}

By continuing to use the site, you agree to the use of cookies.