This commit is contained in:
Sam Potts 2018-05-06 01:32:51 +10:00
parent ceb6c9a100
commit 1655150092
17 changed files with 78 additions and 24 deletions

View File

@ -1,3 +1,12 @@
# v3.3.5
* Removed `.load()` call as it breaks HLS (see #870)
# v3.3.4
* Fix for controls sometimes not showing while video is playing
* Fixed logic for show home tab on option select
# v3.3.3 # v3.3.3
* Reverted change to show home tab on option select due to usability regression * Reverted change to show home tab on option select due to usability regression

23
dist/plyr.js vendored
View File

@ -1850,7 +1850,7 @@ var ui = {
// Check playing state // Check playing state
checkPlaying: function checkPlaying() { checkPlaying: function checkPlaying(event) {
// Class hooks // Class hooks
utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing); utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
utils.toggleClass(this.elements.container, this.config.classNames.paused, this.paused); utils.toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
@ -1859,6 +1859,11 @@ var ui = {
// Set ARIA state // Set ARIA state
utils.toggleState(this.elements.buttons.play, this.playing); utils.toggleState(this.elements.buttons.play, this.playing);
// Only update controls on non timeupdate events
if (utils.is.event(event) && event.type === 'timeupdate') {
return;
}
// Toggle controls // Toggle controls
this.toggleControls(!this.playing); this.toggleControls(!this.playing);
}, },
@ -3742,7 +3747,7 @@ var defaults$1 = {
// Sprite (for icons) // Sprite (for icons)
loadSprite: true, loadSprite: true,
iconPrefix: 'plyr', iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/3.3.3/plyr.svg', iconUrl: 'https://cdn.plyr.io/3.3.5/plyr.svg',
// Blank video (used to prevent errors on source change) // Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4', blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
@ -4734,18 +4739,27 @@ var Listeners = function () {
on(this.player.elements.settings.form, 'click', function (event) { on(this.player.elements.settings.form, 'click', function (event) {
event.stopPropagation(); event.stopPropagation();
// Go back to home tab on click
var showHomeTab = function showHomeTab() {
var id = 'plyr-settings-' + _this4.player.id + '-home';
controls.showTab.call(_this4.player, id);
};
// Settings menu items - use event delegation as items are added/removed // Settings menu items - use event delegation as items are added/removed
if (utils.matches(event.target, _this4.player.config.selectors.inputs.language)) { if (utils.matches(event.target, _this4.player.config.selectors.inputs.language)) {
proxy(event, function () { proxy(event, function () {
_this4.player.language = event.target.value; _this4.player.language = event.target.value;
showHomeTab();
}, 'language'); }, 'language');
} else if (utils.matches(event.target, _this4.player.config.selectors.inputs.quality)) { } else if (utils.matches(event.target, _this4.player.config.selectors.inputs.quality)) {
proxy(event, function () { proxy(event, function () {
_this4.player.quality = event.target.value; _this4.player.quality = event.target.value;
showHomeTab();
}, 'quality'); }, 'quality');
} else if (utils.matches(event.target, _this4.player.config.selectors.inputs.speed)) { } else if (utils.matches(event.target, _this4.player.config.selectors.inputs.speed)) {
proxy(event, function () { proxy(event, function () {
_this4.player.speed = parseFloat(event.target.value); _this4.player.speed = parseFloat(event.target.value);
showHomeTab();
}, 'speed'); }, 'speed');
} else { } else {
var tab = event.target; var tab = event.target;
@ -6435,7 +6449,7 @@ var Ads = function () {
}, { }, {
key: 'enabled', key: 'enabled',
get: function get$$1() { get: function get$$1() {
return this.player.isHTML5 && this.player.isVideo && this.player.config.ads.enabled && utils.is.string(this.publisherId) && this.publisherId.length; return this.player.isVideo && this.player.config.ads.enabled && !utils.is.empty(this.publisherId);
} }
}, { }, {
key: 'tagUrl', key: 'tagUrl',
@ -7028,7 +7042,8 @@ var Plyr = function () {
key: 'stop', key: 'stop',
value: function stop() { value: function stop() {
if (this.isHTML5) { if (this.isHTML5) {
this.media.load(); this.pause();
this.restart();
} else if (utils.is.function(this.media.stop)) { } else if (utils.is.function(this.media.stop)) {
this.media.stop(); this.media.stop();
} }

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

@ -6884,7 +6884,7 @@ var ui = {
// Check playing state // Check playing state
checkPlaying: function checkPlaying() { checkPlaying: function checkPlaying(event) {
// Class hooks // Class hooks
utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing); utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
utils.toggleClass(this.elements.container, this.config.classNames.paused, this.paused); utils.toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
@ -6893,6 +6893,11 @@ var ui = {
// Set ARIA state // Set ARIA state
utils.toggleState(this.elements.buttons.play, this.playing); utils.toggleState(this.elements.buttons.play, this.playing);
// Only update controls on non timeupdate events
if (utils.is.event(event) && event.type === 'timeupdate') {
return;
}
// Toggle controls // Toggle controls
this.toggleControls(!this.playing); this.toggleControls(!this.playing);
}, },
@ -8776,7 +8781,7 @@ var defaults$1 = {
// Sprite (for icons) // Sprite (for icons)
loadSprite: true, loadSprite: true,
iconPrefix: 'plyr', iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/3.3.3/plyr.svg', iconUrl: 'https://cdn.plyr.io/3.3.5/plyr.svg',
// Blank video (used to prevent errors on source change) // Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4', blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
@ -9768,18 +9773,27 @@ var Listeners = function () {
on(this.player.elements.settings.form, 'click', function (event) { on(this.player.elements.settings.form, 'click', function (event) {
event.stopPropagation(); event.stopPropagation();
// Go back to home tab on click
var showHomeTab = function showHomeTab() {
var id = 'plyr-settings-' + _this4.player.id + '-home';
controls.showTab.call(_this4.player, id);
};
// Settings menu items - use event delegation as items are added/removed // Settings menu items - use event delegation as items are added/removed
if (utils.matches(event.target, _this4.player.config.selectors.inputs.language)) { if (utils.matches(event.target, _this4.player.config.selectors.inputs.language)) {
proxy(event, function () { proxy(event, function () {
_this4.player.language = event.target.value; _this4.player.language = event.target.value;
showHomeTab();
}, 'language'); }, 'language');
} else if (utils.matches(event.target, _this4.player.config.selectors.inputs.quality)) { } else if (utils.matches(event.target, _this4.player.config.selectors.inputs.quality)) {
proxy(event, function () { proxy(event, function () {
_this4.player.quality = event.target.value; _this4.player.quality = event.target.value;
showHomeTab();
}, 'quality'); }, 'quality');
} else if (utils.matches(event.target, _this4.player.config.selectors.inputs.speed)) { } else if (utils.matches(event.target, _this4.player.config.selectors.inputs.speed)) {
proxy(event, function () { proxy(event, function () {
_this4.player.speed = parseFloat(event.target.value); _this4.player.speed = parseFloat(event.target.value);
showHomeTab();
}, 'speed'); }, 'speed');
} else { } else {
var tab = event.target; var tab = event.target;
@ -11469,7 +11483,7 @@ var Ads = function () {
}, { }, {
key: 'enabled', key: 'enabled',
get: function get() { get: function get() {
return this.player.isHTML5 && this.player.isVideo && this.player.config.ads.enabled && utils.is.string(this.publisherId) && this.publisherId.length; return this.player.isVideo && this.player.config.ads.enabled && !utils.is.empty(this.publisherId);
} }
}, { }, {
key: 'tagUrl', key: 'tagUrl',
@ -12062,7 +12076,8 @@ var Plyr = function () {
key: 'stop', key: 'stop',
value: function stop() { value: function stop() {
if (this.isHTML5) { if (this.isHTML5) {
this.media.load(); this.pause();
this.restart();
} else if (utils.is.function(this.media.stop)) { } else if (utils.is.function(this.media.stop)) {
this.media.stop(); this.media.stop();
} }

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", "name": "plyr",
"version": "3.3.3", "version": "3.3.5",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player", "description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "https://plyr.io", "homepage": "https://plyr.io",
"main": "./dist/plyr.js", "main": "./dist/plyr.js",

View File

@ -128,7 +128,7 @@ See [initialising](#initialising) for more information on advanced setups.
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript, you can use the following: If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript, you can use the following:
```html ```html
<script src="https://cdn.plyr.io/3.3.3/plyr.js"></script> <script src="https://cdn.plyr.io/3.3.5/plyr.js"></script>
``` ```
_Note_: Be sure to read the [polyfills](#polyfills) section below about browser compatibility _Note_: Be sure to read the [polyfills](#polyfills) section below about browser compatibility
@ -144,13 +144,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: If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the default CSS, you can use the following:
```html ```html
<link rel="stylesheet" href="https://cdn.plyr.io/3.3.3/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/3.3.5/plyr.css">
``` ```
### SVG Sprite ### 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 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.3/plyr.svg`. reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.5/plyr.svg`.
## Ads ## Ads

View File

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

View File

@ -489,12 +489,19 @@ class Listeners {
on(this.player.elements.settings.form, 'click', event => { on(this.player.elements.settings.form, 'click', event => {
event.stopPropagation(); event.stopPropagation();
// Go back to home tab on click
const showHomeTab = () => {
const id = `plyr-settings-${this.player.id}-home`;
controls.showTab.call(this.player, id);
};
// Settings menu items - use event delegation as items are added/removed // Settings menu items - use event delegation as items are added/removed
if (utils.matches(event.target, this.player.config.selectors.inputs.language)) { if (utils.matches(event.target, this.player.config.selectors.inputs.language)) {
proxy( proxy(
event, event,
() => { () => {
this.player.language = event.target.value; this.player.language = event.target.value;
showHomeTab();
}, },
'language', 'language',
); );
@ -503,6 +510,7 @@ class Listeners {
event, event,
() => { () => {
this.player.quality = event.target.value; this.player.quality = event.target.value;
showHomeTab();
}, },
'quality', 'quality',
); );
@ -511,6 +519,7 @@ class Listeners {
event, event,
() => { () => {
this.player.speed = parseFloat(event.target.value); this.player.speed = parseFloat(event.target.value);
showHomeTab();
}, },
'speed', 'speed',
); );

View File

@ -44,7 +44,7 @@ class Ads {
} }
get enabled() { get enabled() {
return this.player.isHTML5 && this.player.isVideo && this.player.config.ads.enabled && utils.is.string(this.publisherId) && this.publisherId.length; return this.player.isVideo && this.player.config.ads.enabled && !utils.is.empty(this.publisherId);
} }
/** /**

View File

@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v3.3.3 // plyr.js v3.3.5
// https://github.com/sampotts/plyr // https://github.com/sampotts/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
@ -396,7 +396,8 @@ class Plyr {
*/ */
stop() { stop() {
if (this.isHTML5) { if (this.isHTML5) {
this.media.load(); this.pause();
this.restart();
} else if (utils.is.function(this.media.stop)) { } else if (utils.is.function(this.media.stop)) {
this.media.stop(); this.media.stop();
} }

View File

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

View File

@ -158,7 +158,7 @@ const ui = {
}, },
// Check playing state // Check playing state
checkPlaying() { checkPlaying(event) {
// Class hooks // Class hooks
utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing); utils.toggleClass(this.elements.container, this.config.classNames.playing, this.playing);
utils.toggleClass(this.elements.container, this.config.classNames.paused, this.paused); utils.toggleClass(this.elements.container, this.config.classNames.paused, this.paused);
@ -167,6 +167,11 @@ const ui = {
// Set ARIA state // Set ARIA state
utils.toggleState(this.elements.buttons.play, this.playing); utils.toggleState(this.elements.buttons.play, this.playing);
// Only update controls on non timeupdate events
if (utils.is.event(event) && event.type === 'timeupdate') {
return;
}
// Toggle controls // Toggle controls
this.toggleControls(!this.playing); this.toggleControls(!this.playing);
}, },