v3.5.8 deployed

This commit is contained in:
Sam Potts 2020-02-10 18:38:54 +00:00
parent 841746210a
commit a6ff0274a9
21 changed files with 1534 additions and 1000 deletions

2
demo/dist/demo.css vendored

File diff suppressed because one or more lines are too long

1904
demo/dist/demo.js vendored

File diff suppressed because it is too large Load Diff

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.css vendored

File diff suppressed because one or more lines are too long

121
dist/plyr.js vendored
View File

@ -1259,12 +1259,14 @@ typeof navigator === "object" && (function (global, factory) {
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);
@ -1376,13 +1378,6 @@ typeof navigator === "object" && (function (global, factory) {
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;
});
}
// ==========================================================================
@ -2617,17 +2612,11 @@ typeof navigator === "object" && (function (global, factory) {
}
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
@ -3671,7 +3660,7 @@ typeof navigator === "object" && (function (global, factory) {
// 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
@ -3955,7 +3944,13 @@ typeof navigator === "object" && (function (global, factory) {
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: {
@ -5674,26 +5669,27 @@ typeof navigator === "object" && (function (global, factory) {
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
setAspectRatio.call(this); // Load the SDK if not already
player.options.speed = player.config.speed.options; // Set intial ratio
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
@ -5719,7 +5715,12 @@ typeof navigator === "object" && (function (global, factory) {
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
@ -5861,7 +5862,7 @@ typeof navigator === "object" && (function (global, factory) {
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() {
@ -5881,7 +5882,7 @@ typeof navigator === "object" && (function (global, factory) {
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) {
@ -5890,7 +5891,7 @@ typeof navigator === "object" && (function (global, factory) {
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) {
@ -6265,7 +6266,11 @@ typeof navigator === "object" && (function (global, factory) {
}
}); // 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);
@ -6424,7 +6429,7 @@ typeof navigator === "object" && (function (global, factory) {
}
if (this.isHTML5) {
html5.extend.call(this);
html5.setup.call(this);
} else if (this.isYouTube) {
youtube.setup.call(this);
} else if (this.isVimeo) {
@ -7170,7 +7175,7 @@ typeof navigator === "object" && (function (global, factory) {
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;
}
@ -7397,6 +7402,17 @@ typeof navigator === "object" && (function (global, factory) {
});
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() {
@ -7642,7 +7658,7 @@ typeof navigator === "object" && (function (global, factory) {
}, {
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;
}
@ -7655,6 +7671,13 @@ typeof navigator === "object" && (function (global, factory) {
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();
@ -7753,6 +7776,11 @@ typeof navigator === "object" && (function (global, factory) {
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);
@ -7902,11 +7930,22 @@ typeof navigator === "object" && (function (global, factory) {
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

4
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

121
dist/plyr.mjs vendored
View File

@ -1253,12 +1253,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);
@ -1370,13 +1372,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;
});
}
// ==========================================================================
@ -2611,17 +2606,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
@ -3665,7 +3654,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
@ -3949,7 +3938,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: {
@ -5668,26 +5663,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
setAspectRatio.call(this); // Load the SDK if not already
player.options.speed = player.config.speed.options; // Set intial ratio
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
@ -5713,7 +5709,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
@ -5855,7 +5856,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() {
@ -5875,7 +5876,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) {
@ -5884,7 +5885,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) {
@ -6259,7 +6260,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);
@ -6418,7 +6423,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) {
@ -7164,7 +7169,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;
}
@ -7391,6 +7396,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() {
@ -7636,7 +7652,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;
}
@ -7649,6 +7665,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();
@ -7747,6 +7770,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);
@ -7896,11 +7924,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

View File

@ -7456,12 +7456,14 @@ typeof navigator === "object" && (function (global, factory) {
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);
@ -7552,28 +7554,6 @@ typeof navigator === "object" && (function (global, factory) {
}
};
// `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;
@ -7593,13 +7573,6 @@ typeof navigator === "object" && (function (global, factory) {
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;
@ -8922,17 +8895,11 @@ typeof navigator === "object" && (function (global, factory) {
}
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
@ -9976,7 +9943,7 @@ typeof navigator === "object" && (function (global, factory) {
// 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
@ -10260,7 +10227,13 @@ typeof navigator === "object" && (function (global, factory) {
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: {
@ -12044,26 +12017,27 @@ typeof navigator === "object" && (function (global, factory) {
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
setAspectRatio.call(this); // Load the SDK if not already
player.options.speed = player.config.speed.options; // Set intial ratio
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
@ -12089,7 +12063,12 @@ typeof navigator === "object" && (function (global, factory) {
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
@ -12231,7 +12210,7 @@ typeof navigator === "object" && (function (global, factory) {
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() {
@ -12251,7 +12230,7 @@ typeof navigator === "object" && (function (global, factory) {
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) {
@ -12260,7 +12239,7 @@ typeof navigator === "object" && (function (global, factory) {
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) {
@ -12633,7 +12612,11 @@ typeof navigator === "object" && (function (global, factory) {
}
}); // 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);
@ -12791,7 +12774,7 @@ typeof navigator === "object" && (function (global, factory) {
}
if (this.isHTML5) {
html5.extend.call(this);
html5.setup.call(this);
} else if (this.isYouTube) {
youtube.setup.call(this);
} else if (this.isVimeo) {
@ -13588,7 +13571,7 @@ typeof navigator === "object" && (function (global, factory) {
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;
}
@ -13815,6 +13798,17 @@ typeof navigator === "object" && (function (global, factory) {
});
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() {
@ -14060,7 +14054,7 @@ typeof navigator === "object" && (function (global, factory) {
}, {
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;
}
@ -14073,6 +14067,13 @@ typeof navigator === "object" && (function (global, factory) {
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();
@ -14171,6 +14172,11 @@ typeof navigator === "object" && (function (global, factory) {
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);
@ -14320,11 +14326,22 @@ typeof navigator === "object" && (function (global, factory) {
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

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

@ -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
setAspectRatio.call(this); // Load the SDK if not already
player.options.speed = player.config.speed.options; // Set intial ratio
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;
}
@ -13809,6 +13792,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() {
@ -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

View File

@ -130,13 +130,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.
```html
<script src="https://cdn.plyr.io/3.5.7/plyr.js"></script>
<script src="https://cdn.plyr.io/3.5.8/plyr.js"></script>
```
...or...
```html
<script src="https://cdn.plyr.io/3.5.7/plyr.polyfilled.js"></script>
<script src="https://cdn.plyr.io/3.5.8/plyr.polyfilled.js"></script>
```
## CSS
@ -150,13 +150,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:
```html
<link rel="stylesheet" href="https://cdn.plyr.io/3.5.7/plyr.css" />
<link rel="stylesheet" href="https://cdn.plyr.io/3.5.8/plyr.css" />
```
## 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
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.5.7/plyr.svg`.
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.5.8/plyr.svg`.
# Ads

View File

@ -61,7 +61,7 @@ const defaults = {
// 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',

View File

@ -1,6 +1,6 @@
// ==========================================================================
// Plyr
// plyr.js v3.5.7
// plyr.js v3.5.8
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================

View File

@ -1,6 +1,6 @@
// ==========================================================================
// Plyr Polyfilled Build
// plyr.js v3.5.7
// plyr.js v3.5.8
// https://github.com/sampotts/plyr
// License: The MIT License (MIT)
// ==========================================================================