3.5.7
This commit is contained in:
parent
8c44425665
commit
bb7f7d5e2a
1970
demo/dist/demo.js
vendored
1970
demo/dist/demo.js
vendored
File diff suppressed because it is too large
Load Diff
4
demo/dist/demo.min.js
vendored
4
demo/dist/demo.min.js
vendored
File diff suppressed because one or more lines are too long
2
demo/dist/demo.min.js.map
vendored
2
demo/dist/demo.min.js.map
vendored
File diff suppressed because one or more lines are too long
569
dist/plyr.js
vendored
569
dist/plyr.js
vendored
@ -621,151 +621,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
function cloneDeep(object) {
|
||||
return JSON.parse(JSON.stringify(object));
|
||||
} // Get a nested value in an object
|
||||
@ -1027,41 +882,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
|
||||
function getElement(selector) {
|
||||
return this.elements.container.querySelector(selector);
|
||||
} // Trap focus inside container
|
||||
|
||||
function trapFocus() {
|
||||
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||
var toggle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
if (!is$1.element(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
var first = focusable[0];
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
var trap = function trap(event) {
|
||||
// Bail if not tab key or not fullscreen
|
||||
if (event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false);
|
||||
} // Set focus and tab focus class
|
||||
|
||||
function setFocus() {
|
||||
@ -1179,6 +999,151 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
function validateRatio(input) {
|
||||
if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
|
||||
return false;
|
||||
@ -1317,7 +1282,11 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
return source && Number(source.getAttribute('size'));
|
||||
},
|
||||
set: function set(input) {
|
||||
// If we're using an an external handler...
|
||||
if (player.quality === input) {
|
||||
return;
|
||||
} // If we're using an an external handler...
|
||||
|
||||
|
||||
if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
|
||||
player.config.quality.onChange(input);
|
||||
} else {
|
||||
@ -1337,17 +1306,15 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
currentTime = _player$media.currentTime,
|
||||
paused = _player$media.paused,
|
||||
preload = _player$media.preload,
|
||||
readyState = _player$media.readyState; // Set new source
|
||||
readyState = _player$media.readyState,
|
||||
playbackRate = _player$media.playbackRate; // Set new source
|
||||
|
||||
player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
|
||||
|
||||
if (preload !== 'none' || readyState) {
|
||||
// Restore time
|
||||
player.once('loadedmetadata', function () {
|
||||
if (player.currentTime === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.speed = playbackRate;
|
||||
player.currentTime = currentTime; // Resume playing
|
||||
|
||||
if (!paused) {
|
||||
@ -1409,6 +1376,13 @@ 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;
|
||||
});
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
@ -2634,7 +2608,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
controls.updateSetting.call(this, type, list);
|
||||
},
|
||||
// Set a list of available captions languages
|
||||
setSpeedMenu: function setSpeedMenu(options) {
|
||||
setSpeedMenu: function setSpeedMenu() {
|
||||
var _this8 = this;
|
||||
|
||||
// Menu required
|
||||
@ -2643,19 +2617,18 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}
|
||||
|
||||
var type = 'speed';
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Set the speed options
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Determine options to display
|
||||
// Vimeo and YouTube limit to 0.5x-2x
|
||||
|
||||
if (is$1.array(options)) {
|
||||
this.options.speed = options;
|
||||
} else if (this.isHTML5 || this.isVimeo) {
|
||||
this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||
} // Set options if passed and filter based on config
|
||||
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
|
||||
|
||||
|
||||
this.options.speed = this.options.speed.filter(function (speed) {
|
||||
return _this8.config.speed.options.includes(speed);
|
||||
}); // 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
|
||||
|
||||
@ -3074,7 +3047,12 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
element: 'a',
|
||||
href: _this10.download,
|
||||
target: '_blank'
|
||||
});
|
||||
}); // Set download attribute for HTML5 only
|
||||
|
||||
|
||||
if (_this10.isHTML5) {
|
||||
_attributes.download = '';
|
||||
}
|
||||
|
||||
var download = _this10.config.urls.download;
|
||||
|
||||
@ -3693,12 +3671,13 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
// Sprite (for icons)
|
||||
loadSprite: true,
|
||||
iconPrefix: 'plyr',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7-beta.0/plyr.svg',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7/plyr.svg',
|
||||
// Blank video (used to prevent errors on source change)
|
||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||
// Quality default
|
||||
quality: {
|
||||
default: 576,
|
||||
// The options to display in the UI, if available for the source media
|
||||
options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
|
||||
forced: false,
|
||||
onChange: null
|
||||
@ -3712,7 +3691,8 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
// Speed default and options to display
|
||||
speed: {
|
||||
selected: 1,
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
|
||||
// The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
|
||||
},
|
||||
// Keyboard shortcut settings
|
||||
keyboard: {
|
||||
@ -4074,73 +4054,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
return Console;
|
||||
}();
|
||||
|
||||
function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true); // Trap focus in container
|
||||
|
||||
if (!browser.isIos) {
|
||||
trapFocus.call(this.player, this.target, this.active);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
onChange.call(this);
|
||||
}
|
||||
|
||||
var Fullscreen =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
@ -4165,7 +4078,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
|
||||
on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
|
||||
// TODO: Filter for target??
|
||||
onChange.call(_this);
|
||||
_this.onChange();
|
||||
}); // Fullscreen toggle on double click
|
||||
|
||||
on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
|
||||
@ -4175,6 +4088,10 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}
|
||||
|
||||
_this.toggle();
|
||||
}); // Tap focus when in fullscreen
|
||||
|
||||
on.call(this, this.player.elements.container, 'keydown', function (event) {
|
||||
return _this.trapFocus(event);
|
||||
}); // Update the UI
|
||||
|
||||
this.update();
|
||||
@ -4182,8 +4099,101 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
|
||||
|
||||
_createClass(Fullscreen, [{
|
||||
key: "onChange",
|
||||
value: function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
|
||||
}
|
||||
}, {
|
||||
key: "toggleFallback",
|
||||
value: function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
this.onChange();
|
||||
} // Trap focus inside container
|
||||
|
||||
}, {
|
||||
key: "trapFocus",
|
||||
value: function trapFocus(event) {
|
||||
// Bail if iOS, not active, not the tab key
|
||||
if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
|
||||
var _focusable = _slicedToArray(focusable, 1),
|
||||
first = _focusable[0];
|
||||
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
} // Update UI
|
||||
|
||||
}, {
|
||||
key: "update",
|
||||
// Update UI
|
||||
value: function update() {
|
||||
if (this.enabled) {
|
||||
var mode;
|
||||
@ -4216,10 +4226,10 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
if (browser.isIos && this.player.config.fullscreen.iosNative) {
|
||||
this.target.webkitEnterFullscreen();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, true);
|
||||
this.toggleFallback(true);
|
||||
} else if (!this.prefix) {
|
||||
this.target.requestFullscreen({
|
||||
navigationUI: "hide"
|
||||
navigationUI: 'hide'
|
||||
});
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
this.target["".concat(this.prefix, "Request").concat(this.property)]();
|
||||
@ -4238,7 +4248,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
this.target.webkitExitFullscreen();
|
||||
this.player.play();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, false);
|
||||
this.toggleFallback(false);
|
||||
} else if (!this.prefix) {
|
||||
(document.cancelFullScreen || document.exitFullscreen).call(document);
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
@ -5112,9 +5122,11 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
this.bind(elements.buttons.settings, 'click', function (event) {
|
||||
// Prevent the document click listener closing the menu
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
controls.toggleMenu.call(player, event);
|
||||
}); // Settings menu - keyboard toggle
|
||||
}, null, false); // Can't be passive as we're preventing default
|
||||
// Settings menu - keyboard toggle
|
||||
// We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
|
||||
|
||||
@ -5216,7 +5228,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}
|
||||
}); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
|
||||
|
||||
this.bind(elements.progress, 'mouseleave click', function () {
|
||||
this.bind(elements.progress, 'mouseleave touchend click', function () {
|
||||
var previewThumbnails = player.previewThumbnails;
|
||||
|
||||
if (previewThumbnails && previewThumbnails.loaded) {
|
||||
@ -5800,11 +5812,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
player.embed.setPlaybackRate(input).then(function () {
|
||||
speed = input;
|
||||
triggerEvent.call(player, player.media, 'ratechange');
|
||||
}).catch(function (error) {
|
||||
// Hide menu item (and menu if empty)
|
||||
if (error.name === 'Error') {
|
||||
controls.setSpeedMenu.call(player, []);
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // Volume
|
||||
@ -7304,8 +7311,8 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}, {
|
||||
key: "startScrubbing",
|
||||
value: function startScrubbing(event) {
|
||||
// Only act on left mouse button (0), or touch device (event.button is false)
|
||||
if (event.button === false || event.button === 0) {
|
||||
// Only act on left mouse button (0), or touch device (event.button does not exist or is false)
|
||||
if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
|
||||
this.mouseDown = true; // Wait until media has a duration
|
||||
|
||||
if (this.player.media.duration) {
|
||||
|
4
dist/plyr.min.js
vendored
4
dist/plyr.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.min.js.map
vendored
2
dist/plyr.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.min.mjs
vendored
2
dist/plyr.min.mjs
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.min.mjs.map
vendored
2
dist/plyr.min.mjs.map
vendored
File diff suppressed because one or more lines are too long
569
dist/plyr.mjs
vendored
569
dist/plyr.mjs
vendored
@ -615,151 +615,6 @@ var browser = {
|
||||
isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
function cloneDeep(object) {
|
||||
return JSON.parse(JSON.stringify(object));
|
||||
} // Get a nested value in an object
|
||||
@ -1021,41 +876,6 @@ function getElements(selector) {
|
||||
|
||||
function getElement(selector) {
|
||||
return this.elements.container.querySelector(selector);
|
||||
} // Trap focus inside container
|
||||
|
||||
function trapFocus() {
|
||||
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||
var toggle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
if (!is$1.element(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
var first = focusable[0];
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
var trap = function trap(event) {
|
||||
// Bail if not tab key or not fullscreen
|
||||
if (event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false);
|
||||
} // Set focus and tab focus class
|
||||
|
||||
function setFocus() {
|
||||
@ -1173,6 +993,151 @@ var support = {
|
||||
reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
function validateRatio(input) {
|
||||
if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
|
||||
return false;
|
||||
@ -1311,7 +1276,11 @@ var html5 = {
|
||||
return source && Number(source.getAttribute('size'));
|
||||
},
|
||||
set: function set(input) {
|
||||
// If we're using an an external handler...
|
||||
if (player.quality === input) {
|
||||
return;
|
||||
} // If we're using an an external handler...
|
||||
|
||||
|
||||
if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
|
||||
player.config.quality.onChange(input);
|
||||
} else {
|
||||
@ -1331,17 +1300,15 @@ var html5 = {
|
||||
currentTime = _player$media.currentTime,
|
||||
paused = _player$media.paused,
|
||||
preload = _player$media.preload,
|
||||
readyState = _player$media.readyState; // Set new source
|
||||
readyState = _player$media.readyState,
|
||||
playbackRate = _player$media.playbackRate; // Set new source
|
||||
|
||||
player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
|
||||
|
||||
if (preload !== 'none' || readyState) {
|
||||
// Restore time
|
||||
player.once('loadedmetadata', function () {
|
||||
if (player.currentTime === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.speed = playbackRate;
|
||||
player.currentTime = currentTime; // Resume playing
|
||||
|
||||
if (!paused) {
|
||||
@ -1403,6 +1370,13 @@ 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;
|
||||
});
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
@ -2628,7 +2602,7 @@ var controls = {
|
||||
controls.updateSetting.call(this, type, list);
|
||||
},
|
||||
// Set a list of available captions languages
|
||||
setSpeedMenu: function setSpeedMenu(options) {
|
||||
setSpeedMenu: function setSpeedMenu() {
|
||||
var _this8 = this;
|
||||
|
||||
// Menu required
|
||||
@ -2637,19 +2611,18 @@ var controls = {
|
||||
}
|
||||
|
||||
var type = 'speed';
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Set the speed options
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Determine options to display
|
||||
// Vimeo and YouTube limit to 0.5x-2x
|
||||
|
||||
if (is$1.array(options)) {
|
||||
this.options.speed = options;
|
||||
} else if (this.isHTML5 || this.isVimeo) {
|
||||
this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||
} // Set options if passed and filter based on config
|
||||
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
|
||||
|
||||
|
||||
this.options.speed = this.options.speed.filter(function (speed) {
|
||||
return _this8.config.speed.options.includes(speed);
|
||||
}); // 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
|
||||
|
||||
@ -3068,7 +3041,12 @@ var controls = {
|
||||
element: 'a',
|
||||
href: _this10.download,
|
||||
target: '_blank'
|
||||
});
|
||||
}); // Set download attribute for HTML5 only
|
||||
|
||||
|
||||
if (_this10.isHTML5) {
|
||||
_attributes.download = '';
|
||||
}
|
||||
|
||||
var download = _this10.config.urls.download;
|
||||
|
||||
@ -3687,12 +3665,13 @@ var defaults$1 = {
|
||||
// Sprite (for icons)
|
||||
loadSprite: true,
|
||||
iconPrefix: 'plyr',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7-beta.0/plyr.svg',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7/plyr.svg',
|
||||
// Blank video (used to prevent errors on source change)
|
||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||
// Quality default
|
||||
quality: {
|
||||
default: 576,
|
||||
// The options to display in the UI, if available for the source media
|
||||
options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
|
||||
forced: false,
|
||||
onChange: null
|
||||
@ -3706,7 +3685,8 @@ var defaults$1 = {
|
||||
// Speed default and options to display
|
||||
speed: {
|
||||
selected: 1,
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
|
||||
// The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
|
||||
},
|
||||
// Keyboard shortcut settings
|
||||
keyboard: {
|
||||
@ -4068,73 +4048,6 @@ function () {
|
||||
return Console;
|
||||
}();
|
||||
|
||||
function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true); // Trap focus in container
|
||||
|
||||
if (!browser.isIos) {
|
||||
trapFocus.call(this.player, this.target, this.active);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
onChange.call(this);
|
||||
}
|
||||
|
||||
var Fullscreen =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
@ -4159,7 +4072,7 @@ function () {
|
||||
|
||||
on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
|
||||
// TODO: Filter for target??
|
||||
onChange.call(_this);
|
||||
_this.onChange();
|
||||
}); // Fullscreen toggle on double click
|
||||
|
||||
on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
|
||||
@ -4169,6 +4082,10 @@ function () {
|
||||
}
|
||||
|
||||
_this.toggle();
|
||||
}); // Tap focus when in fullscreen
|
||||
|
||||
on.call(this, this.player.elements.container, 'keydown', function (event) {
|
||||
return _this.trapFocus(event);
|
||||
}); // Update the UI
|
||||
|
||||
this.update();
|
||||
@ -4176,8 +4093,101 @@ function () {
|
||||
|
||||
|
||||
_createClass(Fullscreen, [{
|
||||
key: "onChange",
|
||||
value: function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
|
||||
}
|
||||
}, {
|
||||
key: "toggleFallback",
|
||||
value: function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
this.onChange();
|
||||
} // Trap focus inside container
|
||||
|
||||
}, {
|
||||
key: "trapFocus",
|
||||
value: function trapFocus(event) {
|
||||
// Bail if iOS, not active, not the tab key
|
||||
if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
|
||||
var _focusable = _slicedToArray(focusable, 1),
|
||||
first = _focusable[0];
|
||||
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
} // Update UI
|
||||
|
||||
}, {
|
||||
key: "update",
|
||||
// Update UI
|
||||
value: function update() {
|
||||
if (this.enabled) {
|
||||
var mode;
|
||||
@ -4210,10 +4220,10 @@ function () {
|
||||
if (browser.isIos && this.player.config.fullscreen.iosNative) {
|
||||
this.target.webkitEnterFullscreen();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, true);
|
||||
this.toggleFallback(true);
|
||||
} else if (!this.prefix) {
|
||||
this.target.requestFullscreen({
|
||||
navigationUI: "hide"
|
||||
navigationUI: 'hide'
|
||||
});
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
this.target["".concat(this.prefix, "Request").concat(this.property)]();
|
||||
@ -4232,7 +4242,7 @@ function () {
|
||||
this.target.webkitExitFullscreen();
|
||||
this.player.play();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, false);
|
||||
this.toggleFallback(false);
|
||||
} else if (!this.prefix) {
|
||||
(document.cancelFullScreen || document.exitFullscreen).call(document);
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
@ -5106,9 +5116,11 @@ function () {
|
||||
this.bind(elements.buttons.settings, 'click', function (event) {
|
||||
// Prevent the document click listener closing the menu
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
controls.toggleMenu.call(player, event);
|
||||
}); // Settings menu - keyboard toggle
|
||||
}, null, false); // Can't be passive as we're preventing default
|
||||
// Settings menu - keyboard toggle
|
||||
// We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
|
||||
|
||||
@ -5210,7 +5222,7 @@ function () {
|
||||
}
|
||||
}); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
|
||||
|
||||
this.bind(elements.progress, 'mouseleave click', function () {
|
||||
this.bind(elements.progress, 'mouseleave touchend click', function () {
|
||||
var previewThumbnails = player.previewThumbnails;
|
||||
|
||||
if (previewThumbnails && previewThumbnails.loaded) {
|
||||
@ -5794,11 +5806,6 @@ var vimeo = {
|
||||
player.embed.setPlaybackRate(input).then(function () {
|
||||
speed = input;
|
||||
triggerEvent.call(player, player.media, 'ratechange');
|
||||
}).catch(function (error) {
|
||||
// Hide menu item (and menu if empty)
|
||||
if (error.name === 'Error') {
|
||||
controls.setSpeedMenu.call(player, []);
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // Volume
|
||||
@ -7298,8 +7305,8 @@ function () {
|
||||
}, {
|
||||
key: "startScrubbing",
|
||||
value: function startScrubbing(event) {
|
||||
// Only act on left mouse button (0), or touch device (event.button is false)
|
||||
if (event.button === false || event.button === 0) {
|
||||
// Only act on left mouse button (0), or touch device (event.button does not exist or is false)
|
||||
if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
|
||||
this.mouseDown = true; // Wait until media has a duration
|
||||
|
||||
if (this.player.media.duration) {
|
||||
|
613
dist/plyr.polyfilled.js
vendored
613
dist/plyr.polyfilled.js
vendored
@ -6768,151 +6768,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
// `Array.prototype.{ reduce, reduceRight }` methods implementation
|
||||
var createMethod$5 = function (IS_RIGHT) {
|
||||
return function (that, callbackfn, argumentsLength, memo) {
|
||||
@ -7225,41 +7080,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
|
||||
function getElement(selector) {
|
||||
return this.elements.container.querySelector(selector);
|
||||
} // Trap focus inside container
|
||||
|
||||
function trapFocus() {
|
||||
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||
var toggle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
if (!is$1.element(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
var first = focusable[0];
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
var trap = function trap(event) {
|
||||
// Bail if not tab key or not fullscreen
|
||||
if (event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false);
|
||||
} // Set focus and tab focus class
|
||||
|
||||
function setFocus() {
|
||||
@ -7377,6 +7197,151 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
function validateRatio(input) {
|
||||
if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
|
||||
return false;
|
||||
@ -7514,7 +7479,11 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
return source && Number(source.getAttribute('size'));
|
||||
},
|
||||
set: function set(input) {
|
||||
// If we're using an an external handler...
|
||||
if (player.quality === input) {
|
||||
return;
|
||||
} // If we're using an an external handler...
|
||||
|
||||
|
||||
if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
|
||||
player.config.quality.onChange(input);
|
||||
} else {
|
||||
@ -7534,17 +7503,15 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
currentTime = _player$media.currentTime,
|
||||
paused = _player$media.paused,
|
||||
preload = _player$media.preload,
|
||||
readyState = _player$media.readyState; // Set new source
|
||||
readyState = _player$media.readyState,
|
||||
playbackRate = _player$media.playbackRate; // Set new source
|
||||
|
||||
player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
|
||||
|
||||
if (preload !== 'none' || readyState) {
|
||||
// Restore time
|
||||
player.once('loadedmetadata', function () {
|
||||
if (player.currentTime === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.speed = playbackRate;
|
||||
player.currentTime = currentTime; // Resume playing
|
||||
|
||||
if (!paused) {
|
||||
@ -7585,6 +7552,28 @@ 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;
|
||||
@ -7604,6 +7593,13 @@ 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;
|
||||
@ -8917,7 +8913,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
controls.updateSetting.call(this, type, list);
|
||||
},
|
||||
// Set a list of available captions languages
|
||||
setSpeedMenu: function setSpeedMenu(options) {
|
||||
setSpeedMenu: function setSpeedMenu() {
|
||||
var _this8 = this;
|
||||
|
||||
// Menu required
|
||||
@ -8926,19 +8922,18 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}
|
||||
|
||||
var type = 'speed';
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Set the speed options
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Determine options to display
|
||||
// Vimeo and YouTube limit to 0.5x-2x
|
||||
|
||||
if (is$1.array(options)) {
|
||||
this.options.speed = options;
|
||||
} else if (this.isHTML5 || this.isVimeo) {
|
||||
this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||
} // Set options if passed and filter based on config
|
||||
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
|
||||
|
||||
|
||||
this.options.speed = this.options.speed.filter(function (speed) {
|
||||
return _this8.config.speed.options.includes(speed);
|
||||
}); // 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
|
||||
|
||||
@ -9357,7 +9352,12 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
element: 'a',
|
||||
href: _this10.download,
|
||||
target: '_blank'
|
||||
});
|
||||
}); // Set download attribute for HTML5 only
|
||||
|
||||
|
||||
if (_this10.isHTML5) {
|
||||
_attributes.download = '';
|
||||
}
|
||||
|
||||
var download = _this10.config.urls.download;
|
||||
|
||||
@ -9976,12 +9976,13 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
// Sprite (for icons)
|
||||
loadSprite: true,
|
||||
iconPrefix: 'plyr',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7-beta.0/plyr.svg',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7/plyr.svg',
|
||||
// Blank video (used to prevent errors on source change)
|
||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||
// Quality default
|
||||
quality: {
|
||||
default: 576,
|
||||
// The options to display in the UI, if available for the source media
|
||||
options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
|
||||
forced: false,
|
||||
onChange: null
|
||||
@ -9995,7 +9996,8 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
// Speed default and options to display
|
||||
speed: {
|
||||
selected: 1,
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
|
||||
// The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
|
||||
},
|
||||
// Keyboard shortcut settings
|
||||
keyboard: {
|
||||
@ -10357,73 +10359,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
return Console;
|
||||
}();
|
||||
|
||||
function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true); // Trap focus in container
|
||||
|
||||
if (!browser.isIos) {
|
||||
trapFocus.call(this.player, this.target, this.active);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
onChange.call(this);
|
||||
}
|
||||
|
||||
var Fullscreen =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
@ -10448,7 +10383,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
|
||||
on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
|
||||
// TODO: Filter for target??
|
||||
onChange.call(_this);
|
||||
_this.onChange();
|
||||
}); // Fullscreen toggle on double click
|
||||
|
||||
on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
|
||||
@ -10458,6 +10393,10 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}
|
||||
|
||||
_this.toggle();
|
||||
}); // Tap focus when in fullscreen
|
||||
|
||||
on.call(this, this.player.elements.container, 'keydown', function (event) {
|
||||
return _this.trapFocus(event);
|
||||
}); // Update the UI
|
||||
|
||||
this.update();
|
||||
@ -10465,8 +10404,101 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
|
||||
|
||||
_createClass(Fullscreen, [{
|
||||
key: "onChange",
|
||||
value: function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
|
||||
}
|
||||
}, {
|
||||
key: "toggleFallback",
|
||||
value: function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
this.onChange();
|
||||
} // Trap focus inside container
|
||||
|
||||
}, {
|
||||
key: "trapFocus",
|
||||
value: function trapFocus(event) {
|
||||
// Bail if iOS, not active, not the tab key
|
||||
if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
|
||||
var _focusable = _slicedToArray(focusable, 1),
|
||||
first = _focusable[0];
|
||||
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
} // Update UI
|
||||
|
||||
}, {
|
||||
key: "update",
|
||||
// Update UI
|
||||
value: function update() {
|
||||
if (this.enabled) {
|
||||
var mode;
|
||||
@ -10499,10 +10531,10 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
if (browser.isIos && this.player.config.fullscreen.iosNative) {
|
||||
this.target.webkitEnterFullscreen();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, true);
|
||||
this.toggleFallback(true);
|
||||
} else if (!this.prefix) {
|
||||
this.target.requestFullscreen({
|
||||
navigationUI: "hide"
|
||||
navigationUI: 'hide'
|
||||
});
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
this.target["".concat(this.prefix, "Request").concat(this.property)]();
|
||||
@ -10521,7 +10553,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
this.target.webkitExitFullscreen();
|
||||
this.player.play();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, false);
|
||||
this.toggleFallback(false);
|
||||
} else if (!this.prefix) {
|
||||
(document.cancelFullScreen || document.exitFullscreen).call(document);
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
@ -11407,9 +11439,11 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
this.bind(elements.buttons.settings, 'click', function (event) {
|
||||
// Prevent the document click listener closing the menu
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
controls.toggleMenu.call(player, event);
|
||||
}); // Settings menu - keyboard toggle
|
||||
}, null, false); // Can't be passive as we're preventing default
|
||||
// Settings menu - keyboard toggle
|
||||
// We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
|
||||
|
||||
@ -11511,7 +11545,7 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}
|
||||
}); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
|
||||
|
||||
this.bind(elements.progress, 'mouseleave click', function () {
|
||||
this.bind(elements.progress, 'mouseleave touchend click', function () {
|
||||
var previewThumbnails = player.previewThumbnails;
|
||||
|
||||
if (previewThumbnails && previewThumbnails.loaded) {
|
||||
@ -11620,28 +11654,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
return Listeners;
|
||||
}();
|
||||
|
||||
var defineProperty$7 = objectDefineProperty.f;
|
||||
|
||||
var FunctionPrototype = Function.prototype;
|
||||
var FunctionPrototypeToString = FunctionPrototype.toString;
|
||||
var nameRE = /^\s*function ([^ (]*)/;
|
||||
var NAME = 'name';
|
||||
|
||||
// Function instances `.name` property
|
||||
// https://tc39.github.io/ecma262/#sec-function-instances-name
|
||||
if (descriptors && !(NAME in FunctionPrototype)) {
|
||||
defineProperty$7(FunctionPrototype, NAME, {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
try {
|
||||
return FunctionPrototypeToString.call(this).match(nameRE)[1];
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice');
|
||||
var USES_TO_LENGTH$a = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
|
||||
|
||||
@ -12170,11 +12182,6 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
player.embed.setPlaybackRate(input).then(function () {
|
||||
speed = input;
|
||||
triggerEvent.call(player, player.media, 'ratechange');
|
||||
}).catch(function (error) {
|
||||
// Hide menu item (and menu if empty)
|
||||
if (error.name === 'Error') {
|
||||
controls.setSpeedMenu.call(player, []);
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // Volume
|
||||
@ -13722,8 +13729,8 @@ typeof navigator === "object" && (function (global, factory) {
|
||||
}, {
|
||||
key: "startScrubbing",
|
||||
value: function startScrubbing(event) {
|
||||
// Only act on left mouse button (0), or touch device (event.button is false)
|
||||
if (event.button === false || event.button === 0) {
|
||||
// Only act on left mouse button (0), or touch device (event.button does not exist or is false)
|
||||
if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
|
||||
this.mouseDown = true; // Wait until media has a duration
|
||||
|
||||
if (this.player.media.duration) {
|
||||
|
2
dist/plyr.polyfilled.min.js
vendored
2
dist/plyr.polyfilled.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.polyfilled.min.js.map
vendored
2
dist/plyr.polyfilled.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.polyfilled.min.mjs
vendored
2
dist/plyr.polyfilled.min.mjs
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.polyfilled.min.mjs.map
vendored
2
dist/plyr.polyfilled.min.mjs.map
vendored
File diff suppressed because one or more lines are too long
613
dist/plyr.polyfilled.mjs
vendored
613
dist/plyr.polyfilled.mjs
vendored
@ -6762,151 +6762,6 @@ var browser = {
|
||||
isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
// `Array.prototype.{ reduce, reduceRight }` methods implementation
|
||||
var createMethod$5 = function (IS_RIGHT) {
|
||||
return function (that, callbackfn, argumentsLength, memo) {
|
||||
@ -7219,41 +7074,6 @@ function getElements(selector) {
|
||||
|
||||
function getElement(selector) {
|
||||
return this.elements.container.querySelector(selector);
|
||||
} // Trap focus inside container
|
||||
|
||||
function trapFocus() {
|
||||
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||
var toggle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
if (!is$1.element(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
var first = focusable[0];
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
var trap = function trap(event) {
|
||||
// Bail if not tab key or not fullscreen
|
||||
if (event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false);
|
||||
} // Set focus and tab focus class
|
||||
|
||||
function setFocus() {
|
||||
@ -7371,6 +7191,151 @@ var support = {
|
||||
reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches
|
||||
};
|
||||
|
||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||
// https://www.youtube.com/watch?v=NPM6172J22g
|
||||
|
||||
var supportsPassiveListeners = function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supported = true;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', null, options);
|
||||
window.removeEventListener('test', null, options);
|
||||
} catch (e) {// Do nothing
|
||||
}
|
||||
|
||||
return supported;
|
||||
}(); // Toggle event listener
|
||||
|
||||
|
||||
function toggleListener(element, event, callback) {
|
||||
var _this = this;
|
||||
|
||||
var toggle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
var capture = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
||||
|
||||
// Bail if no element, event, or callback
|
||||
if (!element || !('addEventListener' in element) || is$1.empty(event) || !is$1.function(callback)) {
|
||||
return;
|
||||
} // Allow multiple events
|
||||
|
||||
|
||||
var events = event.split(' '); // Build options
|
||||
// Default to just the capture boolean for browsers with no passive listener support
|
||||
|
||||
var options = capture; // If passive events listeners are supported
|
||||
|
||||
if (supportsPassiveListeners) {
|
||||
options = {
|
||||
// Whether the listener can be passive (i.e. default never prevented)
|
||||
passive: passive,
|
||||
// Whether the listener is a capturing listener or not
|
||||
capture: capture
|
||||
};
|
||||
} // If a single node is passed, bind the event listener
|
||||
|
||||
|
||||
events.forEach(function (type) {
|
||||
if (_this && _this.eventListeners && toggle) {
|
||||
// Cache event listener
|
||||
_this.eventListeners.push({
|
||||
element: element,
|
||||
type: type,
|
||||
callback: callback,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
element[toggle ? 'addEventListener' : 'removeEventListener'](type, callback, options);
|
||||
});
|
||||
} // Bind event handler
|
||||
|
||||
function on(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, true, passive, capture);
|
||||
} // Unbind event handler
|
||||
|
||||
function off(element) {
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
toggleListener.call(this, element, events, callback, false, passive, capture);
|
||||
} // Bind once-only event handler
|
||||
|
||||
function once(element) {
|
||||
var _this2 = this;
|
||||
|
||||
var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
||||
var passive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var capture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||||
|
||||
var onceCallback = function onceCallback() {
|
||||
off(element, events, onceCallback, passive, capture);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
callback.apply(_this2, args);
|
||||
};
|
||||
|
||||
toggleListener.call(this, element, events, onceCallback, true, passive, capture);
|
||||
} // Trigger event
|
||||
|
||||
function triggerEvent(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
// Bail if no element
|
||||
if (!is$1.element(element) || is$1.empty(type)) {
|
||||
return;
|
||||
} // Create and dispatch the event
|
||||
|
||||
|
||||
var event = new CustomEvent(type, {
|
||||
bubbles: bubbles,
|
||||
detail: _objectSpread2({}, detail, {
|
||||
plyr: this
|
||||
})
|
||||
}); // Dispatch the event
|
||||
|
||||
element.dispatchEvent(event);
|
||||
} // Unbind all cached event listeners
|
||||
|
||||
function unbindListeners() {
|
||||
if (this && this.eventListeners) {
|
||||
this.eventListeners.forEach(function (item) {
|
||||
var element = item.element,
|
||||
type = item.type,
|
||||
callback = item.callback,
|
||||
options = item.options;
|
||||
element.removeEventListener(type, callback, options);
|
||||
});
|
||||
this.eventListeners = [];
|
||||
}
|
||||
} // Run method when / if player is ready
|
||||
|
||||
function ready() {
|
||||
var _this3 = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
return _this3.ready ? setTimeout(resolve, 0) : on.call(_this3, _this3.elements.container, 'ready', resolve);
|
||||
}).then(function () {});
|
||||
}
|
||||
|
||||
function validateRatio(input) {
|
||||
if (!is$1.array(input) && (!is$1.string(input) || !input.includes(':'))) {
|
||||
return false;
|
||||
@ -7508,7 +7473,11 @@ var html5 = {
|
||||
return source && Number(source.getAttribute('size'));
|
||||
},
|
||||
set: function set(input) {
|
||||
// If we're using an an external handler...
|
||||
if (player.quality === input) {
|
||||
return;
|
||||
} // If we're using an an external handler...
|
||||
|
||||
|
||||
if (player.config.quality.forced && is$1.function(player.config.quality.onChange)) {
|
||||
player.config.quality.onChange(input);
|
||||
} else {
|
||||
@ -7528,17 +7497,15 @@ var html5 = {
|
||||
currentTime = _player$media.currentTime,
|
||||
paused = _player$media.paused,
|
||||
preload = _player$media.preload,
|
||||
readyState = _player$media.readyState; // Set new source
|
||||
readyState = _player$media.readyState,
|
||||
playbackRate = _player$media.playbackRate; // Set new source
|
||||
|
||||
player.media.src = source.getAttribute('src'); // Prevent loading if preload="none" and the current source isn't loaded (#1044)
|
||||
|
||||
if (preload !== 'none' || readyState) {
|
||||
// Restore time
|
||||
player.once('loadedmetadata', function () {
|
||||
if (player.currentTime === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.speed = playbackRate;
|
||||
player.currentTime = currentTime; // Resume playing
|
||||
|
||||
if (!paused) {
|
||||
@ -7579,6 +7546,28 @@ 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;
|
||||
@ -7598,6 +7587,13 @@ 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;
|
||||
@ -8911,7 +8907,7 @@ var controls = {
|
||||
controls.updateSetting.call(this, type, list);
|
||||
},
|
||||
// Set a list of available captions languages
|
||||
setSpeedMenu: function setSpeedMenu(options) {
|
||||
setSpeedMenu: function setSpeedMenu() {
|
||||
var _this8 = this;
|
||||
|
||||
// Menu required
|
||||
@ -8920,19 +8916,18 @@ var controls = {
|
||||
}
|
||||
|
||||
var type = 'speed';
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Set the speed options
|
||||
var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Determine options to display
|
||||
// Vimeo and YouTube limit to 0.5x-2x
|
||||
|
||||
if (is$1.array(options)) {
|
||||
this.options.speed = options;
|
||||
} else if (this.isHTML5 || this.isVimeo) {
|
||||
this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||
} // Set options if passed and filter based on config
|
||||
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
|
||||
|
||||
|
||||
this.options.speed = this.options.speed.filter(function (speed) {
|
||||
return _this8.config.speed.options.includes(speed);
|
||||
}); // 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
|
||||
|
||||
@ -9351,7 +9346,12 @@ var controls = {
|
||||
element: 'a',
|
||||
href: _this10.download,
|
||||
target: '_blank'
|
||||
});
|
||||
}); // Set download attribute for HTML5 only
|
||||
|
||||
|
||||
if (_this10.isHTML5) {
|
||||
_attributes.download = '';
|
||||
}
|
||||
|
||||
var download = _this10.config.urls.download;
|
||||
|
||||
@ -9970,12 +9970,13 @@ var defaults$1 = {
|
||||
// Sprite (for icons)
|
||||
loadSprite: true,
|
||||
iconPrefix: 'plyr',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7-beta.0/plyr.svg',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7/plyr.svg',
|
||||
// Blank video (used to prevent errors on source change)
|
||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||
// Quality default
|
||||
quality: {
|
||||
default: 576,
|
||||
// The options to display in the UI, if available for the source media
|
||||
options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
|
||||
forced: false,
|
||||
onChange: null
|
||||
@ -9989,7 +9990,8 @@ var defaults$1 = {
|
||||
// Speed default and options to display
|
||||
speed: {
|
||||
selected: 1,
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
|
||||
// The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
|
||||
options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
|
||||
},
|
||||
// Keyboard shortcut settings
|
||||
keyboard: {
|
||||
@ -10351,73 +10353,6 @@ function () {
|
||||
return Console;
|
||||
}();
|
||||
|
||||
function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true); // Trap focus in container
|
||||
|
||||
if (!browser.isIos) {
|
||||
trapFocus.call(this.player, this.target, this.active);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
onChange.call(this);
|
||||
}
|
||||
|
||||
var Fullscreen =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
@ -10442,7 +10377,7 @@ function () {
|
||||
|
||||
on.call(this.player, document, this.prefix === 'ms' ? 'MSFullscreenChange' : "".concat(this.prefix, "fullscreenchange"), function () {
|
||||
// TODO: Filter for target??
|
||||
onChange.call(_this);
|
||||
_this.onChange();
|
||||
}); // Fullscreen toggle on double click
|
||||
|
||||
on.call(this.player, this.player.elements.container, 'dblclick', function (event) {
|
||||
@ -10452,6 +10387,10 @@ function () {
|
||||
}
|
||||
|
||||
_this.toggle();
|
||||
}); // Tap focus when in fullscreen
|
||||
|
||||
on.call(this, this.player.elements.container, 'keydown', function (event) {
|
||||
return _this.trapFocus(event);
|
||||
}); // Update the UI
|
||||
|
||||
this.update();
|
||||
@ -10459,8 +10398,101 @@ function () {
|
||||
|
||||
|
||||
_createClass(Fullscreen, [{
|
||||
key: "onChange",
|
||||
value: function onChange() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
} // Update toggle button
|
||||
|
||||
|
||||
var button = this.player.elements.buttons.fullscreen;
|
||||
|
||||
if (is$1.element(button)) {
|
||||
button.pressed = this.active;
|
||||
} // Trigger an event
|
||||
|
||||
|
||||
triggerEvent.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true);
|
||||
}
|
||||
}, {
|
||||
key: "toggleFallback",
|
||||
value: function toggleFallback() {
|
||||
var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
|
||||
// Store or restore scroll position
|
||||
if (toggle) {
|
||||
this.scrollPosition = {
|
||||
x: window.scrollX || 0,
|
||||
y: window.scrollY || 0
|
||||
};
|
||||
} else {
|
||||
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
||||
} // Toggle scroll
|
||||
|
||||
|
||||
document.body.style.overflow = toggle ? 'hidden' : ''; // Toggle class hook
|
||||
|
||||
toggleClass(this.target, this.player.config.classNames.fullscreen.fallback, toggle); // Force full viewport on iPhone X+
|
||||
|
||||
if (browser.isIos) {
|
||||
var viewport = document.head.querySelector('meta[name="viewport"]');
|
||||
var property = 'viewport-fit=cover'; // Inject the viewport meta if required
|
||||
|
||||
if (!viewport) {
|
||||
viewport = document.createElement('meta');
|
||||
viewport.setAttribute('name', 'viewport');
|
||||
} // Check if the property already exists
|
||||
|
||||
|
||||
var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property);
|
||||
|
||||
if (toggle) {
|
||||
this.cleanupViewport = !hasProperty;
|
||||
|
||||
if (!hasProperty) {
|
||||
viewport.content += ",".concat(property);
|
||||
}
|
||||
} else if (this.cleanupViewport) {
|
||||
viewport.content = viewport.content.split(',').filter(function (part) {
|
||||
return part.trim() !== property;
|
||||
}).join(',');
|
||||
}
|
||||
} // Toggle button and fire events
|
||||
|
||||
|
||||
this.onChange();
|
||||
} // Trap focus inside container
|
||||
|
||||
}, {
|
||||
key: "trapFocus",
|
||||
value: function trapFocus(event) {
|
||||
// Bail if iOS, not active, not the tab key
|
||||
if (browser.isIos || !this.active || event.key !== 'Tab' || event.keyCode !== 9) {
|
||||
return;
|
||||
} // Get the current focused element
|
||||
|
||||
|
||||
var focused = document.activeElement;
|
||||
var focusable = getElements.call(this.player, 'a[href], button:not(:disabled), input:not(:disabled), [tabindex]');
|
||||
|
||||
var _focusable = _slicedToArray(focusable, 1),
|
||||
first = _focusable[0];
|
||||
|
||||
var last = focusable[focusable.length - 1];
|
||||
|
||||
if (focused === last && !event.shiftKey) {
|
||||
// Move focus to first element that can be tabbed if Shift isn't used
|
||||
first.focus();
|
||||
event.preventDefault();
|
||||
} else if (focused === first && event.shiftKey) {
|
||||
// Move focus to last element that can be tabbed if Shift is used
|
||||
last.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
} // Update UI
|
||||
|
||||
}, {
|
||||
key: "update",
|
||||
// Update UI
|
||||
value: function update() {
|
||||
if (this.enabled) {
|
||||
var mode;
|
||||
@ -10493,10 +10525,10 @@ function () {
|
||||
if (browser.isIos && this.player.config.fullscreen.iosNative) {
|
||||
this.target.webkitEnterFullscreen();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, true);
|
||||
this.toggleFallback(true);
|
||||
} else if (!this.prefix) {
|
||||
this.target.requestFullscreen({
|
||||
navigationUI: "hide"
|
||||
navigationUI: 'hide'
|
||||
});
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
this.target["".concat(this.prefix, "Request").concat(this.property)]();
|
||||
@ -10515,7 +10547,7 @@ function () {
|
||||
this.target.webkitExitFullscreen();
|
||||
this.player.play();
|
||||
} else if (!Fullscreen.native || this.forceFallback) {
|
||||
toggleFallback.call(this, false);
|
||||
this.toggleFallback(false);
|
||||
} else if (!this.prefix) {
|
||||
(document.cancelFullScreen || document.exitFullscreen).call(document);
|
||||
} else if (!is$1.empty(this.prefix)) {
|
||||
@ -11401,9 +11433,11 @@ function () {
|
||||
this.bind(elements.buttons.settings, 'click', function (event) {
|
||||
// Prevent the document click listener closing the menu
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
controls.toggleMenu.call(player, event);
|
||||
}); // Settings menu - keyboard toggle
|
||||
}, null, false); // Can't be passive as we're preventing default
|
||||
// Settings menu - keyboard toggle
|
||||
// We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
|
||||
|
||||
@ -11505,7 +11539,7 @@ function () {
|
||||
}
|
||||
}); // Hide thumbnail preview - on mouse click, mouse leave, and video play/seek. All four are required, e.g., for buffering
|
||||
|
||||
this.bind(elements.progress, 'mouseleave click', function () {
|
||||
this.bind(elements.progress, 'mouseleave touchend click', function () {
|
||||
var previewThumbnails = player.previewThumbnails;
|
||||
|
||||
if (previewThumbnails && previewThumbnails.loaded) {
|
||||
@ -11614,28 +11648,6 @@ function () {
|
||||
return Listeners;
|
||||
}();
|
||||
|
||||
var defineProperty$7 = objectDefineProperty.f;
|
||||
|
||||
var FunctionPrototype = Function.prototype;
|
||||
var FunctionPrototypeToString = FunctionPrototype.toString;
|
||||
var nameRE = /^\s*function ([^ (]*)/;
|
||||
var NAME = 'name';
|
||||
|
||||
// Function instances `.name` property
|
||||
// https://tc39.github.io/ecma262/#sec-function-instances-name
|
||||
if (descriptors && !(NAME in FunctionPrototype)) {
|
||||
defineProperty$7(FunctionPrototype, NAME, {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
try {
|
||||
return FunctionPrototypeToString.call(this).match(nameRE)[1];
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice');
|
||||
var USES_TO_LENGTH$a = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
|
||||
|
||||
@ -12164,11 +12176,6 @@ var vimeo = {
|
||||
player.embed.setPlaybackRate(input).then(function () {
|
||||
speed = input;
|
||||
triggerEvent.call(player, player.media, 'ratechange');
|
||||
}).catch(function (error) {
|
||||
// Hide menu item (and menu if empty)
|
||||
if (error.name === 'Error') {
|
||||
controls.setSpeedMenu.call(player, []);
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // Volume
|
||||
@ -13716,8 +13723,8 @@ function () {
|
||||
}, {
|
||||
key: "startScrubbing",
|
||||
value: function startScrubbing(event) {
|
||||
// Only act on left mouse button (0), or touch device (event.button is false)
|
||||
if (event.button === false || event.button === 0) {
|
||||
// Only act on left mouse button (0), or touch device (event.button does not exist or is false)
|
||||
if (is$1.nullOrUndefined(event.button) || event.button === false || event.button === 0) {
|
||||
this.mouseDown = true; // Wait until media has a duration
|
||||
|
||||
if (this.player.media.duration) {
|
||||
|
@ -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-beta.0/plyr.js"></script>
|
||||
<script src="https://cdn.plyr.io/3.5.7/plyr.js"></script>
|
||||
```
|
||||
|
||||
...or...
|
||||
|
||||
```html
|
||||
<script src="https://cdn.plyr.io/3.5.7-beta.0/plyr.polyfilled.js"></script>
|
||||
<script src="https://cdn.plyr.io/3.5.7/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-beta.0/plyr.css" />
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/3.5.7/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-beta.0/plyr.svg`.
|
||||
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.5.7/plyr.svg`.
|
||||
|
||||
# Ads
|
||||
|
||||
|
@ -61,7 +61,7 @@ const defaults = {
|
||||
// Sprite (for icons)
|
||||
loadSprite: true,
|
||||
iconPrefix: 'plyr',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7-beta.0/plyr.svg',
|
||||
iconUrl: 'https://cdn.plyr.io/3.5.7/plyr.svg',
|
||||
|
||||
// Blank video (used to prevent errors on source change)
|
||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||
|
@ -1,6 +1,6 @@
|
||||
// ==========================================================================
|
||||
// Plyr
|
||||
// plyr.js v3.5.7-beta.0
|
||||
// plyr.js v3.5.7
|
||||
// https://github.com/sampotts/plyr
|
||||
// License: The MIT License (MIT)
|
||||
// ==========================================================================
|
||||
|
@ -1,6 +1,6 @@
|
||||
// ==========================================================================
|
||||
// Plyr Polyfilled Build
|
||||
// plyr.js v3.5.7-beta.0
|
||||
// plyr.js v3.5.7
|
||||
// https://github.com/sampotts/plyr
|
||||
// License: The MIT License (MIT)
|
||||
// ==========================================================================
|
||||
|
143
yarn.lock
143
yarn.lock
@ -10,9 +10,9 @@
|
||||
"@babel/highlight" "^7.8.3"
|
||||
|
||||
"@babel/compat-data@^7.8.4":
|
||||
version "7.8.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.8.4.tgz#bbe65d05a291667a8394fe8a0e0e277ef22b0d2a"
|
||||
integrity sha512-lHLhlsvFjJAqNU71b7k6Vv9ewjmTXKvqaMv7n0G1etdCabWLw3nEYE8mmgoVOxMIFE07xOvo7H7XBASirX6Rrg==
|
||||
version "7.8.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.8.5.tgz#d28ce872778c23551cbb9432fc68d28495b613b9"
|
||||
integrity sha512-jWYUqQX/ObOhG1UiEkbH5SANsE/8oKXiQWjj7p7xgj9Zmnt//aUvyz4dBkK0HNsS8/cbyC5NmmH87VekW+mXFg==
|
||||
dependencies:
|
||||
browserslist "^4.8.5"
|
||||
invariant "^2.2.4"
|
||||
@ -810,9 +810,9 @@
|
||||
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
|
||||
|
||||
"@types/node@*":
|
||||
version "13.5.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.5.2.tgz#3de53b55fd39efc428a901a0f6db31f761cfa131"
|
||||
integrity sha512-Fr6a47c84PRLfd7M7u3/hEknyUdQrrBA6VoPmkze0tcflhU5UnpWEX2kn12ktA/lb+MNHSqFlSiPHIHsaErTPA==
|
||||
version "13.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.0.tgz#b417deda18cf8400f278733499ad5547ed1abec4"
|
||||
integrity sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ==
|
||||
|
||||
"@types/normalize-package-data@^2.4.0":
|
||||
version "2.4.0"
|
||||
@ -1362,7 +1362,7 @@ autoprefixer@^7.1.2:
|
||||
postcss "^6.0.17"
|
||||
postcss-value-parser "^3.2.3"
|
||||
|
||||
autoprefixer@^9.6.1, autoprefixer@^9.7.3:
|
||||
autoprefixer@^9.6.1, autoprefixer@^9.7.4:
|
||||
version "9.7.4"
|
||||
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.4.tgz#f8bf3e06707d047f0641d87aee8cfb174b2a5378"
|
||||
integrity sha512-g0Ya30YrMBAEZk60lp+qfX5YQllG+S5W3GYCFvyHTvhOki0AEQJLPEcIuGRsqVwLi8FvXPVtwTGhfr38hVpm0g==
|
||||
@ -1375,10 +1375,10 @@ autoprefixer@^9.6.1, autoprefixer@^9.7.3:
|
||||
postcss "^7.0.26"
|
||||
postcss-value-parser "^4.0.2"
|
||||
|
||||
aws-sdk@^2.389.0, aws-sdk@^2.610.0:
|
||||
version "2.610.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.610.0.tgz#a8633204bed83df763095824f8110ced4a717d2a"
|
||||
integrity sha512-kqcoCTKjbxrUo2KeLQR2Jw6l4PvkbHXSDk8KqF2hXcpHibiOcMXZZPVe9X+s90RC/B2+qU95M7FImp9ByMcw7A==
|
||||
aws-sdk@^2.389.0, aws-sdk@^2.614.0:
|
||||
version "2.614.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.614.0.tgz#e954824c1b9e566691a24ed8491ebf1d68350d37"
|
||||
integrity sha512-o7utaxDMo9ri1VyPKw8Kcmpy5uZOqMeok2cgur70iZ94zsLIRnHKrBv1wMBbyRGuUbfJRq76HGAS9QxdiSqQHw==
|
||||
dependencies:
|
||||
buffer "4.9.1"
|
||||
events "1.1.1"
|
||||
@ -1909,9 +1909,9 @@ camelcase@^5.0.0, camelcase@^5.3.1:
|
||||
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||
|
||||
caniuse-lite@^1.0.30000792, caniuse-lite@^1.0.30000805, caniuse-lite@^1.0.30001020, caniuse-lite@^1.0.30001023:
|
||||
version "1.0.30001023"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001023.tgz#b82155827f3f5009077bdd2df3d8968bcbcc6fc4"
|
||||
integrity sha512-C5TDMiYG11EOhVOA62W1p3UsJ2z4DsHtMBQtjzp3ZsUglcQn62WOUgW0y795c7A5uZ+GCEIvzkMatLIlAsbNTA==
|
||||
version "1.0.30001025"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001025.tgz#30336a8aca7f98618eb3cf38e35184e13d4e5fe6"
|
||||
integrity sha512-SKyFdHYfXUZf5V85+PJgLYyit27q4wgvZuf8QTOk1osbypcROihMBlx9GRar2/pIcKH2r4OehdlBr9x6PXetAQ==
|
||||
|
||||
capture-stack-trace@^1.0.0:
|
||||
version "1.0.1"
|
||||
@ -2991,9 +2991,9 @@ ee-first@1.1.1:
|
||||
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
|
||||
|
||||
electron-to-chromium@^1.3.30, electron-to-chromium@^1.3.341:
|
||||
version "1.3.344"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.344.tgz#f1397a633c35e726730c24be1084cd25c3ee8148"
|
||||
integrity sha512-tvbx2Wl8WBR+ym3u492D0L6/jH+8NoQXqe46+QhbWH3voVPauGuZYeb1QAXYoOAWuiP2dbSvlBx0kQ1F3hu/Mw==
|
||||
version "1.3.345"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.345.tgz#2569d0d54a64ef0f32a4b7e8c80afa5fe57c5d98"
|
||||
integrity sha512-f8nx53+Z9Y+SPWGg3YdHrbYYfIJAtbUjpFfW4X1RwTZ94iUG7geg9tV8HqzAXX7XTNgyWgAFvce4yce8ZKxKmg==
|
||||
|
||||
"emoji-regex@>=6.0.0 <=6.1.1":
|
||||
version "6.1.1"
|
||||
@ -3211,10 +3211,10 @@ eslint-module-utils@^2.4.1:
|
||||
debug "^2.6.9"
|
||||
pkg-dir "^2.0.0"
|
||||
|
||||
eslint-plugin-import@^2.20.0:
|
||||
version "2.20.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.0.tgz#d749a7263fb6c29980def8e960d380a6aa6aecaa"
|
||||
integrity sha512-NK42oA0mUc8Ngn4kONOPsPB1XhbUvNHqF+g307dPV28aknPoiNnKLFd9em4nkswwepdF5ouieqv5Th/63U7YJQ==
|
||||
eslint-plugin-import@^2.20.1:
|
||||
version "2.20.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3"
|
||||
integrity sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==
|
||||
dependencies:
|
||||
array-includes "^3.0.3"
|
||||
array.prototype.flat "^1.2.1"
|
||||
@ -5320,11 +5320,9 @@ is-extglob@^2.1.0, is-extglob@^2.1.1:
|
||||
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
|
||||
|
||||
is-finite@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa"
|
||||
integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=
|
||||
dependencies:
|
||||
number-is-nan "^1.0.0"
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.1.0.tgz#904135c77fb42c0641d6aa1bcdbc4daa8da082f3"
|
||||
integrity sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==
|
||||
|
||||
is-fullwidth-code-point@^1.0.0:
|
||||
version "1.0.0"
|
||||
@ -5815,10 +5813,10 @@ kind-of@^6.0.0, kind-of@^6.0.2:
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
|
||||
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
|
||||
|
||||
known-css-properties@^0.17.0:
|
||||
version "0.17.0"
|
||||
resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.17.0.tgz#1c535f530ee8e9e3e27bb6a718285780e1d07326"
|
||||
integrity sha512-Vi3nxDGMm/z+lAaCjvAR1u+7fiv+sG6gU/iYDj5QOF8h76ytK9EW/EKfF0NeTyiGBi8Jy6Hklty/vxISrLox3w==
|
||||
known-css-properties@^0.18.0:
|
||||
version "0.18.0"
|
||||
resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.18.0.tgz#d6e00b56ee1d5b0d171fd86df1583cfb012c521f"
|
||||
integrity sha512-69AgJ1rQa7VvUsd2kpvVq+VeObDuo3zrj0CzM5Slmf6yduQFAI2kXPDQJR2IE/u6MSAUOJrwSzjg5vlz8qcMiw==
|
||||
|
||||
known-css-properties@^0.5.0:
|
||||
version "0.5.0"
|
||||
@ -6279,7 +6277,7 @@ math-random@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c"
|
||||
integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==
|
||||
|
||||
mathml-tag-names@^2.0.1, mathml-tag-names@^2.1.1:
|
||||
mathml-tag-names@^2.0.1, mathml-tag-names@^2.1.3:
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3"
|
||||
integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==
|
||||
@ -6597,9 +6595,9 @@ natural-compare@^1.4.0:
|
||||
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
|
||||
|
||||
needle@^2.2.1:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c"
|
||||
integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/needle/-/needle-2.3.2.tgz#3342dea100b7160960a450dc8c22160ac712a528"
|
||||
integrity sha512-DUzITvPVDUy6vczKKYTnWc/pBZ0EnjMJnQ3y+Jo5zfKFimJs7S3HFCxCRZYB9FUZcrzUQr3WsmvZgddMEIZv6w==
|
||||
dependencies:
|
||||
debug "^3.2.6"
|
||||
iconv-lite "^0.4.4"
|
||||
@ -6662,9 +6660,9 @@ node-pre-gyp@*:
|
||||
tar "^4.4.2"
|
||||
|
||||
node-releases@^1.1.47:
|
||||
version "1.1.47"
|
||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.47.tgz#c59ef739a1fd7ecbd9f0b7cf5b7871e8a8b591e4"
|
||||
integrity sha512-k4xjVPx5FpwBUj0Gw7uvFOTF4Ep8Hok1I6qjwL3pLfwe7Y0REQSAqOwwv9TWBCUtMHxcXfY4PgRLRozcChvTcA==
|
||||
version "1.1.48"
|
||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.48.tgz#7f647f0c453a0495bcd64cbd4778c26035c2f03a"
|
||||
integrity sha512-Hr8BbmUl1ujAST0K0snItzEA5zkJTQup8VNTKNfT6Zw8vTJkIiagUPNfxHmgDOyfFYNfKAul40sD0UEYTvwebw==
|
||||
dependencies:
|
||||
semver "^6.3.0"
|
||||
|
||||
@ -7508,7 +7506,7 @@ postcss-html@^0.36.0:
|
||||
dependencies:
|
||||
htmlparser2 "^3.10.0"
|
||||
|
||||
postcss-jsx@^0.36.3:
|
||||
postcss-jsx@^0.36.4:
|
||||
version "0.36.4"
|
||||
resolved "https://registry.yarnpkg.com/postcss-jsx/-/postcss-jsx-0.36.4.tgz#37a68f300a39e5748d547f19a747b3257240bd50"
|
||||
integrity sha512-jwO/7qWUvYuWYnpOb0+4bIIgJt7003pgU3P6nETBLaOyBXuTD55ho21xnals5nBrlpTIFodyd3/jBi6UO3dHvA==
|
||||
@ -7583,11 +7581,11 @@ postcss-safe-parser@^3.0.1:
|
||||
postcss "^6.0.6"
|
||||
|
||||
postcss-safe-parser@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/postcss-safe-parser/-/postcss-safe-parser-4.0.1.tgz#8756d9e4c36fdce2c72b091bbc8ca176ab1fcdea"
|
||||
integrity sha512-xZsFA3uX8MO3yAda03QrG3/Eg1LN3EPfjjf07vke/46HERLZyHrTsQ9E1r1w1W//fWEhtYNndo2hQplN2cVpCQ==
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/postcss-safe-parser/-/postcss-safe-parser-4.0.2.tgz#a6d4e48f0f37d9f7c11b2a581bf00f8ba4870b96"
|
||||
integrity sha512-Uw6ekxSWNLCPesSv/cmqf2bY/77z11O7jZGPax3ycZMFU/oi2DMH9i89AdHc1tRwFg/arFoEwX0IS3LCUxJh1g==
|
||||
dependencies:
|
||||
postcss "^7.0.0"
|
||||
postcss "^7.0.26"
|
||||
|
||||
postcss-sass@^0.2.0:
|
||||
version "0.2.0"
|
||||
@ -7661,9 +7659,9 @@ postcss-value-parser@^4.0.2:
|
||||
integrity sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ==
|
||||
|
||||
postcss-values-parser@^3.0.5:
|
||||
version "3.0.5"
|
||||
resolved "https://registry.yarnpkg.com/postcss-values-parser/-/postcss-values-parser-3.0.5.tgz#9f83849fb89eaac74c2d5bf75e8e9715508a8c8d"
|
||||
integrity sha512-0N6EUBx2Vzl0c9LQipuus90EkVh7saBQFRhgAYpHHcDCIvxRt+K/q0zwcIYtDQVNs5Y9NGqei4AuCEvAOsePfQ==
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/postcss-values-parser/-/postcss-values-parser-3.1.1.tgz#487111a0446117d3463d2d429a380788f1365f69"
|
||||
integrity sha512-p56/Cu9wb8+lck/iOTeuFeSHKEUH1bbWQ03T6N3jDkw+15pV65rMY5pK+OWhVpRn5TIrByS6UVpO3mSqvlhZYA==
|
||||
dependencies:
|
||||
color-name "^1.1.4"
|
||||
is-number "^7.0.0"
|
||||
@ -8492,9 +8490,9 @@ resolve-url@^0.2.1:
|
||||
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
|
||||
|
||||
resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.3.2, resolve@^1.4.0:
|
||||
version "1.15.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.0.tgz#1b7ca96073ebb52e741ffd799f6b39ea462c67f5"
|
||||
integrity sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==
|
||||
version "1.15.1"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8"
|
||||
integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==
|
||||
dependencies:
|
||||
path-parse "^1.0.6"
|
||||
|
||||
@ -8554,9 +8552,9 @@ rimraf@2.6.3, rimraf@~2.6.2:
|
||||
glob "^7.1.3"
|
||||
|
||||
rimraf@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.1.tgz#48d3d4cb46c80d388ab26cd61b1b466ae9ae225a"
|
||||
integrity sha512-IQ4ikL8SjBiEDZfk+DFVwqRK8md24RWMEJkdSlgNLkyyAImcjf8SWvU1qFMDOb4igBClbTQ/ugPqXcRwdFTxZw==
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
|
||||
integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==
|
||||
dependencies:
|
||||
glob "^7.1.3"
|
||||
|
||||
@ -8597,10 +8595,10 @@ rollup-pluginutils@^2.8.1:
|
||||
dependencies:
|
||||
estree-walker "^0.6.1"
|
||||
|
||||
rollup@^1.30.1:
|
||||
version "1.30.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.30.1.tgz#3fd28d6198beb2f3cd1640732047d5ec16c2d3a0"
|
||||
integrity sha512-Uus8mwQXwaO+ZVoNwBcXKhT0AvycFCBW/W8VZtkpVGsotRllWk9oldfCjqWmTnFRI0y7x6BnEqSqc65N+/YdBw==
|
||||
rollup@^1.31.0:
|
||||
version "1.31.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.31.0.tgz#e2a87212e96aa7850f3eb53fdd02cf89f2d2fe9a"
|
||||
integrity sha512-9C6ovSyNeEwvuRuUUmsTpJcXac1AwSL1a3x+O5lpmQKZqi5mmrjauLeqIjvREC+yNRR8fPdzByojDng+af3nVw==
|
||||
dependencies:
|
||||
"@types/estree" "*"
|
||||
"@types/node" "*"
|
||||
@ -9388,23 +9386,14 @@ stylelint-config-recommended@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-3.0.0.tgz#e0e547434016c5539fe2650afd58049a2fd1d657"
|
||||
integrity sha512-F6yTRuc06xr1h5Qw/ykb2LuFynJ2IxkKfCMf+1xqPffkxh0S09Zc902XCffcsw/XMFq/OzQ1w54fLIDtmRNHnQ==
|
||||
|
||||
stylelint-config-sass-guidelines@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/stylelint-config-sass-guidelines/-/stylelint-config-sass-guidelines-6.2.0.tgz#f71f2b4341b7dc64c6404bd12ef9c2b91512046c"
|
||||
integrity sha512-weTmQt+D/qp9t3gPMgvdtu02W07m5pEKXFXnz7Jb0I85W02IxPSBVpaAu2mibvU0wk5e3McasEnHut5UuwXE/Q==
|
||||
stylelint-config-sass-guidelines@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/stylelint-config-sass-guidelines/-/stylelint-config-sass-guidelines-7.0.0.tgz#ad94d9ed78731aba3b67c3cf31d5fc644523a4be"
|
||||
integrity sha512-nWO8gtxv8T+UbAw7iM0RQp6VC3iJgOvqEIeqFBgHW+KgpZu65lYoe9Bf0fqvqxKJ/ngBD+/65BT3ql2u+7Qasg==
|
||||
dependencies:
|
||||
stylelint-order "^3.0.0"
|
||||
stylelint-order "^4.0.0"
|
||||
stylelint-scss "^3.4.0"
|
||||
|
||||
stylelint-order@^3.0.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-3.1.1.tgz#ba9ea6844d1482f97f31204e7c9605c7b792c294"
|
||||
integrity sha512-4gP/r8j/6JGZ/LL41b2sYtQqfwZl4VSqTp7WeIwI67v/OXNQ08dnn64BGXNwAUSgb2+YIvIOxQaMzqMyQMzoyQ==
|
||||
dependencies:
|
||||
lodash "^4.17.15"
|
||||
postcss "^7.0.17"
|
||||
postcss-sorting "^5.0.1"
|
||||
|
||||
stylelint-order@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-4.0.0.tgz#2a945c2198caac3ff44687d7c8582c81d044b556"
|
||||
@ -9435,12 +9424,12 @@ stylelint-selector-bem-pattern@^2.1.0:
|
||||
postcss-bem-linter "^3.0.0"
|
||||
stylelint ">=3.0.2"
|
||||
|
||||
stylelint@>=3.0.2, stylelint@^13.0.0:
|
||||
version "13.0.0"
|
||||
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.0.0.tgz#532007f7154c1a5ed14245d857a5884316f5111f"
|
||||
integrity sha512-6sjgOJbM3iLhnUtmRO0J1vvxie9VnhIZX/2fCehjylv9Gl9u0ytehGCTm9Lhw2p1F8yaNZn5UprvhCB8C3g/Tg==
|
||||
stylelint@>=3.0.2, stylelint@^13.1.0:
|
||||
version "13.1.0"
|
||||
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.1.0.tgz#693fca947873ff34c92bf08cdaa6f3db1cac91e2"
|
||||
integrity sha512-Ei+nCSQTyZYrsLSUIxq48/QfzCQD9r9sQiBqy7Z4IpIMcj+E0R6b0CHrSFeE7jNgREpBfJKJd6DpstuDrwUiew==
|
||||
dependencies:
|
||||
autoprefixer "^9.7.3"
|
||||
autoprefixer "^9.7.4"
|
||||
balanced-match "^1.0.0"
|
||||
chalk "^3.0.0"
|
||||
cosmiconfig "^6.0.0"
|
||||
@ -9455,17 +9444,17 @@ stylelint@>=3.0.2, stylelint@^13.0.0:
|
||||
ignore "^5.1.4"
|
||||
import-lazy "^4.0.0"
|
||||
imurmurhash "^0.1.4"
|
||||
known-css-properties "^0.17.0"
|
||||
known-css-properties "^0.18.0"
|
||||
leven "^3.1.0"
|
||||
lodash "^4.17.15"
|
||||
log-symbols "^3.0.0"
|
||||
mathml-tag-names "^2.1.1"
|
||||
mathml-tag-names "^2.1.3"
|
||||
meow "^6.0.0"
|
||||
micromatch "^4.0.2"
|
||||
normalize-selector "^0.2.0"
|
||||
postcss "^7.0.26"
|
||||
postcss-html "^0.36.0"
|
||||
postcss-jsx "^0.36.3"
|
||||
postcss-jsx "^0.36.4"
|
||||
postcss-less "^3.1.4"
|
||||
postcss-markdown "^0.36.0"
|
||||
postcss-media-query-parser "^0.2.3"
|
||||
|
Loading…
x
Reference in New Issue
Block a user