Bug fixes

This commit is contained in:
Sam Potts
2018-03-28 22:45:11 +11:00
parent 2b7fe9a4f9
commit c4e2e24643
23 changed files with 125 additions and 42 deletions
+5
View File
@@ -1,3 +1,8 @@
## v3.0.7
* Fix for keyboard shortcut error with fast forward
* Fix for Vimeo trying to set playback rate when not allowed
## v3.0.6 ## v3.0.6
* Improved the logic for the custom handlers preventing default handlers * Improved the logic for the custom handlers preventing default handlers
+1 -1
View File
@@ -3936,7 +3936,7 @@ var singleton = Raven;
player.source = { player.source = {
type: 'video', type: 'video',
sources: [{ sources: [{
src: 'https://vimeo.com/76979871', src: 'https://vimeo.com/25345658',
provider: 'vimeo' provider: 'vimeo'
}] }]
}; };
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -179,7 +179,7 @@ import Raven from 'raven-js';
player.source = { player.source = {
type: 'video', type: 'video',
sources: [{ sources: [{
src: 'https://vimeo.com/76979871', src: 'https://vimeo.com/25345658',
provider: 'vimeo', provider: 'vimeo',
}], }],
}; };
+31 -6
View File
@@ -3533,9 +3533,14 @@ var controls = {
// Set a list of available captions languages // Set a list of available captions languages
setSpeedMenu: function setSpeedMenu() { setSpeedMenu: function setSpeedMenu(options) {
var _this4 = this; var _this4 = this;
// Do nothing if not selected
if (!this.config.controls.includes('settings') || !this.config.settings.includes('speed')) {
return;
}
// Menu required // Menu required
if (!utils.is.element(this.elements.settings.panes.speed)) { if (!utils.is.element(this.elements.settings.panes.speed)) {
return; return;
@@ -3543,9 +3548,11 @@ var controls = {
var type = 'speed'; var type = 'speed';
// Set the default speeds // Set the speed options
if (!utils.is.array(this.options.speed) || !this.options.speed.length) { if (!utils.is.array(options)) {
this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]; this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
} else {
this.options.speed = options;
} }
// Set options if passed and filter based on config // Set options if passed and filter based on config
@@ -3557,6 +3564,9 @@ var controls = {
var toggle = !utils.is.empty(this.options.speed); var toggle = !utils.is.empty(this.options.speed);
controls.toggleTab.call(this, type, toggle); controls.toggleTab.call(this, type, toggle);
// Check if we need to toggle the parent
controls.checkMenu.call(this);
// If we're hiding, nothing more to do // If we're hiding, nothing more to do
if (!toggle) { if (!toggle) {
return; return;
@@ -3581,6 +3591,15 @@ var controls = {
}, },
// Check if we need to hide/show the settings menu
checkMenu: function checkMenu() {
var speedHidden = this.elements.settings.tabs.speed.getAttribute('hidden') !== null;
var languageHidden = this.elements.settings.tabs.captions.getAttribute('hidden') !== null;
utils.toggleHidden(this.elements.settings.menu, speedHidden && languageHidden);
},
// Show/hide menu // Show/hide menu
toggleMenu: function toggleMenu(event) { toggleMenu: function toggleMenu(event) {
var form = this.elements.settings.form; var form = this.elements.settings.form;
@@ -3971,7 +3990,7 @@ var controls = {
this.elements.controls = container; this.elements.controls = container;
if (this.config.controls.includes('settings') && this.config.settings.includes('speed')) { if (this.isHTML5) {
controls.setSpeedMenu.call(this); controls.setSpeedMenu.call(this);
} }
@@ -4179,7 +4198,7 @@ var Listeners = function () {
case 39: case 39:
// Arrow forward // Arrow forward
this.player.fastForward(); this.player.forward();
break; break;
case 37: case 37:
@@ -5710,7 +5729,8 @@ var youtube = {
}); });
// Get available speeds // Get available speeds
player.options.speed = instance.getAvailablePlaybackRates(); var options = instance.getAvailablePlaybackRates();
controls.setSpeedMenu.call(player, options);
// Set the tabindex to avoid focus entering iframe // Set the tabindex to avoid focus entering iframe
if (player.supported.ui) { if (player.supported.ui) {
@@ -5987,6 +6007,11 @@ var vimeo = {
player.embed.setPlaybackRate(input).then(function () { player.embed.setPlaybackRate(input).then(function () {
speed = input; speed = input;
utils.dispatchEvent.call(player, player.media, 'ratechange'); utils.dispatchEvent.call(player, player.media, 'ratechange');
}).catch(function (error) {
// Hide menu item (and menu if empty)
if (error.name === 'Error') {
controls.setSpeedMenu.call(player, []);
}
}); });
} }
}); });
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+33 -8
View File
@@ -5268,7 +5268,7 @@ var defaults = {
// Sprite (for icons) // Sprite (for icons)
loadSprite: true, loadSprite: true,
iconPrefix: 'plyr', iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/3.0.6/plyr.svg', iconUrl: 'https://cdn.plyr.io/3.0.7/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',
@@ -8714,9 +8714,14 @@ var controls = {
// Set a list of available captions languages // Set a list of available captions languages
setSpeedMenu: function setSpeedMenu() { setSpeedMenu: function setSpeedMenu(options) {
var _this4 = this; var _this4 = this;
// Do nothing if not selected
if (!this.config.controls.includes('settings') || !this.config.settings.includes('speed')) {
return;
}
// Menu required // Menu required
if (!utils.is.element(this.elements.settings.panes.speed)) { if (!utils.is.element(this.elements.settings.panes.speed)) {
return; return;
@@ -8724,9 +8729,11 @@ var controls = {
var type = 'speed'; var type = 'speed';
// Set the default speeds // Set the speed options
if (!utils.is.array(this.options.speed) || !this.options.speed.length) { if (!utils.is.array(options)) {
this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]; this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
} else {
this.options.speed = options;
} }
// Set options if passed and filter based on config // Set options if passed and filter based on config
@@ -8738,6 +8745,9 @@ var controls = {
var toggle = !utils.is.empty(this.options.speed); var toggle = !utils.is.empty(this.options.speed);
controls.toggleTab.call(this, type, toggle); controls.toggleTab.call(this, type, toggle);
// Check if we need to toggle the parent
controls.checkMenu.call(this);
// If we're hiding, nothing more to do // If we're hiding, nothing more to do
if (!toggle) { if (!toggle) {
return; return;
@@ -8762,6 +8772,15 @@ var controls = {
}, },
// Check if we need to hide/show the settings menu
checkMenu: function checkMenu() {
var speedHidden = this.elements.settings.tabs.speed.getAttribute('hidden') !== null;
var languageHidden = this.elements.settings.tabs.captions.getAttribute('hidden') !== null;
utils.toggleHidden(this.elements.settings.menu, speedHidden && languageHidden);
},
// Show/hide menu // Show/hide menu
toggleMenu: function toggleMenu(event) { toggleMenu: function toggleMenu(event) {
var form = this.elements.settings.form; var form = this.elements.settings.form;
@@ -9152,7 +9171,7 @@ var controls = {
this.elements.controls = container; this.elements.controls = container;
if (this.config.controls.includes('settings') && this.config.settings.includes('speed')) { if (this.isHTML5) {
controls.setSpeedMenu.call(this); controls.setSpeedMenu.call(this);
} }
@@ -9360,7 +9379,7 @@ var Listeners = function () {
case 39: case 39:
// Arrow forward // Arrow forward
this.player.fastForward(); this.player.forward();
break; break;
case 37: case 37:
@@ -10891,7 +10910,8 @@ var youtube = {
}); });
// Get available speeds // Get available speeds
player.options.speed = instance.getAvailablePlaybackRates(); var options = instance.getAvailablePlaybackRates();
controls.setSpeedMenu.call(player, options);
// Set the tabindex to avoid focus entering iframe // Set the tabindex to avoid focus entering iframe
if (player.supported.ui) { if (player.supported.ui) {
@@ -11168,6 +11188,11 @@ var vimeo = {
player.embed.setPlaybackRate(input).then(function () { player.embed.setPlaybackRate(input).then(function () {
speed = input; speed = input;
utils.dispatchEvent.call(player, player.media, 'ratechange'); utils.dispatchEvent.call(player, player.media, 'ratechange');
}).catch(function (error) {
// Hide menu item (and menu if empty)
if (error.name === 'Error') {
controls.setSpeedMenu.call(player, []);
}
}); });
} }
}); });
@@ -11590,7 +11615,7 @@ var source = {
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v3.0.6 // plyr.js v3.0.7
// https://github.com/sampotts/plyr // https://github.com/sampotts/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "3.0.6", "version": "3.0.7",
"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",
+3 -3
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.0.6/plyr.js"></script> <script src="https://cdn.plyr.io/3.0.7/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.0.6/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/3.0.7/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.0.6/plyr.svg`. reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.0.7/plyr.svg`.
## Ads ## Ads
+22 -4
View File
@@ -706,7 +706,12 @@ const controls = {
}, },
// Set a list of available captions languages // Set a list of available captions languages
setSpeedMenu() { setSpeedMenu(options) {
// Do nothing if not selected
if (!this.config.controls.includes('settings') || !this.config.settings.includes('speed')) {
return;
}
// Menu required // Menu required
if (!utils.is.element(this.elements.settings.panes.speed)) { if (!utils.is.element(this.elements.settings.panes.speed)) {
return; return;
@@ -714,8 +719,8 @@ const controls = {
const type = 'speed'; const type = 'speed';
// Set the default speeds // Set the speed options
if (!utils.is.array(this.options.speed) || !this.options.speed.length) { if (!utils.is.array(options)) {
this.options.speed = [ this.options.speed = [
0.5, 0.5,
0.75, 0.75,
@@ -725,6 +730,8 @@ const controls = {
1.75, 1.75,
2, 2,
]; ];
} else {
this.options.speed = options;
} }
// Set options if passed and filter based on config // Set options if passed and filter based on config
@@ -734,6 +741,9 @@ const controls = {
const toggle = !utils.is.empty(this.options.speed); const toggle = !utils.is.empty(this.options.speed);
controls.toggleTab.call(this, type, toggle); controls.toggleTab.call(this, type, toggle);
// Check if we need to toggle the parent
controls.checkMenu.call(this);
// If we're hiding, nothing more to do // If we're hiding, nothing more to do
if (!toggle) { if (!toggle) {
return; return;
@@ -755,6 +765,14 @@ const controls = {
controls.updateSetting.call(this, type, list); controls.updateSetting.call(this, type, list);
}, },
// Check if we need to hide/show the settings menu
checkMenu() {
const speedHidden = this.elements.settings.tabs.speed.getAttribute('hidden') !== null;
const languageHidden = this.elements.settings.tabs.captions.getAttribute('hidden') !== null;
utils.toggleHidden(this.elements.settings.menu, speedHidden && languageHidden);
},
// Show/hide menu // Show/hide menu
toggleMenu(event) { toggleMenu(event) {
const { form } = this.elements.settings; const { form } = this.elements.settings;
@@ -1159,7 +1177,7 @@ const controls = {
this.elements.controls = container; this.elements.controls = container;
if (this.config.controls.includes('settings') && this.config.settings.includes('speed')) { if (this.isHTML5) {
controls.setSpeedMenu.call(this); controls.setSpeedMenu.call(this);
} }
+1 -1
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.0.6/plyr.svg', iconUrl: 'https://cdn.plyr.io/3.0.7/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',
+1 -1
View File
@@ -129,7 +129,7 @@ class Listeners {
case 39: case 39:
// Arrow forward // Arrow forward
this.player.fastForward(); this.player.forward();
break; break;
case 37: case 37:
+10 -1
View File
@@ -4,6 +4,7 @@
import utils from './../utils'; import utils from './../utils';
import captions from './../captions'; import captions from './../captions';
import controls from './../controls';
import ui from './../ui'; import ui from './../ui';
const vimeo = { const vimeo = {
@@ -139,9 +140,17 @@ const vimeo = {
return speed; return speed;
}, },
set(input) { set(input) {
player.embed.setPlaybackRate(input).then(() => { player.embed
.setPlaybackRate(input)
.then(() => {
speed = input; speed = input;
utils.dispatchEvent.call(player, player.media, 'ratechange'); utils.dispatchEvent.call(player, player.media, 'ratechange');
})
.catch(error => {
// Hide menu item (and menu if empty)
if (error.name === 'Error') {
controls.setSpeedMenu.call(player, []);
}
}); });
}, },
}); });
+2 -1
View File
@@ -294,7 +294,8 @@ const youtube = {
}); });
// Get available speeds // Get available speeds
player.options.speed = instance.getAvailablePlaybackRates(); const options = instance.getAvailablePlaybackRates();
controls.setSpeedMenu.call(player, options);
// Set the tabindex to avoid focus entering iframe // Set the tabindex to avoid focus entering iframe
if (player.supported.ui) { if (player.supported.ui) {
+1 -1
View File
@@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v3.0.6 // plyr.js v3.0.7
// https://github.com/sampotts/plyr // https://github.com/sampotts/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
+1 -1
View File
@@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr Polyfilled Build // Plyr Polyfilled Build
// plyr.js v3.0.6 // plyr.js v3.0.7
// https://github.com/sampotts/plyr // https://github.com/sampotts/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================