Search code snippets, questions, articles...

Videojs check if video is playing

var videoObj = videojs("video_id");

if (!videoObj.paused()) {
    console.log("Video is playing");
} else {
    console.log("Video is paused");

//USING .paused() function of videojs

To check whether a video is playing or not you can use .paused() method if you are using Videojs library in your project. The method will return false if the video is in play mode and return true if it is paused.

As in the above code snippet, we have wrapped the function inside the if-else condition and we are logging if the video is playing or not. You can write your code inside those conditions if you have any requirements.

Also, we have initialized Videojs object in our videoObj variable that will contain all the properties and methods related to Videojs player.

Search Index Data (The code snippet can also be found with below search text)

Check whether the video is in play mode using Videojs
Was this helpful?
Programming Feeds
Learn something new everyday on Devsheet