diff options
author | Sam Potts <sam@potts.es> | 2018-07-02 23:11:50 +1000 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2018-07-02 23:11:50 +1000 |
commit | e61ebd8d05b270aba93580e28999bc2af22b2686 (patch) | |
tree | 6fe01bd9ac8bb79a352f323b2453052969e78018 /src/js/plyr.js | |
parent | 3bf1c59bd6a5beb32ee76ba46e37692c2b1c077f (diff) | |
parent | 6eeca8b5d1c9faa4573e403a9ec060dd99d092e5 (diff) | |
download | plyr-e61ebd8d05b270aba93580e28999bc2af22b2686.tar.lz plyr-e61ebd8d05b270aba93580e28999bc2af22b2686.tar.xz plyr-e61ebd8d05b270aba93580e28999bc2af22b2686.zip |
Merge branch 'develop' into a11y-improvements
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r-- | src/js/plyr.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 9f3def07..cbf88793 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1,6 +1,6 @@ // ========================================================================== // Plyr -// plyr.js v3.3.15 +// plyr.js v3.3.16 // https://github.com/sampotts/plyr // License: The MIT License (MIT) // ========================================================================== @@ -311,18 +311,23 @@ class Plyr { get isHTML5() { return Boolean(this.provider === providers.html5); } + get isEmbed() { return Boolean(this.isYouTube || this.isVimeo); } + get isYouTube() { return Boolean(this.provider === providers.youtube); } + get isVimeo() { return Boolean(this.provider === providers.vimeo); } + get isVideo() { return Boolean(this.type === types.video); } + get isAudio() { return Boolean(this.type === types.audio); } @@ -490,8 +495,9 @@ class Plyr { // Faux duration set via config const fauxDuration = parseFloat(this.config.duration); - // Media duration can be NaN before the media has loaded - const duration = (this.media || {}).duration || 0; + // Media duration can be NaN or Infinity before the media has loaded + const realDuration = (this.media || {}).duration; + const duration = !is.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration return fauxDuration || duration; @@ -945,6 +951,7 @@ class Plyr { on(event, callback) { on.call(this, this.elements.container, event, callback); } + /** * Add event listeners once * @param {string} event - Event type @@ -953,6 +960,7 @@ class Plyr { once(event, callback) { once.call(this, this.elements.container, event, callback); } + /** * Remove event listeners * @param {string} event - Event type |