Merge branch 'develop'

This commit is contained in:
Sam Potts 2018-05-28 10:42:11 +10:00
commit d70a787af1
16 changed files with 63 additions and 68 deletions

View File

@ -1,8 +1,18 @@
# v3.3.9
Again, more changes from @friday!
* Restore window reference in `utils.is.cue()`
* Fix InvalidStateError and IE11 issues
* Respect storage being disabled for storage getter
# v3.3.8
Many changes here thanks to @friday:
* Added missing URL polyfill
* Pause while seeking to mimic default HTML5 behaviour
* Add 'seeked' event listener to update progress (fixes #966)
* Add `seeked` event listener to update progress (fixes #966)
* Trigger seeked event in youtube plugin if either playing or paused (fixes #921)
* Fix for YouTube and Vimeo autoplays on seek (fixes #876)
* Toggle controls improvements

31
dist/plyr.js vendored
View File

@ -407,7 +407,7 @@ var Storage = function () {
createClass(Storage, [{
key: 'get',
value: function get$$1(key) {
if (!Storage.supported) {
if (!Storage.supported || !this.enabled) {
return null;
}
@ -526,7 +526,7 @@ var utils = {
return this.instanceof(input, Event);
},
cue: function cue(input) {
return this.instanceof(input, TextTrackCue) || this.instanceof(input, VTTCue);
return this.instanceof(input, window.TextTrackCue) || this.instanceof(input, window.VTTCue);
},
track: function track(input) {
return this.instanceof(input, TextTrack) || !this.nullOrUndefined(input) && this.string(input.kind);
@ -3628,7 +3628,7 @@ var defaults$1 = {
// Sprite (for icons)
loadSprite: true,
iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/3.3.8/plyr.svg',
iconUrl: 'https://cdn.plyr.io/3.3.9/plyr.svg',
// Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
@ -7599,21 +7599,16 @@ var Plyr = function () {
}, {
key: 'currentTime',
set: function set$$1(input) {
var targetTime = 0;
if (utils.is.number(input)) {
targetTime = input;
// Bail if media duration isn't available yet
if (!this.duration) {
return;
}
// Normalise targetTime
if (targetTime < 0) {
targetTime = 0;
} else if (targetTime > this.duration) {
targetTime = this.duration;
}
// Validate input
var inputIsValid = utils.is.number(input) && input > 0;
// Set
this.media.currentTime = targetTime;
this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0;
// Logging
this.debug.log('Seeking to ' + this.currentTime + ' seconds');
@ -7672,11 +7667,11 @@ var Plyr = function () {
// Faux duration set via config
var fauxDuration = parseFloat(this.config.duration);
// True duration
var realDuration = this.media ? Number(this.media.duration) : 0;
// Media duration can be NaN before the media has loaded
var duration = (this.media || {}).duration || 0;
// If custom duration is funky, use regular duration
return !Number.isNaN(fauxDuration) ? fauxDuration : realDuration;
// If config duration is funky, use regular duration
return fauxDuration || duration;
}
/**

2
dist/plyr.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/plyr.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5813,7 +5813,7 @@ var Storage = function () {
createClass(Storage, [{
key: 'get',
value: function get(key) {
if (!Storage.supported) {
if (!Storage.supported || !this.enabled) {
return null;
}
@ -5932,7 +5932,7 @@ var utils = {
return this.instanceof(input, Event);
},
cue: function cue(input) {
return this.instanceof(input, TextTrackCue) || this.instanceof(input, VTTCue);
return this.instanceof(input, window.TextTrackCue) || this.instanceof(input, window.VTTCue);
},
track: function track(input) {
return this.instanceof(input, TextTrack) || !this.nullOrUndefined(input) && this.string(input.kind);
@ -9034,7 +9034,7 @@ var defaults$1 = {
// Sprite (for icons)
loadSprite: true,
iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/3.3.8/plyr.svg',
iconUrl: 'https://cdn.plyr.io/3.3.9/plyr.svg',
// Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
@ -13005,21 +13005,16 @@ var Plyr = function () {
}, {
key: 'currentTime',
set: function set(input) {
var targetTime = 0;
if (utils.is.number(input)) {
targetTime = input;
// Bail if media duration isn't available yet
if (!this.duration) {
return;
}
// Normalise targetTime
if (targetTime < 0) {
targetTime = 0;
} else if (targetTime > this.duration) {
targetTime = this.duration;
}
// Validate input
var inputIsValid = utils.is.number(input) && input > 0;
// Set
this.media.currentTime = targetTime;
this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0;
// Logging
this.debug.log('Seeking to ' + this.currentTime + ' seconds');
@ -13078,11 +13073,11 @@ var Plyr = function () {
// Faux duration set via config
var fauxDuration = parseFloat(this.config.duration);
// True duration
var realDuration = this.media ? Number(this.media.duration) : 0;
// Media duration can be NaN before the media has loaded
var duration = (this.media || {}).duration || 0;
// If custom duration is funky, use regular duration
return !Number.isNaN(fauxDuration) ? fauxDuration : realDuration;
// If config duration is funky, use regular duration
return fauxDuration || duration;
}
/**

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "plyr",
"version": "3.3.8",
"version": "3.3.9",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "https://plyr.io",
"main": "./dist/plyr.js",

View File

@ -128,13 +128,13 @@ See [initialising](#initialising) for more information on advanced setups.
You can use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript. There's 2 versions; one with and one without [polyfills](#polyfills). My recommendation would be to manage polyfills seperately as part of your application but to make life easier you can use the polyfilled build.
```html
<script src="https://cdn.plyr.io/3.3.8/plyr.js"></script>
<script src="https://cdn.plyr.io/3.3.9/plyr.js"></script>
```
...or...
```html
<script src="https://cdn.plyr.io/3.3.8/plyr.polyfilled.js"></script>
<script src="https://cdn.plyr.io/3.3.9/plyr.polyfilled.js"></script>
```
### CSS
@ -148,13 +148,13 @@ Include the `plyr.css` stylsheet into your `<head>`
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the default CSS, you can use the following:
```html
<link rel="stylesheet" href="https://cdn.plyr.io/3.3.8/plyr.css">
<link rel="stylesheet" href="https://cdn.plyr.io/3.3.9/plyr.css">
```
### SVG Sprite
The SVG sprite is loaded automatically from our CDN (provided by [Fastly](https://www.fastly.com/)). To change this, see the [options](#options) below. For
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.8/plyr.svg`.
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.9/plyr.svg`.
## Ads

View File

@ -56,7 +56,7 @@ const defaults = {
// Sprite (for icons)
loadSprite: true,
iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/3.3.8/plyr.svg',
iconUrl: 'https://cdn.plyr.io/3.3.9/plyr.svg',
// Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',

View File

@ -1,6 +1,6 @@
// ==========================================================================
// Plyr
// plyr.js v3.3.8
// plyr.js v3.3.9
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================
@ -432,21 +432,16 @@ class Plyr {
* @param {number} input - where to seek to in seconds. Defaults to 0 (the start)
*/
set currentTime(input) {
let targetTime = 0;
if (utils.is.number(input)) {
targetTime = input;
// Bail if media duration isn't available yet
if (!this.duration) {
return;
}
// Normalise targetTime
if (targetTime < 0) {
targetTime = 0;
} else if (targetTime > this.duration) {
targetTime = this.duration;
}
// Validate input
const inputIsValid = utils.is.number(input) && input > 0;
// Set
this.media.currentTime = targetTime;
this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0;
// Logging
this.debug.log(`Seeking to ${this.currentTime} seconds`);
@ -494,11 +489,11 @@ class Plyr {
// Faux duration set via config
const fauxDuration = parseFloat(this.config.duration);
// True duration
const realDuration = this.media ? Number(this.media.duration) : 0;
// Media duration can be NaN before the media has loaded
const duration = (this.media || {}).duration || 0;
// If custom duration is funky, use regular duration
return !Number.isNaN(fauxDuration) ? fauxDuration : realDuration;
// If config duration is funky, use regular duration
return fauxDuration || duration;
}
/**

View File

@ -1,6 +1,6 @@
// ==========================================================================
// Plyr Polyfilled Build
// plyr.js v3.3.8
// plyr.js v3.3.9
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================

View File

@ -31,7 +31,7 @@ class Storage {
}
get(key) {
if (!Storage.supported) {
if (!Storage.supported || !this.enabled) {
return null;
}

View File

@ -44,7 +44,7 @@ const utils = {
return this.instanceof(input, Event);
},
cue(input) {
return this.instanceof(input, TextTrackCue) || this.instanceof(input, VTTCue);
return this.instanceof(input, window.TextTrackCue) || this.instanceof(input, window.VTTCue);
},
track(input) {
return this.instanceof(input, TextTrack) || (!this.nullOrUndefined(input) && this.string(input.kind));