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

40
demo/dist/demo.js vendored
View File

@ -8703,8 +8703,8 @@ typeof navigator === "object" && (function () {
}; };
var resized = function resized() { var resized = function resized() {
window.clearTimeout(timers.resized); clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50); timers.resized = setTimeout(setPlayerSize, 50);
}; };
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) { 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)) { if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this); youtube.ready.call(this);
} else { } else {
// Load the API // Reference current global callback
loadScript(this.config.urls.youtube.sdk).catch(function (error) { var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
_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
window.onYouTubeIframeAPIReady = function () { window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) { // Call global callback if set
if (is$1.function(callback)) {
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 // Get the media title
@ -9887,7 +9886,7 @@ typeof navigator === "object" && (function () {
ready: function ready() { ready: function ready() {
var player = this; // Ignore already setup (race condition) 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-')) { if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return; return;
@ -11309,11 +11308,8 @@ typeof navigator === "object" && (function () {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) { 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 // 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 // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, { // eslint-disable-next-line no-param-reassign
dataset: { image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer; var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () { 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 { &:hover {
box-shadow: 0 2px 2px rgba(#000, 0.1); box-shadow: 0 2px 2px rgba(#000, 0.1);
transform: translateY(-1px);
} }
&:focus { &:focus {
@ -50,7 +49,7 @@
} }
&:active { &:active {
transform: translateY(1px); top: 1px;
} }
} }

40
dist/plyr.js vendored
View File

@ -4851,8 +4851,8 @@ typeof navigator === "object" && (function (global, factory) {
}; };
var resized = function resized() { var resized = function resized() {
window.clearTimeout(timers.resized); clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50); timers.resized = setTimeout(setPlayerSize, 50);
}; };
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) { 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)) { if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this); youtube.ready.call(this);
} else { } else {
// Load the API // Reference current global callback
loadScript(this.config.urls.youtube.sdk).catch(function (error) { var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
_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
window.onYouTubeIframeAPIReady = function () { window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) { // Call global callback if set
if (is$1.function(callback)) {
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 // Get the media title
@ -6041,7 +6040,7 @@ typeof navigator === "object" && (function (global, factory) {
ready: function ready() { ready: function ready() {
var player = this; // Ignore already setup (race condition) 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-')) { if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return; return;
@ -7463,11 +7462,8 @@ typeof navigator === "object" && (function (global, factory) {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) { 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 // 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 // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, { // eslint-disable-next-line no-param-reassign
dataset: { image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer; var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () { 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

40
dist/plyr.mjs vendored
View File

@ -4845,8 +4845,8 @@ function () {
}; };
var resized = function resized() { var resized = function resized() {
window.clearTimeout(timers.resized); clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50); timers.resized = setTimeout(setPlayerSize, 50);
}; };
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) { 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)) { if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this); youtube.ready.call(this);
} else { } else {
// Load the API // Reference current global callback
loadScript(this.config.urls.youtube.sdk).catch(function (error) { var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
_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
window.onYouTubeIframeAPIReady = function () { window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) { // Call global callback if set
if (is$1.function(callback)) {
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 // Get the media title
@ -6035,7 +6034,7 @@ var youtube = {
ready: function ready() { ready: function ready() {
var player = this; // Ignore already setup (race condition) 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-')) { if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return; return;
@ -7457,11 +7456,8 @@ function () {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) { 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 // 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 // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, { // eslint-disable-next-line no-param-reassign
dataset: { image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer; var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () { setTimeout(function () {

View File

@ -10538,8 +10538,8 @@ typeof navigator === "object" && (function (global, factory) {
}; };
var resized = function resized() { var resized = function resized() {
window.clearTimeout(timers.resized); clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50); timers.resized = setTimeout(setPlayerSize, 50);
}; };
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) { 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)) { if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this); youtube.ready.call(this);
} else { } else {
// Load the API // Reference current global callback
loadScript(this.config.urls.youtube.sdk).catch(function (error) { var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
_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
window.onYouTubeIframeAPIReady = function () { window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) { // Call global callback if set
if (is$1.function(callback)) {
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 // Get the media title
@ -11800,7 +11799,7 @@ typeof navigator === "object" && (function (global, factory) {
ready: function ready() { ready: function ready() {
var player = this; // Ignore already setup (race condition) 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-')) { if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return; return;
@ -13239,11 +13238,8 @@ typeof navigator === "object" && (function (global, factory) {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) { 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 // 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 // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, { // eslint-disable-next-line no-param-reassign
dataset: { image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer; var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () { 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() { var resized = function resized() {
window.clearTimeout(timers.resized); clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50); timers.resized = setTimeout(setPlayerSize, 50);
}; };
on.call(player, elements.container, 'enterfullscreen exitfullscreen', function (event) { 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)) { if (is$1.object(window.YT) && is$1.function(window.YT.Player)) {
youtube.ready.call(this); youtube.ready.call(this);
} else { } else {
// Load the API // Reference current global callback
loadScript(this.config.urls.youtube.sdk).catch(function (error) { var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue
_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
window.onYouTubeIframeAPIReady = function () { window.onYouTubeIframeAPIReady = function () {
window.onYouTubeReadyCallbacks.forEach(function (callback) { // Call global callback if set
if (is$1.function(callback)) {
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 // Get the media title
@ -11794,7 +11793,7 @@ var youtube = {
ready: function ready() { ready: function ready() {
var player = this; // Ignore already setup (race condition) 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-')) { if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) {
return; return;
@ -13233,11 +13232,8 @@ function () {
if (image.dataset.index !== currentImage.dataset.index && !image.dataset.deleting) { 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 // 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 // First set attribute 'deleting' to prevent multi-handling of this on repeat firing of this function
extend(image, { // eslint-disable-next-line no-param-reassign
dataset: { image.dataset.deleting = true; // This has to be set before the timeout - to prevent issues switching between hover and scrub
deleting: true
}
}); // This has to be set before the timeout - to prevent issues switching between hover and scrub
var currentImageContainer = _this8.currentImageContainer; var currentImageContainer = _this8.currentImageContainer;
setTimeout(function () { setTimeout(function () {

View File

@ -337,8 +337,8 @@ class Listeners {
}; };
const resized = () => { const resized = () => {
window.clearTimeout(timers.resized); clearTimeout(timers.resized);
timers.resized = window.setTimeout(setPlayerSize, 50); timers.resized = setTimeout(setPlayerSize, 50);
}; };
on.call(player, elements.container, 'enterfullscreen exitfullscreen', event => { 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) { 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 // 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 // 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 // This has to be set before the timeout - to prevent issues switching between hover and scrub
const { currentImageContainer } = this; const { currentImageContainer } = this;

View File

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