Added ended and playing getters

This commit is contained in:
Sam Potts
2017-11-20 10:48:28 +11:00
parent dc391c98c6
commit feae00224e
7 changed files with 34 additions and 9 deletions

View File

@ -283,6 +283,14 @@ class Plyr {
return this.media.paused;
}
get playing() {
return this.currentTime > 0 && !this.paused && !this.ended && (this.isHTML5 ? this.media.readyState > 2 : true);
}
get ended() {
return this.media.ended;
}
/**
* Toggle playback based on current status
* @param {boolean} toggle