I\'ve looked through a couple of questions to find out if an HTML5 element is playing, but can\'t find the answer. I\'ve looked at the W3 documentation and it has an event n
My answer at How to tell if a
Object.defineProperty(HTMLMediaElement.prototype, 'playing', {
get: function(){
return !!(this.currentTime > 0 && !this.paused && !this.ended && this.readyState > 2);
}
})
Now you can use it on video or audio elements like this:
if(document.querySelector('video').playing){
// Do anything you want to
}