diff options
author | Sam Potts <sam@potts.es> | 2018-06-29 00:43:02 +1000 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2018-06-29 00:43:02 +1000 |
commit | 7de9fd1d65471d54410b6a0069893a38eb1cbb22 (patch) | |
tree | 47d6c6d997802e7d3efcad41d16d158af915084c /src/js/plyr.js | |
parent | ac64350a5fb658f0c9d96063a3cdb8871669cd55 (diff) | |
parent | 566c05983233f935b2d537b4f9f682e464aab27c (diff) | |
download | plyr-7de9fd1d65471d54410b6a0069893a38eb1cbb22.tar.lz plyr-7de9fd1d65471d54410b6a0069893a38eb1cbb22.tar.xz plyr-7de9fd1d65471d54410b6a0069893a38eb1cbb22.zip |
Merge branch 'develop'
# Conflicts:
# changelog.md
# demo/dist/demo.css
# demo/dist/demo.js.map
# demo/dist/demo.min.js
# demo/dist/demo.min.js.map
# dist/plyr.css
# dist/plyr.js.map
# dist/plyr.min.js.map
# dist/plyr.polyfilled.js.map
# dist/plyr.polyfilled.min.js
# dist/plyr.polyfilled.min.js.map
# package.json
# readme.md
# src/js/plyr.js
# src/js/plyr.polyfilled.js
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 37c2d3c2..d1f14881 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1,6 +1,6 @@ // ========================================================================== // Plyr -// plyr.js v3.3.20 +// plyr.js v3.3.21 // https://github.com/sampotts/plyr // License: The MIT License (MIT) // ========================================================================== @@ -310,18 +310,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); } @@ -489,8 +494,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; @@ -944,6 +950,7 @@ class Plyr { on(event, callback) { on.call(this, this.elements.container, event, callback); } + /** * Add event listeners once * @param {string} event - Event type @@ -952,6 +959,7 @@ class Plyr { once(event, callback) { once.call(this, this.elements.container, event, callback); } + /** * Remove event listeners * @param {string} event - Event type |