diff options
author | Sam Potts <sam@potts.es> | 2020-02-10 18:38:54 +0000 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2020-02-10 18:38:54 +0000 |
commit | a6ff0274a945ca37014f8cc693d8becd1782d913 (patch) | |
tree | 5595c4c2a1556b3eeaae98ef6b679a72934aacd0 /dist/plyr.polyfilled.mjs | |
parent | 841746210ac6444c2e15395e14856d0d889ffd9c (diff) | |
download | plyr-a6ff0274a945ca37014f8cc693d8becd1782d913.tar.lz plyr-a6ff0274a945ca37014f8cc693d8becd1782d913.tar.xz plyr-a6ff0274a945ca37014f8cc693d8becd1782d913.zip |
v3.5.8 deployed
Diffstat (limited to 'dist/plyr.polyfilled.mjs')
-rw-r--r-- | dist/plyr.polyfilled.mjs | 143 |
1 files changed, 80 insertions, 63 deletions
diff --git a/dist/plyr.polyfilled.mjs b/dist/plyr.polyfilled.mjs index d503caac..77c8d3fa 100644 --- a/dist/plyr.polyfilled.mjs +++ b/dist/plyr.polyfilled.mjs @@ -7450,12 +7450,14 @@ var html5 = { return Number(source.getAttribute('size')); }).filter(Boolean); }, - extend: function extend() { + setup: function setup() { if (!this.isHTML5) { return; } - var player = this; // Set aspect ratio if fixed + var player = this; // Set speed options from config + + player.options.speed = player.config.speed.options; // Set aspect ratio if fixed if (!is$1.empty(this.config.ratio)) { setAspectRatio.call(player); @@ -7546,28 +7548,6 @@ var html5 = { } }; -// `Array.prototype.fill` method implementation -// https://tc39.github.io/ecma262/#sec-array.prototype.fill -var arrayFill = function fill(value /* , start = 0, end = @length */) { - var O = toObject(this); - var length = toLength(O.length); - var argumentsLength = arguments.length; - var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); - var end = argumentsLength > 2 ? arguments[2] : undefined; - var endPos = end === undefined ? length : toAbsoluteIndex(end, length); - while (endPos > index) O[index++] = value; - return O; -}; - -// `Array.prototype.fill` method -// https://tc39.github.io/ecma262/#sec-array.prototype.fill -_export({ target: 'Array', proto: true }, { - fill: arrayFill -}); - -// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables -addToUnscopables('fill'); - function dedupe(array) { if (!is$1.array(array)) { return array; @@ -7587,13 +7567,6 @@ function closest(array, value) { return Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev; }); } -function fillRange(start, end) { - var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - var len = Math.floor((end - start) / step) + 1; - return Array(len).fill().map(function (_, idx) { - return start + idx * step; - }); -} var defineProperty$6 = objectDefineProperty.f; var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; @@ -8916,17 +8889,11 @@ var controls = { } var type = 'speed'; - var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Determine options to display - // Vimeo and YouTube limit to 0.5x-2x - - if (this.isVimeo || this.isYouTube) { - this.options.speed = fillRange(0.5, 2, 0.25).filter(function (s) { - return _this8.config.speed.options.includes(s); - }); - } else { - this.options.speed = this.config.speed.options; - } // Toggle the pane and tab + var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Filter out invalid speeds + this.options.speed = this.options.speed.filter(function (o) { + return o >= _this8.minimumSpeed && o <= _this8.maximumSpeed; + }); // Toggle the pane and tab var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1; controls.toggleMenuButton.call(this, type, toggle); // Empty the menu @@ -9970,7 +9937,7 @@ var defaults$1 = { // Sprite (for icons) loadSprite: true, iconPrefix: 'plyr', - iconUrl: 'https://cdn.plyr.io/3.5.7/plyr.svg', + iconUrl: 'https://cdn.plyr.io/3.5.8/plyr.svg', // Blank video (used to prevent errors on source change) blankVideo: 'https://cdn.plyr.io/static/blank.mp4', // Quality default @@ -10254,7 +10221,13 @@ var defaults$1 = { portrait: false, title: false, speed: true, - transparent: false + transparent: false, + // These settings require a pro or premium account to work + sidedock: false, + controls: false, + // Custom settings from Plyr + referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy + }, // YouTube plugin youtube: { @@ -12038,26 +12011,27 @@ function assurePlaybackState(play) { var vimeo = { setup: function setup() { - var _this = this; + var player = this; // Add embed class for responsive - // Add embed class for responsive - toggleClass(this.elements.wrapper, this.config.classNames.embed, true); // Set intial ratio + toggleClass(player.elements.wrapper, player.config.classNames.embed, true); // Set speed options from config + + player.options.speed = player.config.speed.options; // Set intial ratio - setAspectRatio.call(this); // Load the SDK if not already + setAspectRatio.call(player); // Load the SDK if not already if (!is$1.object(window.Vimeo)) { - loadScript(this.config.urls.vimeo.sdk).then(function () { - vimeo.ready.call(_this); + loadScript(player.config.urls.vimeo.sdk).then(function () { + vimeo.ready.call(player); }).catch(function (error) { - _this.debug.warn('Vimeo SDK (player.js) failed to load', error); + player.debug.warn('Vimeo SDK (player.js) failed to load', error); }); } else { - vimeo.ready.call(this); + vimeo.ready.call(player); } }, // API Ready ready: function ready() { - var _this2 = this; + var _this = this; var player = this; var config = player.config.vimeo; // Get Vimeo params for the iframe @@ -12083,7 +12057,12 @@ var vimeo = { iframe.setAttribute('src', src); iframe.setAttribute('allowfullscreen', ''); iframe.setAttribute('allowtransparency', ''); - iframe.setAttribute('allow', 'autoplay'); // Get poster, if already set + iframe.setAttribute('allow', 'autoplay'); // Set the referrer policy if required + + if (!is$1.empty(config.referrerPolicy)) { + iframe.setAttribute('referrerPolicy', config.referrerPolicy); + } // Get poster, if already set + var poster = player.poster; // Inject the package @@ -12225,7 +12204,7 @@ var vimeo = { currentSrc = value; controls.setDownloadUrl.call(player); }).catch(function (error) { - _this2.debug.warn(error); + _this.debug.warn(error); }); Object.defineProperty(player.media, 'currentSrc', { get: function get() { @@ -12245,7 +12224,7 @@ var vimeo = { height = _dimensions[1]; player.embed.ratio = [width, height]; - setAspectRatio.call(_this2); + setAspectRatio.call(_this); }); // Set autopause player.embed.setAutopause(player.config.autopause).then(function (state) { @@ -12254,7 +12233,7 @@ var vimeo = { player.embed.getVideoTitle().then(function (title) { player.config.title = title; - ui.setTitle.call(_this2); + ui.setTitle.call(_this); }); // Get current time player.embed.getCurrentTime().then(function (value) { @@ -12627,7 +12606,11 @@ var youtube = { } }); // Get available speeds - player.options.speed = instance.getAvailablePlaybackRates(); // Set the tabindex to avoid focus entering iframe + var speeds = instance.getAvailablePlaybackRates(); // Filter based on config + + player.options.speed = speeds.filter(function (s) { + return player.config.speed.options.includes(s); + }); // Set the tabindex to avoid focus entering iframe if (player.supported.ui) { player.media.setAttribute('tabindex', -1); @@ -12785,7 +12768,7 @@ var media = { } if (this.isHTML5) { - html5.extend.call(this); + html5.setup.call(this); } else if (this.isYouTube) { youtube.setup.call(this); } else if (this.isVimeo) { @@ -13582,7 +13565,7 @@ function () { value: function load() { var _this = this; - // Togglethe regular seek tooltip + // Toggle the regular seek tooltip if (this.player.elements.display.seekTooltip) { this.player.elements.display.seekTooltip.hidden = this.enabled; } @@ -13810,6 +13793,17 @@ function () { this.player.elements.wrapper.appendChild(this.elements.scrubbing.container); } }, { + key: "destroy", + value: function destroy() { + if (this.elements.thumb.container) { + this.elements.thumb.container.remove(); + } + + if (this.elements.scrubbing.container) { + this.elements.scrubbing.container.remove(); + } + } + }, { key: "showImageAtCurrentTime", value: function showImageAtCurrentTime() { var _this6 = this; @@ -14054,7 +14048,7 @@ function () { }, { key: "determineContainerAutoSizing", value: function determineContainerAutoSizing() { - if (this.elements.thumb.imageContainer.clientHeight > 20) { + if (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) { // This will prevent auto sizing in this.setThumbContainerSizeAndPos() this.sizeSpecifiedInCSS = true; } @@ -14067,6 +14061,13 @@ function () { var thumbWidth = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio); this.elements.thumb.imageContainer.style.height = "".concat(this.thumbContainerHeight, "px"); this.elements.thumb.imageContainer.style.width = "".concat(thumbWidth, "px"); + } else if (this.elements.thumb.imageContainer.clientHeight > 20 && this.elements.thumb.imageContainer.clientWidth < 20) { + var _thumbWidth = Math.floor(this.elements.thumb.imageContainer.clientHeight * this.thumbAspectRatio); + + this.elements.thumb.imageContainer.style.width = "".concat(_thumbWidth, "px"); + } else if (this.elements.thumb.imageContainer.clientHeight < 20 && this.elements.thumb.imageContainer.clientWidth > 20) { + var thumbHeight = Math.floor(this.elements.thumb.imageContainer.clientWidth / this.thumbAspectRatio); + this.elements.thumb.imageContainer.style.height = "".concat(thumbHeight, "px"); } this.setThumbContainerPos(); @@ -14165,6 +14166,11 @@ function () { height = _fitRatio2.height; return height; + } // If css is used this needs to return the css height for sprites to work (see setImageSizeAndOffset) + + + if (this.sizeSpecifiedInCSS) { + return this.elements.thumb.imageContainer.clientHeight; } return Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4); @@ -14314,11 +14320,22 @@ var source = { if (_this2.isHTML5) { _this2.media.load(); - } // Reload thumbnails + } // Update previewThumbnails config & reload plugin - if (_this2.previewThumbnails) { - _this2.previewThumbnails.load(); + if (!is$1.empty(input.previewThumbnails)) { + Object.assign(_this2.config.previewThumbnails, input.previewThumbnails); // Cleanup previewThumbnails plugin if it was loaded + + if (_this2.previewThumbnails && _this2.previewThumbnails.loaded) { + _this2.previewThumbnails.destroy(); + + _this2.previewThumbnails = null; + } // Create new instance if it is still enabled + + + if (_this2.config.previewThumbnails.enabled) { + _this2.previewThumbnails = new PreviewThumbnails(_this2); + } } // Update the fullscreen support |