Compare commits

...

8 Commits

Author SHA1 Message Date
Sam Potts 5ed7aa6620 v3.3.17 2018-06-19 16:58:38 +10:00
Sam Potts 47750b6aad v3.3.17
-   Fix YouTube muting after seeking with the progress slider
-   Respect preload="none" when setting quality if the media hasn't been loaded some other way
2018-06-19 16:57:32 +10:00
Sam Potts de7832eb8b Merge branch 'develop' 2018-06-19 16:40:54 +10:00
friday 52ea5bd0ab Merge pull request #1052 from friday/youtube-audio-fix
Fix YouTube muting after seeking with the progress slider.
2018-06-19 04:15:07 +02:00
Albin Larsson 457d112df7 Fix #1045: YouTube mutes when seeking after play 2018-06-19 04:03:59 +02:00
Sam Potts 22cdec9d38 Merge pull request #1051 from friday/quality-2
Respect preload="none" when setting quality if the media hasn't been loaded some other way
2018-06-19 11:48:44 +10:00
Albin Larsson d72e502107 Fixes #1044: Don't load the new source if preload is disabled and the current source hasn't been loaded 2018-06-19 03:39:18 +02:00
Albin Larsson 94055f0772 Replace filter()[0] with find() 2018-06-19 03:35:57 +02:00
15 changed files with 78 additions and 71 deletions
+5
View File
@@ -1,3 +1,8 @@
# v3.3.17
- Fix YouTube muting after seeking with the progress slider
- Respect preload="none" when setting quality if the media hasn't been loaded some other way
# v3.3.16 # v3.3.16
- Fixed regression relating the play button status (fixes #1048) - Fixed regression relating the play button status (fixes #1048)
+23 -23
View File
@@ -769,22 +769,17 @@ typeof navigator === "object" && (function (global, factory) {
// Quality // Quality
Object.defineProperty(player.media, 'quality', { Object.defineProperty(player.media, 'quality', {
get: function get$$1() { get: function get() {
// Get sources // Get sources
var sources = html5.getSources.call(player); var sources = html5.getSources.call(player);
var source = sources.find(function (source) {
var _sources$filter = sources.filter(function (source) {
return source.getAttribute('src') === player.source; return source.getAttribute('src') === player.source;
}), });
_sources$filter2 = slicedToArray(_sources$filter, 1),
source = _sources$filter2[0];
// Return size, if match is found // Return size, if match is found
return source && Number(source.getAttribute('size')); return source && Number(source.getAttribute('size'));
}, },
set: function set$$1(input) { set: function set(input) {
// Get sources // Get sources
var sources = html5.getSources.call(player); var sources = html5.getSources.call(player);
@@ -799,25 +794,30 @@ typeof navigator === "object" && (function (global, factory) {
} }
// Get current state // Get current state
var currentTime = player.currentTime, var _player$media = player.media,
playing = player.playing; currentTime = _player$media.currentTime,
paused = _player$media.paused,
preload = _player$media.preload,
readyState = _player$media.readyState;
// Set new source // Set new source
player.media.src = source.getAttribute('src'); player.media.src = source.getAttribute('src');
// Restore time // Prevent loading if preload="none" and the current source isn't loaded (#1044)
var onLoadedMetaData = function onLoadedMetaData() { if (preload !== 'none' || readyState) {
player.currentTime = currentTime; // Restore time
}; player.once('loadedmetadata', function () {
player.once('loadedmetadata', onLoadedMetaData); player.currentTime = currentTime;
// Load new source // Resume playing
player.media.load(); if (!paused) {
player.play();
}
});
// Resume playing // Load new source
if (playing) { player.media.load();
player.play();
} }
// Trigger change event // Trigger change event
@@ -5822,8 +5822,8 @@ typeof navigator === "object" && (function (global, factory) {
return Number(instance.getCurrentTime()); return Number(instance.getCurrentTime());
}, },
set: function set(time) { set: function set(time) {
// If paused, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet). // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
if (player.paused) { if (player.paused && !player.embed.hasPlayed) {
player.embed.mute(); player.embed.mute();
} }
+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
+21 -21
View File
@@ -6158,16 +6158,11 @@ typeof navigator === "object" && (function (global, factory) {
get: function get() { get: function get() {
// Get sources // Get sources
var sources = html5.getSources.call(player); var sources = html5.getSources.call(player);
var source = sources.find(function (source) {
var _sources$filter = sources.filter(function (source) {
return source.getAttribute('src') === player.source; return source.getAttribute('src') === player.source;
}), });
_sources$filter2 = slicedToArray(_sources$filter, 1),
source = _sources$filter2[0];
// Return size, if match is found // Return size, if match is found
return source && Number(source.getAttribute('size')); return source && Number(source.getAttribute('size'));
}, },
set: function set(input) { set: function set(input) {
@@ -6185,25 +6180,30 @@ typeof navigator === "object" && (function (global, factory) {
} }
// Get current state // Get current state
var currentTime = player.currentTime, var _player$media = player.media,
playing = player.playing; currentTime = _player$media.currentTime,
paused = _player$media.paused,
preload = _player$media.preload,
readyState = _player$media.readyState;
// Set new source // Set new source
player.media.src = source.getAttribute('src'); player.media.src = source.getAttribute('src');
// Restore time // Prevent loading if preload="none" and the current source isn't loaded (#1044)
var onLoadedMetaData = function onLoadedMetaData() { if (preload !== 'none' || readyState) {
player.currentTime = currentTime; // Restore time
}; player.once('loadedmetadata', function () {
player.once('loadedmetadata', onLoadedMetaData); player.currentTime = currentTime;
// Load new source // Resume playing
player.media.load(); if (!paused) {
player.play();
}
});
// Resume playing // Load new source
if (playing) { player.media.load();
player.play();
} }
// Trigger change event // Trigger change event
@@ -11202,8 +11202,8 @@ typeof navigator === "object" && (function (global, factory) {
return Number(instance.getCurrentTime()); return Number(instance.getCurrentTime());
}, },
set: function set(time) { set: function set(time) {
// If paused, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet). // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
if (player.paused) { if (player.paused && !player.embed.hasPlayed) {
player.embed.mute(); player.embed.mute();
} }
+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.3.16", "version": "3.3.17",
"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",
+4 -4
View File
@@ -132,13 +132,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. 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 ```html
<script src="https://cdn.plyr.io/3.3.16/plyr.js"></script> <script src="https://cdn.plyr.io/3.3.17/plyr.js"></script>
``` ```
...or... ...or...
```html ```html
<script src="https://cdn.plyr.io/3.3.16/plyr.polyfilled.js"></script> <script src="https://cdn.plyr.io/3.3.17/plyr.polyfilled.js"></script>
``` ```
### CSS ### CSS
@@ -152,13 +152,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.16/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/3.3.17/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.16/plyr.svg`. reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.17/plyr.svg`.
## Ads ## Ads
+14 -12
View File
@@ -39,7 +39,7 @@ const html5 = {
get() { get() {
// Get sources // Get sources
const sources = html5.getSources.call(player); const sources = html5.getSources.call(player);
const [source] = sources.filter(source => source.getAttribute('src') === player.source); const source = sources.find(source => source.getAttribute('src') === player.source);
// Return size, if match is found // Return size, if match is found
return source && Number(source.getAttribute('size')); return source && Number(source.getAttribute('size'));
@@ -57,23 +57,25 @@ const html5 = {
} }
// Get current state // Get current state
const { currentTime, playing } = player; const { currentTime, paused, preload, readyState } = player.media;
// Set new source // Set new source
player.media.src = source.getAttribute('src'); player.media.src = source.getAttribute('src');
// Restore time // Prevent loading if preload="none" and the current source isn't loaded (#1044)
const onLoadedMetaData = () => { if (preload !== 'none' || readyState) {
player.currentTime = currentTime; // Restore time
}; player.once('loadedmetadata', () => {
player.once('loadedmetadata', onLoadedMetaData); player.currentTime = currentTime;
// Load new source // Resume playing
player.media.load(); if (!paused) {
player.play();
}
});
// Resume playing // Load new source
if (playing) { player.media.load();
player.play();
} }
// Trigger change event // Trigger change event
+2 -2
View File
@@ -270,8 +270,8 @@ const youtube = {
return Number(instance.getCurrentTime()); return Number(instance.getCurrentTime());
}, },
set(time) { set(time) {
// If paused, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet). // If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
if (player.paused) { if (player.paused && !player.embed.hasPlayed) {
player.embed.mute(); player.embed.mute();
} }
+1 -1
View File
@@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v3.3.16 // plyr.js v3.3.17
// 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.3.16 // plyr.js v3.3.17
// https://github.com/sampotts/plyr // https://github.com/sampotts/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================