This commit is contained in:
Sam Potts 2019-06-01 19:50:29 +10:00
parent 5d699d5f47
commit 0249772f01
21 changed files with 121 additions and 151 deletions

2
demo/dist/demo.css vendored

File diff suppressed because one or more lines are too long

38
demo/dist/demo.js vendored
View File

@ -8703,8 +8703,8 @@ typeof navigator === "object" && (function () {
};
var resized = function resized() {
window.clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50);
clearTimeout(timers.resized);
timers.resized = setTimeout(setPlayerSize, 50);
};
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
@ -9841,23 +9841,22 @@ typeof navigator === "object" && (function () {
if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this);
} else {
// Load the API
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
}); // Setup callback for the API
// YouTube has it's own system of course...
window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue
window.onYouTubeReadyCallbacks.push(function () {
youtube.ready.call(_this);
}); // Set callback to process queue
// Reference current global callback
var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) {
// Call global callback if set
if (is$1.function(callback)) {
callback();
}
youtube.ready.call(_this);
}; // Load the SDK
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
});
};
}
},
// Get the media title
@ -9887,7 +9886,7 @@ typeof navigator === "object" && (function () {
ready: function ready() {
var player = this; // Ignore already setup (race condition)
var currentId = player.media.getAttribute('id');
var currentId = player.media && player.media.getAttribute('id');
if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return;
@ -11309,11 +11308,8 @@ typeof navigator === "object" && (function () {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, {
dataset: {
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
// eslint-disable-next-line no-param-reassign
image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
demo/dist/error.css vendored

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,6 @@
&:hover {
box-shadow: 0 2px 2px rgba(#000, 0.1);
transform: translateY(-1px);
}
&:focus {
@ -50,7 +49,7 @@
}
&:active {
transform: translateY(1px);
top: 1px;
}
}

38
dist/plyr.js vendored
View File

@ -4851,8 +4851,8 @@ typeof navigator === "object" && (function (global, factory) {
};
var resized = function resized() {
window.clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50);
clearTimeout(timers.resized);
timers.resized = setTimeout(setPlayerSize, 50);
};
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
@ -5995,23 +5995,22 @@ typeof navigator === "object" && (function (global, factory) {
if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this);
} else {
// Load the API
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
}); // Setup callback for the API
// YouTube has it's own system of course...
window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue
window.onYouTubeReadyCallbacks.push(function () {
youtube.ready.call(_this);
}); // Set callback to process queue
// Reference current global callback
var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) {
// Call global callback if set
if (is$1.function(callback)) {
callback();
}
youtube.ready.call(_this);
}; // Load the SDK
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
});
};
}
},
// Get the media title
@ -6041,7 +6040,7 @@ typeof navigator === "object" && (function (global, factory) {
ready: function ready() {
var player = this; // Ignore already setup (race condition)
var currentId = player.media.getAttribute('id');
var currentId = player.media && player.media.getAttribute('id');
if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return;
@ -7463,11 +7462,8 @@ typeof navigator === "object" && (function (global, factory) {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, {
dataset: {
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
// eslint-disable-next-line no-param-reassign
image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () {

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

2
dist/plyr.min.mjs vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

38
dist/plyr.mjs vendored
View File

@ -4845,8 +4845,8 @@ function () {
};
var resized = function resized() {
window.clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50);
clearTimeout(timers.resized);
timers.resized = setTimeout(setPlayerSize, 50);
};
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
@ -5989,23 +5989,22 @@ var youtube = {
if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this);
} else {
// Load the API
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
}); // Setup callback for the API
// YouTube has it's own system of course...
window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue
window.onYouTubeReadyCallbacks.push(function () {
youtube.ready.call(_this);
}); // Set callback to process queue
// Reference current global callback
var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) {
// Call global callback if set
if (is$1.function(callback)) {
callback();
}
youtube.ready.call(_this);
}; // Load the SDK
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
});
};
}
},
// Get the media title
@ -6035,7 +6034,7 @@ var youtube = {
ready: function ready() {
var player = this; // Ignore already setup (race condition)
var currentId = player.media.getAttribute('id');
var currentId = player.media && player.media.getAttribute('id');
if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return;
@ -7457,11 +7456,8 @@ function () {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, {
dataset: {
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
// eslint-disable-next-line no-param-reassign
image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () {

View File

@ -10538,8 +10538,8 @@ typeof navigator === "object" && (function (global, factory) {
};
var resized = function resized() {
window.clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50);
clearTimeout(timers.resized);
timers.resized = setTimeout(setPlayerSize, 50);
};
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
@ -11754,23 +11754,22 @@ typeof navigator === "object" && (function (global, factory) {
if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this);
} else {
// Load the API
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
}); // Setup callback for the API
// YouTube has it's own system of course...
window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue
window.onYouTubeReadyCallbacks.push(function () {
youtube.ready.call(_this);
}); // Set callback to process queue
// Reference current global callback
var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) {
// Call global callback if set
if (is$1.function(callback)) {
callback();
}
youtube.ready.call(_this);
}; // Load the SDK
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
});
};
}
},
// Get the media title
@ -11800,7 +11799,7 @@ typeof navigator === "object" && (function (global, factory) {
ready: function ready() {
var player = this; // Ignore already setup (race condition)
var currentId = player.media.getAttribute('id');
var currentId = player.media && player.media.getAttribute('id');
if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return;
@ -13239,11 +13238,8 @@ typeof navigator === "object" && (function (global, factory) {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, {
dataset: {
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
// eslint-disable-next-line no-param-reassign
image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () {

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

File diff suppressed because one or more lines are too long

View File

@ -10532,8 +10532,8 @@ function () {
};
var resized = function resized() {
window.clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50);
clearTimeout(timers.resized);
timers.resized = setTimeout(setPlayerSize, 50);
};
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) {
@ -11748,23 +11748,22 @@ var youtube = {
if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this);
} else {
// Load the API
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
}); // Setup callback for the API
// YouTube has it's own system of course...
window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue
window.onYouTubeReadyCallbacks.push(function () {
youtube.ready.call(_this);
}); // Set callback to process queue
// Reference current global callback
var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) {
// Call global callback if set
if (is$1.function(callback)) {
callback();
}
youtube.ready.call(_this);
}; // Load the SDK
loadScript(this.config.urls.youtube.sdk).catch(function (error) {
_this.debug.warn('YouTube API failed to load', error);
});
};
}
},
// Get the media title
@ -11794,7 +11793,7 @@ var youtube = {
ready: function ready() {
var player = this; // Ignore already setup (race condition)
var currentId = player.media.getAttribute('id');
var currentId = player.media && player.media.getAttribute('id');
if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return;
@ -13233,11 +13232,8 @@ function () {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, {
dataset: {
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
// eslint-disable-next-line no-param-reassign
image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () {

View File

@ -337,8 +337,8 @@ class Listeners {
};
const resized = () => {
window.clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50);
clearTimeout(timers.resized);
timers.resized = setTimeout(setPlayerSize, 50);
};
on.call(player, elements.container, 'enterfullscreen exitfullscreen', event => {

View File

@ -426,7 +426,9 @@ class PreviewThumbnails {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) {
// Wait 200ms, as the new image can take some time to show on certain browsers (even though it was downloaded before showing). This will prevent flicker, and show some generosity towards slower clients
// First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, { dataset: { deleting: true } });
// eslint-disable-next-line no-param-reassign
image.dataset.deleting = true;
// This has to be set before the timeout - to prevent issues switching between hover and scrub
const { currentImageContainer } = this;

View File

@ -47,8 +47,6 @@ function getHost(config) {
return undefined;
}
let onYouTubeReadyCallbacks;
const youtube = {
setup() {
// Add embed class for responsive
@ -58,33 +56,24 @@ const youtube = {
if (is.object(window.YT) && is.function(window.YT.Player)) {
youtube.ready.call(this);
} else {
if (!onYouTubeReadyCallbacks) {
const oldYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady;
// Load the API
onYouTubeReadyCallbacks = [];
// Reference current global callback
const callback = window.onYouTubeIframeAPIReady;
// Set callback to process queue
window.onYouTubeIframeAPIReady = () => {
if (oldYouTubeIframeAPIReady && is.function(oldYouTubeIframeAPIReady)) {
oldYouTubeIframeAPIReady();
// Call global callback if set
if (is.function(callback)) {
callback();
}
window.onYouTubeReadyCallbacks.forEach(callback => {
callback();
});
youtube.ready.call(this);
};
// Load the SDK
loadScript(this.config.urls.youtube.sdk).catch(error => {
this.debug.warn('YouTube API failed to load', error);
});
}
// Add to queue
onYouTubeReadyCallbacks.push(() => {
youtube.ready.call(this);
});
}
},
// Get the media title