Merge branch 'develop' into a11y-improvements

This commit is contained in:
Sam Potts
2018-07-02 23:11:50 +10:00
35 changed files with 248 additions and 278 deletions

View File

@ -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