Chrome Extension

Check if video is stopped or playing Javascript only

var video = document.getElementsByTagName("video");
if (video[0].paused) {
    console.log("video is stopped");
    //DO SOMETING...
} else {
    console.log("video is playing");
    //DO SOMETHING...
}

//OR YOU CAN GET video DOM OBJ USING ID
var video = document.getElementById("videoId");
if (video.paused) {
    console.log("video is stopped");
    //DO SOMETING...
} else {
    console.log("video is playing");
    //DO SOMETHING...
}
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

You can use the .paused() method in javascript to check whether a video is playing or not. It will return true if the video is playing and return false if the video is not playing.

You can get a video DOM element using its tag name or id. We have shown both ways in the code snippet by which you can check if it is playing or paused.

Was this helpful?
0 Comments
Open Code Manager We are hiring