pkg: deploy v3.6.3

This commit is contained in:
Sam Potts
2020-11-14 13:29:47 +11:00
parent e8d883edba
commit b444aa3a98
22 changed files with 1665 additions and 1784 deletions

164
dist/plyr.mjs vendored
View File

@ -3653,7 +3653,7 @@ var defaults$1 = {
// Sprite (for icons)
loadSprite: true,
iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/3.6.2/plyr.svg',
iconUrl: 'https://cdn.plyr.io/3.6.3/plyr.svg',
// Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
// Quality default
@ -3771,7 +3771,7 @@ var defaults$1 = {
vimeo: {
sdk: 'https://player.vimeo.com/api/player.js',
iframe: 'https://player.vimeo.com/video/{0}?{1}',
api: 'https://vimeo.com/api/v2/video/{0}.json'
api: 'https://vimeo.com/api/oembed.json?url={0}'
},
youtube: {
sdk: 'https://www.youtube.com/iframe_api',
@ -3941,24 +3941,27 @@ var defaults$1 = {
title: false,
speed: true,
transparent: false,
// Custom settings from Plyr
customControls: true,
referrerPolicy: null,
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
// Whether the owner of the video has a Pro or Business account
// (which allows us to properly hide controls without CSS hacks, etc)
premium: false,
// Custom settings from Plyr
referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
premium: false
},
// YouTube plugin
youtube: {
noCookie: true,
// Whether to use an alternative version of YouTube without cookies
rel: 0,
// No related vids
showinfo: 0,
// Hide info
iv_load_policy: 3,
// Hide annotations
modestbranding: 1 // Hide logos as much as possible (they still show one in the corner when paused)
modestbranding: 1,
// Hide logos as much as possible (they still show one in the corner when paused)
// Custom settings from Plyr
customControls: true,
noCookie: false // Whether to use an alternative version of YouTube without cookies
}
};
@ -4077,7 +4080,7 @@ var Fullscreen = /*#__PURE__*/function () {
return;
}
_this.toggle();
_this.player.listeners.proxy(event, _this.toggle, 'fullscreen');
}); // Tap focus when in fullscreen
on.call(this, this.player.elements.container, 'keydown', function (event) {
@ -4487,7 +4490,9 @@ var ui = {
} // Set property synchronously to respect the call order
this.media.setAttribute('data-poster', poster); // Wait until ui is ready
this.media.setAttribute('data-poster', poster); // Show the poster
this.elements.poster.removeAttribute('hidden'); // Wait until ui is ready
return ready.call(this) // Load image
.then(function () {
@ -4919,7 +4924,14 @@ var Listeners = /*#__PURE__*/function () {
ratio = _setPlayerSize.ratio; // Set Vimeo gutter
setGutter(ratio, padding, isEnter); // If not using native browser fullscreen API, we need to check for resizes of viewport
setGutter(ratio, padding, isEnter); // Horrible hack for Safari 14 not repainting properly on entering fullscreen
if (isEnter) {
setTimeout(function () {
return repaint(elements.container);
}, 100);
} // If not using native browser fullscreen API, we need to check for resizes of viewport
if (!usingNative) {
if (isEnter) {
@ -5110,9 +5122,17 @@ var Listeners = /*#__PURE__*/function () {
this.bind(elements.buttons.restart, 'click', player.restart, 'restart'); // Rewind
this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind'); // Rewind
this.bind(elements.buttons.rewind, 'click', function () {
// Record seek time so we can prevent hiding controls for a few seconds after rewind
player.lastSeekTime = Date.now();
player.rewind();
}, 'rewind'); // Rewind
this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward'); // Mute toggle
this.bind(elements.buttons.fastForward, 'click', function () {
// Record seek time so we can prevent hiding controls for a few seconds after fast forward
player.lastSeekTime = Date.now();
player.forward();
}, 'fastForward'); // Mute toggle
this.bind(elements.buttons.mute, 'click', function () {
player.muted = !player.muted;
@ -5767,35 +5787,32 @@ var vimeo = {
} // Inject the package
var poster = player.poster;
if (premium) {
iframe.setAttribute('data-poster', poster);
if (premium || !config.customControls) {
iframe.setAttribute('data-poster', player.poster);
player.media = replaceElement(iframe, player.media);
} else {
var wrapper = createElement('div', {
class: player.config.classNames.embedContainer,
'data-poster': poster
'data-poster': player.poster
});
wrapper.appendChild(iframe);
player.media = replaceElement(wrapper, player.media);
} // Get poster image
fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
if (is$1.empty(response)) {
return;
} // Get the URL for thumbnail
if (!config.customControls) {
fetch(format(player.config.urls.vimeo.api, src)).then(function (response) {
if (is$1.empty(response) || !response.thumbnail_url) {
return;
} // Set and show poster
var url = new URL(response[0].thumbnail_large); // Get original image
url.pathname = "".concat(url.pathname.split('_')[0], ".jpg"); // Set and show poster
ui.setPoster.call(player, url.href).catch(function () {});
}); // Setup instance
ui.setPoster.call(player, response.thumbnail_url).catch(function () {});
});
} // Setup instance
// https://github.com/vimeo/player.js
player.embed = new window.Vimeo.Player(iframe, {
autopause: player.config.autopause,
muted: player.muted
@ -6035,9 +6052,11 @@ var vimeo = {
triggerEvent.call(player, player.media, 'error');
}); // Rebuild UI
setTimeout(function () {
return ui.build.call(player);
}, 0);
if (config.customControls) {
setTimeout(function () {
return ui.build.call(player);
}, 0);
}
}
};
@ -6130,7 +6149,8 @@ var youtube = {
},
// API ready
ready: function ready() {
var player = this; // Ignore already setup (race condition)
var player = this;
var config = player.config.youtube; // Ignore already setup (race condition)
var currentId = player.media && player.media.getAttribute('id');
@ -6147,53 +6167,53 @@ var youtube = {
var videoId = parseId$1(source);
var id = generateId(player.provider); // Get poster, if already set
var poster = player.poster; // Replace media element
var id = generateId(player.provider); // Replace media element
var container = createElement('div', {
id: id,
'data-poster': poster
'data-poster': config.customControls ? player.poster : undefined
});
player.media = replaceElement(container, player.media); // Id to poster wrapper
player.media = replaceElement(container, player.media); // Only load the poster when using custom controls
var posterSrc = function posterSrc(s) {
return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
}; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
if (config.customControls) {
var posterSrc = function posterSrc(s) {
return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
}; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
.catch(function () {
return loadImage(posterSrc('sd'), 121);
}) // 480p padded 4:3
.catch(function () {
return loadImage(posterSrc('hq'));
}) // 360p padded 4:3. Always exists
.then(function (image) {
return ui.setPoster.call(player, image.src);
}).then(function (src) {
// If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
if (!src.includes('maxres')) {
player.elements.poster.style.backgroundSize = 'cover';
}
}).catch(function () {});
var config = player.config.youtube; // Setup instance
loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
.catch(function () {
return loadImage(posterSrc('sd'), 121);
}) // 480p padded 4:3
.catch(function () {
return loadImage(posterSrc('hq'));
}) // 360p padded 4:3. Always exists
.then(function (image) {
return ui.setPoster.call(player, image.src);
}).then(function (src) {
// If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
if (!src.includes('maxres')) {
player.elements.poster.style.backgroundSize = 'cover';
}
}).catch(function () {});
} // Setup instance
// https://developers.google.com/youtube/iframe_api_reference
player.embed = new window.YT.Player(id, {
player.embed = new window.YT.Player(player.media, {
videoId: videoId,
host: getHost(config),
playerVars: extend({}, {
autoplay: player.config.autoplay ? 1 : 0,
// Autoplay
hl: player.config.hl,
autoplay: player.config.autoplay ? 1 : 0,
// iframe interface language
controls: player.supported.ui ? 0 : 1,
// Only show controls if not fully supported
disablekb: 1,
hl: player.config.hl,
// Only show controls if not fully supported or opted out
controls: player.supported.ui && config.customControls ? 0 : 1,
// Disable keyboard as we handle it
playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
disablekb: 1,
// Allow iOS inline playback
playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
// Captions are flaky on YouTube
cc_load_policy: player.captions.active ? 1 : 0,
cc_lang_pref: player.config.captions.language,
@ -6304,6 +6324,7 @@ var youtube = {
var toggle = is$1.boolean(input) ? input : muted;
muted = toggle;
instance[toggle ? 'mute' : 'unMute']();
instance.setVolume(volume * 100);
triggerEvent.call(player, player.media, 'volumechange');
}
}); // Source
@ -6326,7 +6347,7 @@ var youtube = {
return player.config.speed.options.includes(s);
}); // Set the tabindex to avoid focus entering iframe
if (player.supported.ui) {
if (player.supported.ui && config.customControls) {
player.media.setAttribute('tabindex', -1);
}
@ -6353,9 +6374,11 @@ var youtube = {
}
}, 200); // Rebuild UI
setTimeout(function () {
return ui.build.call(player);
}, 50);
if (config.customControls) {
setTimeout(function () {
return ui.build.call(player);
}, 50);
}
},
onStateChange: function onStateChange(event) {
// Get the instance
@ -6401,7 +6424,7 @@ var youtube = {
case 1:
// Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)
if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
if (config.customControls && !player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
player.media.pause();
} else {
assurePlaybackState$1.call(player, true);
@ -6475,7 +6498,8 @@ var media = {
wrap(this.media, this.elements.wrapper); // Poster image container
this.elements.poster = createElement('div', {
class: this.config.classNames.poster
class: this.config.classNames.poster,
hidden: ''
});
this.elements.wrapper.appendChild(this.elements.poster);
}