Fix for playing getter as currentTime check is flaky
This commit is contained in:
parent
d3b31e595a
commit
4b82e89845
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.js.map
vendored
2
dist/plyr.js.map
vendored
File diff suppressed because one or more lines are too long
@ -290,14 +290,7 @@ class Plyr {
|
|||||||
* Get playing state
|
* Get playing state
|
||||||
*/
|
*/
|
||||||
get playing() {
|
get playing() {
|
||||||
// Because the third party players don't fire timeupdate as frequently as HTML5,
|
return !this.paused && !this.ended && (this.isHTML5 ? this.media.readyState > 2: true);
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +138,6 @@ const ui = {
|
|||||||
|
|
||||||
// Check playing state
|
// Check playing state
|
||||||
checkPlaying() {
|
checkPlaying() {
|
||||||
window.setTimeout(() => {
|
|
||||||
// Class hooks
|
// Class hooks
|
||||||
utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
|
utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
|
||||||
utils.toggleClass(this.elements.container, this.config.classNames.stopped, this.paused);
|
utils.toggleClass(this.elements.container, this.config.classNames.stopped, this.paused);
|
||||||
@ -150,7 +149,6 @@ const ui = {
|
|||||||
|
|
||||||
// Toggle controls
|
// Toggle controls
|
||||||
this.toggleControls(!this.playing);
|
this.toggleControls(!this.playing);
|
||||||
}, 100);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Check if media is loading
|
// Check if media is loading
|
||||||
|
Loading…
x
Reference in New Issue
Block a user