javascript
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.
Was this helpful?
Similar Posts
- Check if video is stopped or playing Javascript only
- How to Check if Arrays in a Object Are All Empty
- Check if a variable is null, empty, undefined or false Javascript
- Check if a string is Palindrome or not using Javascript
- Check if all array items are equal javascript
- Check if given value is an array in Javascript
- Check whether a checkbox is checked or not using Javascript only