diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/js/plyr.js | 9 | ||||
-rw-r--r-- | src/js/ui.js | 22 |
2 files changed, 11 insertions, 20 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 52255b16..4ec1c207 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -290,14 +290,7 @@ class Plyr { * Get playing state */ get playing() { - // Because the third party players don't fire timeupdate as frequently as HTML5, - // we can't use the check for currentTime > 0 for those players which is a shame - // readystate also does not exist for the embedded players - if (this.isHTML5) { - return !this.paused && !this.ended && this.currentTime > 0 && this.media.readyState > 2; - } - - return !this.paused && !this.ended; + return !this.paused && !this.ended && (this.isHTML5 ? this.media.readyState > 2: true); } /** diff --git a/src/js/ui.js b/src/js/ui.js index 062331dc..3807d9f3 100644 --- a/src/js/ui.js +++ b/src/js/ui.js @@ -138,19 +138,17 @@ const ui = { // Check playing state checkPlaying() { - window.setTimeout(() => { - // Class hooks - utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing); - utils.toggleClass(this.elements.container, this.config.classNames.stopped, this.paused); - - // Set aria state - if (utils.is.array(this.elements.buttons.play)) { - Array.from(this.elements.buttons.play).forEach(button => utils.toggleState(button, this.playing)); - } + // Class hooks + utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing); + utils.toggleClass(this.elements.container, this.config.classNames.stopped, this.paused); + + // Set aria state + if (utils.is.array(this.elements.buttons.play)) { + Array.from(this.elements.buttons.play).forEach(button => utils.toggleState(button, this.playing)); + } - // Toggle controls - this.toggleControls(!this.playing); - }, 100); + // Toggle controls + this.toggleControls(!this.playing); }, // Check if media is loading |