diff options
Diffstat (limited to 'dist/plyr.polyfilled.mjs')
-rw-r--r-- | dist/plyr.polyfilled.mjs | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/dist/plyr.polyfilled.mjs b/dist/plyr.polyfilled.mjs index 1643794a..7061313a 100644 --- a/dist/plyr.polyfilled.mjs +++ b/dist/plyr.polyfilled.mjs @@ -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... + // Reference current global callback + var callback = window.onYouTubeIframeAPIReady; // Set callback to process queue - window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || []; // Add to queue + window.onYouTubeIframeAPIReady = function () { + // Call global callback if set + if (is$1.function(callback)) { + callback(); + } - window.onYouTubeReadyCallbacks.push(function () { youtube.ready.call(_this); - }); // Set callback to process queue + }; // Load the SDK - window.onYouTubeIframeAPIReady = function () { - window.onYouTubeReadyCallbacks.forEach(function (callback) { - callback(); - }); - }; + + 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 () { |