diff options
Diffstat (limited to 'dist/plyr.polyfilled.js')
-rw-r--r-- | dist/plyr.polyfilled.js | 828 |
1 files changed, 552 insertions, 276 deletions
diff --git a/dist/plyr.polyfilled.js b/dist/plyr.polyfilled.js index d80d56ab..ec69eaa9 100644 --- a/dist/plyr.polyfilled.js +++ b/dist/plyr.polyfilled.js @@ -2602,6 +2602,280 @@ typeof navigator === "object" && (function (global, factory) { } }); + const defaults = { + addCSS: true, // Add CSS to the element to improve usability (required here or in your CSS!) + thumbWidth: 15, // The width of the thumb handle + watch: true, // Watch for new elements that match a string target + }; + + // Element matches a selector + function matches(element, selector) { + + function match() { + return Array.from(document.querySelectorAll(selector)).includes(this); + } + + const matches = + match; + + return matches.call(element, selector); + } + + // Trigger event + function trigger(element, type) { + if (!element || !type) { + return; + } + + // Create and dispatch the event + const event = new Event(type); + + // Dispatch the event + element.dispatchEvent(event); + } + + // ========================================================================== + // Type checking utils + // ========================================================================== + + const getConstructor = input => (input !== null && typeof input !== 'undefined' ? input.constructor : null); + const instanceOf = (input, constructor) => Boolean(input && constructor && input instanceof constructor); + + const isNullOrUndefined = input => input === null || typeof input === 'undefined'; + const isObject = input => getConstructor(input) === Object; + const isNumber = input => getConstructor(input) === Number && !Number.isNaN(input); + const isString = input => getConstructor(input) === String; + const isBoolean = input => getConstructor(input) === Boolean; + const isFunction = input => getConstructor(input) === Function; + const isArray = input => Array.isArray(input); + const isNodeList = input => instanceOf(input, NodeList); + const isElement = input => instanceOf(input, Element); + const isEvent = input => instanceOf(input, Event); + const isEmpty = input => + isNullOrUndefined(input) || + ((isString(input) || isArray(input) || isNodeList(input)) && !input.length) || + (isObject(input) && !Object.keys(input).length); + + var is$1 = { + nullOrUndefined: isNullOrUndefined, + object: isObject, + number: isNumber, + string: isString, + boolean: isBoolean, + function: isFunction, + array: isArray, + nodeList: isNodeList, + element: isElement, + event: isEvent, + empty: isEmpty, + }; + + // Get the number of decimal places + function getDecimalPlaces(value) { + const match = `${value}`.match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); + + if (!match) { + return 0; + } + + return Math.max( + 0, + // Number of digits right of decimal point. + (match[1] ? match[1].length : 0) - + // Adjust for scientific notation. + (match[2] ? +match[2] : 0), + ); + } + + // Round to the nearest step + function round(number, step) { + if (step < 1) { + const places = getDecimalPlaces(step); + return parseFloat(number.toFixed(places)); + } + return Math.round(number / step) * step; + } + + // ========================================================================== + + class RangeTouch { + /** + * Setup a new instance + * @param {String|Element} target + * @param {Object} options + */ + constructor(target, options) { + if (is$1.element(target)) { + // An Element is passed, use it directly + this.element = target; + } else if (is$1.string(target)) { + // A CSS Selector is passed, fetch it from the DOM + this.element = document.querySelector(target); + } + + if (!is$1.element(this.element) || !is$1.empty(this.element.rangeTouch)) { + return; + } + + this.config = Object.assign({}, defaults, options); + + this.init(); + } + + static get enabled() { + return 'ontouchstart' in document.documentElement; + } + + /** + * Setup multiple instances + * @param {String|Element|NodeList|Array} target + * @param {Object} options + */ + static setup(target, options = {}) { + let targets = null; + + if (is$1.empty(target) || is$1.string(target)) { + targets = Array.from(document.querySelectorAll(is$1.string(target) ? target : 'input[type="range"]')); + } else if (is$1.element(target)) { + targets = [target]; + } else if (is$1.nodeList(target)) { + targets = Array.from(target); + } else if (is$1.array(target)) { + targets = target.filter(is$1.element); + } + + if (is$1.empty(targets)) { + return null; + } + + const config = Object.assign({}, defaults, options); + + if (is$1.string(target) && config.watch) { + // Create an observer instance + const observer = new MutationObserver(mutations => { + Array.from(mutations).forEach(mutation => { + Array.from(mutation.addedNodes).forEach(node => { + if (!is$1.element(node) || !matches(node, target)) { + return; + } + + // eslint-disable-next-line no-unused-vars + const range = new RangeTouch(node, config); + }); + }); + }); + + // Pass in the target node, as well as the observer options + observer.observe(document.body, { + childList: true, + subtree: true, + }); + } + + return targets.map(t => new RangeTouch(t, options)); + } + + init() { + // Bail if not a touch enabled device + if (!RangeTouch.enabled) { + return; + } + + // Add useful CSS + if (this.config.addCSS) { + // TODO: Restore original values on destroy + this.element.style.userSelect = 'none'; + this.element.style.webKitUserSelect = 'none'; + this.element.style.touchAction = 'manipulation'; + } + + this.listeners(true); + + this.element.rangeTouch = this; + } + + destroy() { + // Bail if not a touch enabled device + if (!RangeTouch.enabled) { + return; + } + + this.listeners(false); + + this.element.rangeTouch = null; + } + + listeners(toggle) { + const method = toggle ? 'addEventListener' : 'removeEventListener'; + + // Listen for events + ['touchstart', 'touchmove', 'touchend'].forEach(type => { + this.element[method](type, event => this.set(event), false); + }); + } + + /** + * Get the value based on touch position + * @param {Event} event + */ + get(event) { + if (!RangeTouch.enabled || !is$1.event(event)) { + return null; + } + + const input = event.target; + const touch = event.changedTouches[0]; + const min = parseFloat(input.getAttribute('min')) || 0; + const max = parseFloat(input.getAttribute('max')) || 100; + const step = parseFloat(input.getAttribute('step')) || 1; + const delta = max - min; + + // Calculate percentage + let percent; + const clientRect = input.getBoundingClientRect(); + const thumbWidth = ((100 / clientRect.width) * (this.config.thumbWidth / 2)) / 100; + + // Determine left percentage + percent = (100 / clientRect.width) * (touch.clientX - clientRect.left); + + // Don't allow outside bounds + if (percent < 0) { + percent = 0; + } else if (percent > 100) { + percent = 100; + } + + // Factor in the thumb offset + if (percent < 50) { + percent -= (100 - percent * 2) * thumbWidth; + } else if (percent > 50) { + percent += (percent - 50) * 2 * thumbWidth; + } + + // Find the closest step to the mouse position + return min + round(delta * (percent / 100), step); + } + + /** + * Update range value based on position + * @param {Event} event + */ + set(event) { + if (!RangeTouch.enabled || !is$1.event(event) || event.target.disabled) { + return; + } + + // Prevent text highlight on iOS + event.preventDefault(); + + // Set value + event.target.value = this.get(event); + + // Trigger event + trigger(event.target, event.type === 'touchend' ? 'change' : 'input'); + } + } + // fast apply, http://jsperf.lnkit.com/fast-apply/5 var _invoke = function (fn, args, that) { var un = that === undefined; @@ -3124,90 +3398,90 @@ typeof navigator === "object" && (function (global, factory) { // ========================================================================== // Type checking utils // ========================================================================== - var getConstructor = function getConstructor(input) { + var getConstructor$1 = function getConstructor(input) { return input !== null && typeof input !== 'undefined' ? input.constructor : null; }; - var instanceOf = function instanceOf(input, constructor) { + var instanceOf$1 = function instanceOf(input, constructor) { return Boolean(input && constructor && input instanceof constructor); }; - var isNullOrUndefined = function isNullOrUndefined(input) { + var isNullOrUndefined$1 = function isNullOrUndefined(input) { return input === null || typeof input === 'undefined'; }; - var isObject = function isObject(input) { - return getConstructor(input) === Object; + var isObject$1 = function isObject(input) { + return getConstructor$1(input) === Object; }; - var isNumber = function isNumber(input) { - return getConstructor(input) === Number && !Number.isNaN(input); + var isNumber$1 = function isNumber(input) { + return getConstructor$1(input) === Number && !Number.isNaN(input); }; - var isString = function isString(input) { - return getConstructor(input) === String; + var isString$1 = function isString(input) { + return getConstructor$1(input) === String; }; - var isBoolean = function isBoolean(input) { - return getConstructor(input) === Boolean; + var isBoolean$1 = function isBoolean(input) { + return getConstructor$1(input) === Boolean; }; - var isFunction = function isFunction(input) { - return getConstructor(input) === Function; + var isFunction$1 = function isFunction(input) { + return getConstructor$1(input) === Function; }; - var isArray = function isArray(input) { + var isArray$1 = function isArray(input) { return Array.isArray(input); }; var isWeakMap = function isWeakMap(input) { - return instanceOf(input, WeakMap); + return instanceOf$1(input, WeakMap); }; - var isNodeList = function isNodeList(input) { - return instanceOf(input, NodeList); + var isNodeList$1 = function isNodeList(input) { + return instanceOf$1(input, NodeList); }; - var isElement = function isElement(input) { - return instanceOf(input, Element); + var isElement$1 = function isElement(input) { + return instanceOf$1(input, Element); }; var isTextNode = function isTextNode(input) { - return getConstructor(input) === Text; + return getConstructor$1(input) === Text; }; - var isEvent = function isEvent(input) { - return instanceOf(input, Event); + var isEvent$1 = function isEvent(input) { + return instanceOf$1(input, Event); }; var isKeyboardEvent = function isKeyboardEvent(input) { - return instanceOf(input, KeyboardEvent); + return instanceOf$1(input, KeyboardEvent); }; var isCue = function isCue(input) { - return instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue); + return instanceOf$1(input, window.TextTrackCue) || instanceOf$1(input, window.VTTCue); }; var isTrack = function isTrack(input) { - return instanceOf(input, TextTrack) || !isNullOrUndefined(input) && isString(input.kind); + return instanceOf$1(input, TextTrack) || !isNullOrUndefined$1(input) && isString$1(input.kind); }; var isPromise = function isPromise(input) { - return instanceOf(input, Promise); + return instanceOf$1(input, Promise); }; - var isEmpty = function isEmpty(input) { - return isNullOrUndefined(input) || (isString(input) || isArray(input) || isNodeList(input)) && !input.length || isObject(input) && !Object.keys(input).length; + var isEmpty$1 = function isEmpty(input) { + return isNullOrUndefined$1(input) || (isString$1(input) || isArray$1(input) || isNodeList$1(input)) && !input.length || isObject$1(input) && !Object.keys(input).length; }; var isUrl = function isUrl(input) { // Accept a URL object - if (instanceOf(input, window.URL)) { + if (instanceOf$1(input, window.URL)) { return true; } // Must be string from here - if (!isString(input)) { + if (!isString$1(input)) { return false; } // Add the protocol if required @@ -3219,31 +3493,31 @@ typeof navigator === "object" && (function (global, factory) { } try { - return !isEmpty(new URL(string).hostname); + return !isEmpty$1(new URL(string).hostname); } catch (e) { return false; } }; - var is$1 = { - nullOrUndefined: isNullOrUndefined, - object: isObject, - number: isNumber, - string: isString, - boolean: isBoolean, - function: isFunction, - array: isArray, + var is$2 = { + nullOrUndefined: isNullOrUndefined$1, + object: isObject$1, + number: isNumber$1, + string: isString$1, + boolean: isBoolean$1, + function: isFunction$1, + array: isArray$1, weakMap: isWeakMap, - nodeList: isNodeList, - element: isElement, + nodeList: isNodeList$1, + element: isElement$1, textNode: isTextNode, - event: isEvent, + event: isEvent$1, keyboardEvent: isKeyboardEvent, cue: isCue, track: isTrack, promise: isPromise, url: isUrl, - empty: isEmpty + empty: isEmpty$1 }; // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md @@ -3277,7 +3551,7 @@ typeof navigator === "object" && (function (global, factory) { 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)) { + if (!element || !('addEventListener' in element) || is$2.empty(event) || !is$2.function(callback)) { return; } // Allow multiple events @@ -3355,7 +3629,7 @@ typeof navigator === "object" && (function (global, factory) { var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; // Bail if no element - if (!is$1.element(element) || is$1.empty(type)) { + if (!is$2.element(element) || is$2.empty(type)) { return; } // Create and dispatch the event @@ -3416,7 +3690,7 @@ typeof navigator === "object" && (function (global, factory) { } // Set attributes function setAttributes(element, attributes) { - if (!is$1.element(element) || is$1.empty(attributes)) { + if (!is$2.element(element) || is$2.empty(attributes)) { return; } // Assume null and undefined attributes should be left out, // Setting them would otherwise convert them to "null" and "undefined" @@ -3426,7 +3700,7 @@ typeof navigator === "object" && (function (global, factory) { var _ref2 = _slicedToArray(_ref, 2), value = _ref2[1]; - return !is$1.nullOrUndefined(value); + return !is$2.nullOrUndefined(value); }).forEach(function (_ref3) { var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], @@ -3440,12 +3714,12 @@ typeof navigator === "object" && (function (global, factory) { // Create a new <element> var element = document.createElement(type); // Set all passed attributes - if (is$1.object(attributes)) { + if (is$2.object(attributes)) { setAttributes(element, attributes); } // Add text node - if (is$1.string(text)) { + if (is$2.string(text)) { element.innerText = text; } // Return built element @@ -3454,7 +3728,7 @@ typeof navigator === "object" && (function (global, factory) { } // Inaert an element after another function insertAfter(element, target) { - if (!is$1.element(element) || !is$1.element(target)) { + if (!is$2.element(element) || !is$2.element(target)) { return; } @@ -3462,7 +3736,7 @@ typeof navigator === "object" && (function (global, factory) { } // Insert a DocumentFragment function insertElement(type, parent, attributes, text) { - if (!is$1.element(parent)) { + if (!is$2.element(parent)) { return; } @@ -3470,12 +3744,12 @@ typeof navigator === "object" && (function (global, factory) { } // Remove element(s) function removeElement(element) { - if (is$1.nodeList(element) || is$1.array(element)) { + if (is$2.nodeList(element) || is$2.array(element)) { Array.from(element).forEach(removeElement); return; } - if (!is$1.element(element) || !is$1.element(element.parentNode)) { + if (!is$2.element(element) || !is$2.element(element.parentNode)) { return; } @@ -3483,7 +3757,7 @@ typeof navigator === "object" && (function (global, factory) { } // Remove all child elements function emptyElement(element) { - if (!is$1.element(element)) { + if (!is$2.element(element)) { return; } @@ -3496,7 +3770,7 @@ typeof navigator === "object" && (function (global, factory) { } // Replace element function replaceElement(newChild, oldChild) { - if (!is$1.element(oldChild) || !is$1.element(oldChild.parentNode) || !is$1.element(newChild)) { + if (!is$2.element(oldChild) || !is$2.element(oldChild.parentNode) || !is$2.element(newChild)) { return null; } @@ -3509,7 +3783,7 @@ typeof navigator === "object" && (function (global, factory) { // '.test' to { class: 'test' } // '#test' to { id: 'test' } // '[data-test="test"]' to { 'data-test': 'test' } - if (!is$1.string(sel) || is$1.empty(sel)) { + if (!is$2.string(sel) || is$2.empty(sel)) { return {}; } @@ -3530,7 +3804,7 @@ typeof navigator === "object" && (function (global, factory) { switch (start) { case '.': // Add to existing classname - if (is$1.object(existing) && is$1.string(existing.class)) { + if (is$2.object(existing) && is$2.string(existing.class)) { existing.class += " ".concat(className); } @@ -3555,13 +3829,13 @@ typeof navigator === "object" && (function (global, factory) { } // Toggle hidden function toggleHidden(element, hidden) { - if (!is$1.element(element)) { + if (!is$2.element(element)) { return; } var hide = hidden; - if (!is$1.boolean(hide)) { + if (!is$2.boolean(hide)) { hide = !element.hidden; } @@ -3573,13 +3847,13 @@ typeof navigator === "object" && (function (global, factory) { } // Mirror Element.classList.toggle, with IE compatibility for "force" argument function toggleClass(element, className, force) { - if (is$1.nodeList(element)) { + if (is$2.nodeList(element)) { return Array.from(element).map(function (e) { return toggleClass(e, className, force); }); } - if (is$1.element(element)) { + if (is$2.element(element)) { var method = 'toggle'; if (typeof force !== 'undefined') { @@ -3594,10 +3868,10 @@ typeof navigator === "object" && (function (global, factory) { } // Has class name function hasClass(element, className) { - return is$1.element(element) && element.classList.contains(className); + return is$2.element(element) && element.classList.contains(className); } // Element matches selector - function matches(element, selector) { + function matches$1(element, selector) { function match() { return Array.from(document.querySelectorAll(selector)).includes(this); @@ -3619,7 +3893,7 @@ typeof navigator === "object" && (function (global, factory) { 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)) { + if (!is$2.element(element)) { return; } @@ -3654,7 +3928,7 @@ typeof navigator === "object" && (function (global, factory) { var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - if (!is$1.element(element)) { + if (!is$2.element(element)) { return; } // Set regular focus @@ -3679,7 +3953,7 @@ typeof navigator === "object" && (function (global, factory) { var type = Object.keys(events).find(function (event) { return element.style[event] !== undefined; }); - return is$1.string(type) ? events[type] : false; + return is$2.string(type) ? events[type] : false; }(); // Force repaint of element function repaint(element) { @@ -3740,7 +4014,7 @@ typeof navigator === "object" && (function (global, factory) { // https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls - if (is$1.function(createElement('video').webkitSetPresentationMode)) { + if (is$2.function(createElement('video').webkitSetPresentationMode)) { return true; } // Chrome // https://developers.google.com/web/updates/2018/10/watch-video-using-picture-in-picture @@ -3754,7 +4028,7 @@ typeof navigator === "object" && (function (global, factory) { }(), // Airplay support // Safari only currently - airplay: is$1.function(window.WebKitPlaybackTargetAvailabilityEvent), + airplay: is$2.function(window.WebKitPlaybackTargetAvailabilityEvent), // Inline playback support // https://webkit.org/blog/6784/new-video-policies-for-ios/ playsinline: 'playsInline' in document.createElement('video'), @@ -3762,7 +4036,7 @@ typeof navigator === "object" && (function (global, factory) { // Credits: http://diveintohtml5.info/everything.html // Related: http://www.leanbackplayer.com/test/h5mt.html mime: function mime(input) { - if (is$1.empty(input)) { + if (is$2.empty(input)) { return false; } @@ -3818,7 +4092,7 @@ typeof navigator === "object" && (function (global, factory) { return sources.filter(function (source) { var type = source.getAttribute('type'); - if (is$1.empty(type)) { + if (is$2.empty(type)) { return true; } @@ -3915,7 +4189,7 @@ typeof navigator === "object" && (function (global, factory) { // ========================================================================== function dedupe(array) { - if (!is$1.array(array)) { + if (!is$2.array(array)) { return array; } @@ -3925,7 +4199,7 @@ typeof navigator === "object" && (function (global, factory) { } // Get the closest value in an array function closest(array, value) { - if (!is$1.array(array) || !array.length) { + if (!is$2.array(array) || !array.length) { return null; } @@ -3957,12 +4231,12 @@ typeof navigator === "object" && (function (global, factory) { var source = sources.shift(); - if (!is$1.object(source)) { + if (!is$2.object(source)) { return target; } Object.keys(source).forEach(function (key) { - if (is$1.object(source[key])) { + if (is$2.object(source[key])) { if (!Object.keys(target).includes(key)) { Object.assign(target, _defineProperty({}, key, {})); } @@ -4026,7 +4300,7 @@ typeof navigator === "object" && (function (global, factory) { args[_key - 1] = arguments[_key]; } - if (is$1.empty(input)) { + if (is$2.empty(input)) { return input; } @@ -4105,13 +4379,13 @@ typeof navigator === "object" && (function (global, factory) { var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (is$1.empty(key) || is$1.empty(config)) { + if (is$2.empty(key) || is$2.empty(config)) { return ''; } var string = getDeep(config.i18n, key); - if (is$1.empty(string)) { + if (is$2.empty(string)) { if (Object.keys(resources).includes(key)) { return resources[key]; } @@ -4154,12 +4428,12 @@ typeof navigator === "object" && (function (global, factory) { var store = window.localStorage.getItem(this.key); - if (is$1.empty(store)) { + if (is$2.empty(store)) { return null; } var json = JSON.parse(store); - return is$1.string(key) && key.length ? json[key] : json; + return is$2.string(key) && key.length ? json[key] : json; } }, { key: "set", @@ -4170,14 +4444,14 @@ typeof navigator === "object" && (function (global, factory) { } // Can only store objectst - if (!is$1.object(object)) { + if (!is$2.object(object)) { return; } // Get current storage var storage = this.get(); // Default to empty object - if (is$1.empty(storage)) { + if (is$2.empty(storage)) { storage = {}; } // Update the working copy of the values @@ -4250,12 +4524,12 @@ typeof navigator === "object" && (function (global, factory) { // ========================================================================== function loadSprite(url, id) { - if (!is$1.string(url)) { + if (!is$2.string(url)) { return; } var prefix = 'cache'; - var hasId = is$1.string(id); + var hasId = is$2.string(id); var isCached = false; var exists = function exists() { @@ -4297,7 +4571,7 @@ typeof navigator === "object" && (function (global, factory) { fetch(url).then(function (result) { - if (is$1.empty(result)) { + if (is$2.empty(result)) { return; } @@ -4337,7 +4611,7 @@ typeof navigator === "object" && (function (global, factory) { var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; // Bail if the value isn't a number - if (!is$1.number(time)) { + if (!is$2.number(time)) { return formatTime(null, displayHours, inverted); } // Format time component to add leading zero @@ -4403,7 +4677,7 @@ typeof navigator === "object" && (function (global, factory) { duration: getElement.call(this, this.config.selectors.display.duration) }; // Seek tooltip - if (is$1.element(this.elements.progress)) { + if (is$2.element(this.elements.progress)) { this.elements.display.seekTooltip = this.elements.progress.querySelector(".".concat(this.config.classNames.tooltip)); } @@ -4454,7 +4728,7 @@ typeof navigator === "object" && (function (global, factory) { }, // Create a badge createBadge: function createBadge(text) { - if (is$1.empty(text)) { + if (is$2.empty(text)) { return null; } @@ -4540,11 +4814,11 @@ typeof navigator === "object" && (function (global, factory) { break; default: - if (is$1.empty(props.label)) { + if (is$2.empty(props.label)) { props.label = type; } - if (is$1.empty(props.icon)) { + if (is$2.empty(props.icon)) { props.icon = buttonType; } @@ -4577,7 +4851,7 @@ typeof navigator === "object" && (function (global, factory) { setAttributes(button, attributes); // We have multiple play buttons if (type === 'play') { - if (!is$1.array(this.elements.buttons[type])) { + if (!is$2.array(this.elements.buttons[type])) { this.elements.buttons[type] = []; } @@ -4607,7 +4881,9 @@ typeof navigator === "object" && (function (global, factory) { }, attributes)); this.elements.inputs[type] = input; // Set the fill for webkit now - controls.updateRangeFill.call(this, input); + controls.updateRangeFill.call(this, input); // Improve support on touch devices + + RangeTouch.setup(input); return input; }, // Create a <progress> @@ -4665,7 +4941,7 @@ typeof navigator === "object" && (function (global, factory) { return; } - var isRadioButton = matches(menuItem, '[role="menuitemradio"]'); // Show the respective menu + var isRadioButton = matches$1(menuItem, '[role="menuitemradio"]'); // Show the respective menu if (!isRadioButton && [32, 39].includes(event.which)) { controls.showMenuPanel.call(_this, type, true); @@ -4676,13 +4952,13 @@ typeof navigator === "object" && (function (global, factory) { if (event.which === 40 || isRadioButton && event.which === 39) { target = menuItem.nextElementSibling; - if (!is$1.element(target)) { + if (!is$2.element(target)) { target = menuItem.parentNode.firstElementChild; } } else { target = menuItem.previousElementSibling; - if (!is$1.element(target)) { + if (!is$2.element(target)) { target = menuItem.parentNode.lastElementChild; } } @@ -4725,7 +5001,7 @@ typeof navigator === "object" && (function (global, factory) { flex.innerHTML = title; - if (is$1.element(badge)) { + if (is$2.element(badge)) { flex.appendChild(badge); } @@ -4740,7 +5016,7 @@ typeof navigator === "object" && (function (global, factory) { // Ensure exclusivity if (checked) { Array.from(menuItem.parentNode.children).filter(function (node) { - return matches(node, '[role="menuitemradio"]'); + return matches$1(node, '[role="menuitemradio"]'); }).forEach(function (node) { return node.setAttribute('aria-checked', 'false'); }); @@ -4750,7 +5026,7 @@ typeof navigator === "object" && (function (global, factory) { } }); this.listeners.bind(menuItem, 'click keyup', function (event) { - if (is$1.keyboardEvent(event) && event.which !== 32) { + if (is$2.keyboardEvent(event) && event.which !== 32) { return; } @@ -4775,7 +5051,7 @@ typeof navigator === "object" && (function (global, factory) { break; } - controls.showMenuPanel.call(_this2, 'home', is$1.keyboardEvent(event)); + controls.showMenuPanel.call(_this2, 'home', is$2.keyboardEvent(event)); }, type, false); controls.bindMenuItemShortcuts.call(this, menuItem, type); list.appendChild(menuItem); @@ -4786,7 +5062,7 @@ typeof navigator === "object" && (function (global, factory) { var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; // Bail if the value isn't a number - if (!is$1.number(time)) { + if (!is$2.number(time)) { return time; } // Always display hours if duration is over an hour @@ -4801,7 +5077,7 @@ typeof navigator === "object" && (function (global, factory) { var inverted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; // Bail if there's no element to display or the value isn't a number - if (!is$1.element(target) || !is$1.number(time)) { + if (!is$2.element(target) || !is$2.number(time)) { return; } // eslint-disable-next-line no-param-reassign @@ -4815,12 +5091,12 @@ typeof navigator === "object" && (function (global, factory) { } // Update range - if (is$1.element(this.elements.inputs.volume)) { + if (is$2.element(this.elements.inputs.volume)) { controls.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume); } // Update mute state - if (is$1.element(this.elements.buttons.mute)) { + if (is$2.element(this.elements.buttons.mute)) { this.elements.buttons.mute.pressed = this.muted || this.volume === 0; } }, @@ -4828,7 +5104,7 @@ typeof navigator === "object" && (function (global, factory) { setRange: function setRange(target) { var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - if (!is$1.element(target)) { + if (!is$2.element(target)) { return; } // eslint-disable-next-line @@ -4841,22 +5117,22 @@ typeof navigator === "object" && (function (global, factory) { updateProgress: function updateProgress(event) { var _this3 = this; - if (!this.supported.ui || !is$1.event(event)) { + if (!this.supported.ui || !is$2.event(event)) { return; } var value = 0; var setProgress = function setProgress(target, input) { - var value = is$1.number(input) ? input : 0; - var progress = is$1.element(target) ? target : _this3.elements.display.buffer; // Update value and label + var value = is$2.number(input) ? input : 0; + var progress = is$2.element(target) ? target : _this3.elements.display.buffer; // Update value and label - if (is$1.element(progress)) { + if (is$2.element(progress)) { progress.value = value; // Update text label inside var label = progress.getElementsByTagName('span')[0]; - if (is$1.element(label)) { + if (is$2.element(label)) { label.childNodes[0].nodeValue = value; } } @@ -4890,20 +5166,20 @@ typeof navigator === "object" && (function (global, factory) { // Webkit polyfill for lower fill range updateRangeFill: function updateRangeFill(target) { // Get range from event if event passed - var range = is$1.event(target) ? target.target : target; // Needs to be a valid <input type='range'> + var range = is$2.event(target) ? target.target : target; // Needs to be a valid <input type='range'> - if (!is$1.element(range) || range.getAttribute('type') !== 'range') { + if (!is$2.element(range) || range.getAttribute('type') !== 'range') { return; } // Set aria values for https://github.com/sampotts/plyr/issues/905 - if (matches(range, this.config.selectors.inputs.seek)) { + if (matches$1(range, this.config.selectors.inputs.seek)) { range.setAttribute('aria-valuenow', this.currentTime); var currentTime = controls.formatTime(this.currentTime); var duration = controls.formatTime(this.duration); var format$$1 = i18n.get('seekLabel', this.config); range.setAttribute('aria-valuetext', format$$1.replace('{currentTime}', currentTime).replace('{duration}', duration)); - } else if (matches(range, this.config.selectors.inputs.volume)) { + } else if (matches$1(range, this.config.selectors.inputs.volume)) { var percent = range.value * 100; range.setAttribute('aria-valuenow', percent); range.setAttribute('aria-valuetext', "".concat(percent.toFixed(1), "%")); @@ -4924,7 +5200,7 @@ typeof navigator === "object" && (function (global, factory) { var _this4 = this; // Bail if setting not true - if (!this.config.tooltips.seek || !is$1.element(this.elements.inputs.seek) || !is$1.element(this.elements.display.seekTooltip) || this.duration === 0) { + if (!this.config.tooltips.seek || !is$2.element(this.elements.inputs.seek) || !is$2.element(this.elements.display.seekTooltip) || this.duration === 0) { return; } // Calculate percentage @@ -4944,7 +5220,7 @@ typeof navigator === "object" && (function (global, factory) { } // Determine percentage, if already visible - if (is$1.event(event)) { + if (is$2.event(event)) { percent = 100 / clientRect.width * (event.pageX - clientRect.left); } else if (hasClass(this.elements.display.seekTooltip, visible)) { percent = parseFloat(this.elements.display.seekTooltip.style.left, 10); @@ -4965,14 +5241,14 @@ typeof navigator === "object" && (function (global, factory) { this.elements.display.seekTooltip.style.left = "".concat(percent, "%"); // Show/hide the tooltip // If the event is a moues in/out and percentage is inside bounds - if (is$1.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) { + if (is$2.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) { toggle(event.type === 'mouseenter'); } }, // Handle time change event timeUpdate: function timeUpdate(event) { // Only invert if only one time element is displayed and used for both duration and currentTime - var invert = !is$1.element(this.elements.display.duration) && this.config.invertTime; // Duration + var invert = !is$2.element(this.elements.display.duration) && this.config.invertTime; // Duration controls.updateTimeDisplay.call(this, this.elements.display.currentTime, invert ? this.duration - this.currentTime : this.currentTime, invert); // Ignore updates while seeking @@ -5001,12 +5277,12 @@ typeof navigator === "object" && (function (global, factory) { } // Update ARIA values - if (is$1.element(this.elements.inputs.seek)) { + if (is$2.element(this.elements.inputs.seek)) { this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration); } // If there's a spot to display duration - var hasDuration = is$1.element(this.elements.display.duration); // If there's only one time display, display duration there + var hasDuration = is$2.element(this.elements.display.duration); // If there's only one time display, display duration there if (!hasDuration && this.config.displayDuration && this.paused) { controls.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration); @@ -5033,14 +5309,14 @@ typeof navigator === "object" && (function (global, factory) { if (setting === 'captions') { value = this.currentTrack; } else { - value = !is$1.empty(input) ? input : this[setting]; // Get default + value = !is$2.empty(input) ? input : this[setting]; // Get default - if (is$1.empty(value)) { + if (is$2.empty(value)) { value = this.config[setting].default; } // Unsupported value - if (!is$1.empty(this.options[setting]) && !this.options[setting].includes(value)) { + if (!is$2.empty(this.options[setting]) && !this.options[setting].includes(value)) { this.debug.warn("Unsupported value of '".concat(value, "' for ").concat(setting)); return; } // Disabled value @@ -5053,12 +5329,12 @@ typeof navigator === "object" && (function (global, factory) { } // Get the list if we need to - if (!is$1.element(list)) { + if (!is$2.element(list)) { list = pane && pane.querySelector('[role="menu"]'); } // If there's no list it means it's not been rendered... - if (!is$1.element(list)) { + if (!is$2.element(list)) { return; } // Update the label @@ -5068,7 +5344,7 @@ typeof navigator === "object" && (function (global, factory) { var target = list && list.querySelector("[value=\"".concat(value, "\"]")); - if (is$1.element(target)) { + if (is$2.element(target)) { target.checked = true; } }, @@ -5079,7 +5355,7 @@ typeof navigator === "object" && (function (global, factory) { return value === 1 ? i18n.get('normal', this.config) : "".concat(value, "×"); case 'quality': - if (is$1.number(value)) { + if (is$2.number(value)) { var label = i18n.get("qualityLabel.".concat(value), this.config); if (!label.length) { @@ -5103,21 +5379,21 @@ typeof navigator === "object" && (function (global, factory) { var _this5 = this; // Menu required - if (!is$1.element(this.elements.settings.panels.quality)) { + if (!is$2.element(this.elements.settings.panels.quality)) { return; } var type = 'quality'; var list = this.elements.settings.panels.quality.querySelector('[role="menu"]'); // Set options if passed and filter based on uniqueness and config - if (is$1.array(options)) { + if (is$2.array(options)) { this.options.quality = dedupe(options).filter(function (quality) { return _this5.config.quality.options.includes(quality); }); } // Toggle the pane and tab - var toggle = !is$1.empty(this.options.quality) && this.options.quality.length > 1; + var toggle = !is$2.empty(this.options.quality) && this.options.quality.length > 1; controls.toggleMenuButton.call(this, type, toggle); // Empty the menu emptyElement(list); // Check if we need to toggle the parent @@ -5197,7 +5473,7 @@ typeof navigator === "object" && (function (global, factory) { var _this6 = this; // Menu required - if (!is$1.element(this.elements.settings.panels.captions)) { + if (!is$2.element(this.elements.settings.panels.captions)) { return; } // TODO: Captions or language? Currently it's mixed @@ -5245,14 +5521,14 @@ typeof navigator === "object" && (function (global, factory) { var _this7 = this; // Menu required - if (!is$1.element(this.elements.settings.panels.speed)) { + if (!is$2.element(this.elements.settings.panels.speed)) { return; } var type = 'speed'; var list = this.elements.settings.panels.speed.querySelector('[role="menu"]'); // Set the speed options - if (is$1.array(options)) { + if (is$2.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]; @@ -5263,7 +5539,7 @@ typeof navigator === "object" && (function (global, factory) { return _this7.config.speed.options.includes(speed); }); // Toggle the pane and tab - var toggle = !is$1.empty(this.options.speed) && this.options.speed.length > 1; + var toggle = !is$2.empty(this.options.speed) && this.options.speed.length > 1; controls.toggleMenuButton.call(this, type, toggle); // Empty the menu emptyElement(list); // Check if we need to toggle the parent @@ -5288,7 +5564,7 @@ typeof navigator === "object" && (function (global, factory) { // Check if we need to hide/show the settings menu checkMenu: function checkMenu() { var buttons = this.elements.settings.buttons; - var visible = !is$1.empty(buttons) && Object.values(buttons).some(function (button) { + var visible = !is$2.empty(buttons) && Object.values(buttons).some(function (button) { return !button.hidden; }); toggleHidden(this.elements.settings.menu, !visible); @@ -5303,7 +5579,7 @@ typeof navigator === "object" && (function (global, factory) { var target = pane; - if (!is$1.element(target)) { + if (!is$2.element(target)) { target = Object.values(this.elements.settings.panels).find(function (pane) { return !pane.hidden; }); @@ -5317,7 +5593,7 @@ typeof navigator === "object" && (function (global, factory) { var popup = this.elements.settings.popup; var button = this.elements.buttons.settings; // Menu and button are required - if (!is$1.element(popup) || !is$1.element(button)) { + if (!is$2.element(popup) || !is$2.element(button)) { return; } // True toggle by default @@ -5325,11 +5601,11 @@ typeof navigator === "object" && (function (global, factory) { var hidden = popup.hidden; var show = hidden; - if (is$1.boolean(input)) { + if (is$2.boolean(input)) { show = input; - } else if (is$1.keyboardEvent(input) && input.which === 27) { + } else if (is$2.keyboardEvent(input) && input.which === 27) { show = false; - } else if (is$1.event(input)) { + } else if (is$2.event(input)) { var isMenuItem = popup.contains(input.target); // If the click was inside the menu or if the click // wasn't the button or menu item and we're trying to // show the menu (a doc click shouldn't show the menu) @@ -5346,11 +5622,11 @@ typeof navigator === "object" && (function (global, factory) { toggleClass(this.elements.container, this.config.classNames.menu.open, show); // Focus the first item if key interaction - if (show && is$1.keyboardEvent(input)) { + if (show && is$2.keyboardEvent(input)) { controls.focusFirstMenuItem.call(this, null, true); } else if (!show && !hidden) { // If closing, re-focus the button - setFocus.call(this, button, is$1.keyboardEvent(input)); + setFocus.call(this, button, is$2.keyboardEvent(input)); } }, // Get the natural size of a menu panel @@ -5379,7 +5655,7 @@ typeof navigator === "object" && (function (global, factory) { var tabFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var target = document.getElementById("plyr-settings-".concat(this.id, "-").concat(type)); // Nothing to show, bail - if (!is$1.element(target)) { + if (!is$2.element(target)) { return; } // Hide all other panels @@ -5427,7 +5703,7 @@ typeof navigator === "object" && (function (global, factory) { setDownloadLink: function setDownloadLink() { var button = this.elements.buttons.download; // Bail if no button - if (!is$1.element(button)) { + if (!is$2.element(button)) { return; } // Set download link @@ -5528,7 +5804,7 @@ typeof navigator === "object" && (function (global, factory) { } // Settings button / menu - if (this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) { + if (this.config.controls.includes('settings') && !is$2.empty(this.config.settings)) { var control = createElement('div', { class: 'plyr__menu', hidden: '' @@ -5650,7 +5926,7 @@ typeof navigator === "object" && (function (global, factory) { }; var download = this.config.urls.download; - if (!is$1.url(download) && this.isEmbed) { + if (!is$2.url(download) && this.isEmbed) { extend(_attributes, { icon: "logo-".concat(this.provider), label: this.provider @@ -5705,7 +5981,7 @@ typeof navigator === "object" && (function (global, factory) { }; var update = true; // If function, run it and use output - if (is$1.function(this.config.controls)) { + if (is$2.function(this.config.controls)) { this.config.controls = this.config.controls.call(this, props); } // Convert falsy controls to empty array (primarily for empty strings) @@ -5714,7 +5990,7 @@ typeof navigator === "object" && (function (global, factory) { this.config.controls = []; } - if (is$1.element(this.config.controls) || is$1.string(this.config.controls)) { + if (is$2.element(this.config.controls) || is$2.string(this.config.controls)) { // HTMLElement or Non-empty string passed as the option container = this.config.controls; } else { @@ -5746,9 +6022,9 @@ typeof navigator === "object" && (function (global, factory) { if (update) { - if (is$1.string(this.config.controls)) { + if (is$2.string(this.config.controls)) { container = replace(container); - } else if (is$1.element(container)) { + } else if (is$2.element(container)) { container.innerHTML = replace(container.innerHTML); } } // Controls container @@ -5756,25 +6032,25 @@ typeof navigator === "object" && (function (global, factory) { var target; // Inject to custom location - if (is$1.string(this.config.selectors.controls.container)) { + if (is$2.string(this.config.selectors.controls.container)) { target = document.querySelector(this.config.selectors.controls.container); } // Inject into the container by default - if (!is$1.element(target)) { + if (!is$2.element(target)) { target = this.elements.container; } // Inject controls HTML (needs to be before captions, hence "afterbegin") - var insertMethod = is$1.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML'; + var insertMethod = is$2.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML'; target[insertMethod]('afterbegin', container); // Find the elements if need be - if (!is$1.element(this.elements.controls)) { + if (!is$2.element(this.elements.controls)) { controls.findElements.call(this); } // Add pressed property to buttons - if (!is$1.empty(this.elements.buttons)) { + if (!is$2.empty(this.elements.buttons)) { var addProperty = function addProperty(button) { var className = _this10.config.classNames.controlPressed; Object.defineProperty(button, 'pressed', { @@ -5791,7 +6067,7 @@ typeof navigator === "object" && (function (global, factory) { Object.values(this.elements.buttons).filter(Boolean).forEach(function (button) { - if (is$1.array(button) || is$1.nodeList(button)) { + if (is$2.array(button) || is$2.nodeList(button)) { Array.from(button).filter(Boolean).forEach(addProperty); } else { addProperty(button); @@ -5845,7 +6121,7 @@ typeof navigator === "object" && (function (global, factory) { function buildUrlParams(input) { var params = new URLSearchParams(); - if (is$1.object(input)) { + if (is$2.object(input)) { Object.entries(input).forEach(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], @@ -5869,7 +6145,7 @@ typeof navigator === "object" && (function (global, factory) { if (!this.isVideo || this.isYouTube || this.isHTML5 && !support.textTracks) { // Clear menu and hide - if (is$1.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) { + if (is$2.array(this.config.controls) && this.config.controls.includes('settings') && this.config.settings.includes('captions')) { controls.setCaptionsMenu.call(this); } @@ -5877,7 +6153,7 @@ typeof navigator === "object" && (function (global, factory) { } // Inject the container - if (!is$1.element(this.elements.captions)) { + if (!is$2.element(this.elements.captions)) { this.elements.captions = createElement('div', getAttributesFromSelector(this.config.selectors.captions)); insertAfter(this.elements.captions, this.elements.wrapper); } // Fix IE captions if CORS is used @@ -5920,7 +6196,7 @@ typeof navigator === "object" && (function (global, factory) { var active = this.storage.get('captions'); - if (!is$1.boolean(active)) { + if (!is$2.boolean(active)) { active = this.config.captions.active; } @@ -5980,7 +6256,7 @@ typeof navigator === "object" && (function (global, factory) { } // Enable or disable captions based on track length - toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is$1.empty(tracks)); // Update available languages in list + toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is$2.empty(tracks)); // Update available languages in list if ((this.config.controls || []).includes('settings') && this.config.settings.includes('captions')) { controls.setCaptionsMenu.call(this); @@ -6001,7 +6277,7 @@ typeof navigator === "object" && (function (global, factory) { var activeClass = this.config.classNames.captions.active; // Get the next state // If the method is called without parameter, toggle based on current value - var active = is$1.nullOrUndefined(input) ? !toggled : input; // Update state and trigger event + var active = is$2.nullOrUndefined(input) ? !toggled : input; // Update state and trigger event if (active !== toggled) { // When passive, don't override user preferences @@ -6048,7 +6324,7 @@ typeof navigator === "object" && (function (global, factory) { return; } - if (!is$1.number(index)) { + if (!is$2.number(index)) { this.debug.warn('Invalid caption argument', index); return; } @@ -6099,7 +6375,7 @@ typeof navigator === "object" && (function (global, factory) { setLanguage: function setLanguage(input) { var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - if (!is$1.string(input)) { + if (!is$2.string(input)) { this.debug.warn('Invalid language argument', input); return; } // Normalize @@ -6161,16 +6437,16 @@ typeof navigator === "object" && (function (global, factory) { getLabel: function getLabel(track) { var currentTrack = track; - if (!is$1.track(currentTrack) && support.textTracks && this.captions.toggled) { + if (!is$2.track(currentTrack) && support.textTracks && this.captions.toggled) { currentTrack = captions.getCurrentTrack.call(this); } - if (is$1.track(currentTrack)) { - if (!is$1.empty(currentTrack.label)) { + if (is$2.track(currentTrack)) { + if (!is$2.empty(currentTrack.label)) { return currentTrack.label; } - if (!is$1.empty(currentTrack.language)) { + if (!is$2.empty(currentTrack.language)) { return track.language.toUpperCase(); } @@ -6187,13 +6463,13 @@ typeof navigator === "object" && (function (global, factory) { return; } - if (!is$1.element(this.elements.captions)) { + if (!is$2.element(this.elements.captions)) { this.debug.warn('No captions element to render to'); return; } // Only accept array or empty input - if (!is$1.nullOrUndefined(input) && !Array.isArray(input)) { + if (!is$2.nullOrUndefined(input) && !Array.isArray(input)) { this.debug.warn('updateCues: Invalid input', input); return; } @@ -6228,7 +6504,7 @@ typeof navigator === "object" && (function (global, factory) { // ========================================================================== // Plyr default config // ========================================================================== - var defaults = { + var defaults$1 = { // Disable enabled: true, // Custom media title @@ -6660,7 +6936,7 @@ typeof navigator === "object" && (function (global, factory) { var button = this.player.elements.buttons.fullscreen; - if (is$1.element(button)) { + if (is$2.element(button)) { button.pressed = this.active; } // Trigger an event @@ -6702,7 +6978,7 @@ typeof navigator === "object" && (function (global, factory) { } // Check if the property already exists - var hasProperty = is$1.string(viewport.content) && viewport.content.includes(property); + var hasProperty = is$2.string(viewport.content) && viewport.content.includes(property); if (toggle) { this.cleanupViewport = !hasProperty; @@ -6755,7 +7031,7 @@ typeof navigator === "object" && (function (global, factory) { on.call(this.player, this.player.elements.container, 'dblclick', function (event) { // Ignore double click in controls - if (is$1.element(_this2.player.elements.controls) && _this2.player.elements.controls.contains(event.target)) { + if (is$2.element(_this2.player.elements.controls) && _this2.player.elements.controls.contains(event.target)) { return; } @@ -6804,7 +7080,7 @@ typeof navigator === "object" && (function (global, factory) { toggleFallback.call(this, true); } else if (!this.prefix) { this.target.requestFullscreen(); - } else if (!is$1.empty(this.prefix)) { + } else if (!is$2.empty(this.prefix)) { this.target["".concat(this.prefix, "Request").concat(this.property)](); } } // Bail from fullscreen @@ -6824,7 +7100,7 @@ typeof navigator === "object" && (function (global, factory) { toggleFallback.call(this, false); } else if (!this.prefix) { (document.cancelFullScreen || document.exitFullscreen).call(document); - } else if (!is$1.empty(this.prefix)) { + } else if (!is$2.empty(this.prefix)) { var action = this.prefix === 'moz' ? 'Cancel' : 'Exit'; document["".concat(this.prefix).concat(action).concat(this.property)](); } @@ -6883,7 +7159,7 @@ typeof navigator === "object" && (function (global, factory) { key: "prefix", get: function get() { // No prefix - if (is$1.function(document.exitFullscreen)) { + if (is$2.function(document.exitFullscreen)) { return ''; } // Check for fullscreen support by vendor prefix @@ -6891,7 +7167,7 @@ typeof navigator === "object" && (function (global, factory) { var value = ''; var prefixes = ['webkit', 'moz', 'ms']; prefixes.some(function (pre) { - if (is$1.function(document["".concat(pre, "ExitFullscreen")]) || is$1.function(document["".concat(pre, "CancelFullScreen")])) { + if (is$2.function(document["".concat(pre, "ExitFullscreen")]) || is$2.function(document["".concat(pre, "CancelFullScreen")])) { value = pre; return true; } @@ -6977,7 +7253,7 @@ typeof navigator === "object" && (function (global, factory) { } // Inject custom controls if not present - if (!is$1.element(this.elements.controls)) { + if (!is$2.element(this.elements.controls)) { // Inject custom controls controls.inject.call(this); // Re-attach control listeners @@ -7039,7 +7315,7 @@ typeof navigator === "object" && (function (global, factory) { // Find the current text var label = i18n.get('play', this.config); // If there's a media title set, use that for the label - if (is$1.string(this.config.title) && !is$1.empty(this.config.title)) { + if (is$2.string(this.config.title) && !is$2.empty(this.config.title)) { label += ", ".concat(this.config.title); } // If there's a play button, set label @@ -7052,12 +7328,12 @@ typeof navigator === "object" && (function (global, factory) { if (this.isEmbed) { var iframe = getElement.call(this, 'iframe'); - if (!is$1.element(iframe)) { + if (!is$2.element(iframe)) { return; } // Default to media type - var title = !is$1.empty(this.config.title) ? this.config.title : 'video'; + var title = !is$2.empty(this.config.title) ? this.config.title : 'video'; var format = i18n.get('frameTitle', this.config); iframe.setAttribute('title', format.replace('{title}', title)); } @@ -7120,7 +7396,7 @@ typeof navigator === "object" && (function (global, factory) { target.pressed = _this3.playing; }); // Only update controls on non timeupdate events - if (is$1.event(event) && event.type === 'timeupdate') { + if (is$2.event(event) && event.type === 'timeupdate') { return; } // Toggle controls @@ -7165,11 +7441,11 @@ typeof navigator === "object" && (function (global, factory) { function setAspectRatio(input) { var ratio = input; - if (!is$1.string(ratio) && !is$1.nullOrUndefined(this.embed)) { + if (!is$2.string(ratio) && !is$2.nullOrUndefined(this.embed)) { ratio = this.embed.ratio; } - if (!is$1.string(ratio)) { + if (!is$2.string(ratio)) { ratio = this.config.ratio; } @@ -7225,7 +7501,7 @@ typeof navigator === "object" && (function (global, factory) { // Firefox doesn't get the keycode for whatever reason - if (!is$1.number(code)) { + if (!is$2.number(code)) { return; } // Seek by the number keys @@ -7243,15 +7519,15 @@ typeof navigator === "object" && (function (global, factory) { // and any that accept key input http://webaim.org/techniques/keyboard/ var focused = document.activeElement; - if (is$1.element(focused)) { + if (is$2.element(focused)) { var editable = player.config.selectors.editable; var seek = elements.inputs.seek; - if (focused !== seek && matches(focused, editable)) { + if (focused !== seek && matches$1(focused, editable)) { return; } - if (event.which === 32 && matches(focused, 'button, [role^="menuitem"]')) { + if (event.which === 32 && matches$1(focused, 'button, [role^="menuitem"]')) { return; } } // Which keycodes should we prevent default @@ -7605,7 +7881,7 @@ typeof navigator === "object" && (function (global, factory) { // Re-fetch the wrapper var wrapper = getElement.call(player, ".".concat(player.config.classNames.video)); // Bail if there's no wrapper (this should never happen) - if (!is$1.element(wrapper)) { + if (!is$2.element(wrapper)) { return; } // On click play, pause or restart @@ -7686,7 +7962,7 @@ typeof navigator === "object" && (function (global, factory) { value: function proxy(event, defaultHandler, customHandlerKey) { var player = this.player; var customHandler = player.config.listeners[customHandlerKey]; - var hasCustomHandler = is$1.function(customHandler); + var hasCustomHandler = is$2.function(customHandler); var returned = true; // Execute custom handler if (hasCustomHandler) { @@ -7694,7 +7970,7 @@ typeof navigator === "object" && (function (global, factory) { } // Only call default handler if not prevented in custom handler - if (returned && is$1.function(defaultHandler)) { + if (returned && is$2.function(defaultHandler)) { defaultHandler.call(player, event); } } // Trigger custom and default handlers @@ -7707,7 +7983,7 @@ typeof navigator === "object" && (function (global, factory) { var passive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; var player = this.player; var customHandler = player.config.listeners[customHandlerKey]; - var hasCustomHandler = is$1.function(customHandler); + var hasCustomHandler = is$2.function(customHandler); on.call(player, element, type, function (event) { return _this2.proxy(event, defaultHandler, customHandlerKey); }, passive && !hasCustomHandler); @@ -7807,7 +8083,7 @@ typeof navigator === "object" && (function (global, factory) { var code = event.keyCode ? event.keyCode : event.which; var attribute = 'play-on-seeked'; - if (is$1.keyboardEvent(event) && code !== 39 && code !== 37) { + if (is$2.keyboardEvent(event) && code !== 39 && code !== 37) { return; } // Record seek time so we can prevent hiding controls for a few seconds after seek @@ -7844,7 +8120,7 @@ typeof navigator === "object" && (function (global, factory) { var seekTo = seek.getAttribute('seek-value'); - if (is$1.empty(seekTo)) { + if (is$2.empty(seekTo)) { seekTo = seek.value; } @@ -7898,7 +8174,7 @@ typeof navigator === "object" && (function (global, factory) { // Only if one time element is used for both currentTime and duration - if (player.config.toggleInvert && !is$1.element(elements.display.duration)) { + if (player.config.toggleInvert && !is$2.element(elements.display.duration)) { this.bind(elements.display.currentTime, 'click', function () { // Do nothing if we're at the start if (player.currentTime === 0) { @@ -8328,11 +8604,11 @@ typeof navigator === "object" && (function (global, factory) { } function parseId(url) { - if (is$1.empty(url)) { + if (is$2.empty(url)) { return null; } - if (is$1.number(Number(url))) { + if (is$2.number(Number(url))) { return url; } @@ -8361,7 +8637,7 @@ typeof navigator === "object" && (function (global, factory) { setAspectRatio.call(this); // Load the API if not already - if (!is$1.object(window.Vimeo)) { + if (!is$2.object(window.Vimeo)) { loadScript(this.config.urls.vimeo.sdk).then(function () { vimeo.ready.call(_this); }).catch(function (error) { @@ -8388,7 +8664,7 @@ typeof navigator === "object" && (function (global, factory) { var source = player.media.getAttribute('src'); // Get from <div> if needed - if (is$1.empty(source)) { + if (is$2.empty(source)) { source = player.media.getAttribute(player.config.attributes.embed.id); } @@ -8411,7 +8687,7 @@ typeof navigator === "object" && (function (global, factory) { player.media = replaceElement(wrapper, player.media); // Get poster image fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) { - if (is$1.empty(response)) { + if (is$2.empty(response)) { return; } // Get the URL for thumbnail @@ -8520,7 +8796,7 @@ typeof navigator === "object" && (function (global, factory) { return muted; }, set: function set(input) { - var toggle = is$1.boolean(input) ? input : false; + var toggle = is$2.boolean(input) ? input : false; player.embed.setVolume(toggle ? 0 : player.config.volume).then(function () { muted = toggle; triggerEvent.call(player, player.media, 'volumechange'); @@ -8534,7 +8810,7 @@ typeof navigator === "object" && (function (global, factory) { return loop; }, set: function set(input) { - var toggle = is$1.boolean(input) ? input : player.config.loop.active; + var toggle = is$2.boolean(input) ? input : player.config.loop.active; player.embed.setLoop(toggle).then(function () { loop = toggle; }); @@ -8610,7 +8886,7 @@ typeof navigator === "object" && (function (global, factory) { } }); - if (is$1.element(player.embed.element) && player.supported.ui) { + if (is$2.element(player.embed.element) && player.supported.ui) { var frame = player.embed.element; // Fix keyboard focus issues // https://github.com/sampotts/plyr/issues/317 @@ -8666,7 +8942,7 @@ typeof navigator === "object" && (function (global, factory) { }; function parseId$1(url) { - if (is$1.empty(url)) { + if (is$2.empty(url)) { return null; } @@ -8695,7 +8971,7 @@ typeof navigator === "object" && (function (global, factory) { setAspectRatio.call(this); // Setup API - if (is$1.object(window.YT) && is$1.function(window.YT.Player)) { + if (is$2.object(window.YT) && is$2.function(window.YT.Player)) { youtube.ready.call(this); } else { // Load the API @@ -8724,11 +9000,11 @@ typeof navigator === "object" && (function (global, factory) { // Try via undocumented API method first // This method disappears now and then though... // https://github.com/sampotts/plyr/issues/709 - if (is$1.function(this.embed.getVideoData)) { + if (is$2.function(this.embed.getVideoData)) { var _this$embed$getVideoD = this.embed.getVideoData(), title = _this$embed$getVideoD.title; - if (is$1.empty(title)) { + if (is$2.empty(title)) { this.config.title = title; ui.setTitle.call(this); return; @@ -8738,10 +9014,10 @@ typeof navigator === "object" && (function (global, factory) { var key = this.config.keys.google; - if (is$1.string(key) && !is$1.empty(key)) { + if (is$2.string(key) && !is$2.empty(key)) { var url = format(this.config.urls.youtube.api, videoId, key); fetch(url).then(function (result) { - if (is$1.object(result)) { + if (is$2.object(result)) { _this2.config.title = result.items[0].snippet.title; ui.setTitle.call(_this2); } @@ -8754,14 +9030,14 @@ typeof navigator === "object" && (function (global, factory) { var currentId = player.media.getAttribute('id'); - if (!is$1.empty(currentId) && currentId.startsWith('youtube-')) { + if (!is$2.empty(currentId) && currentId.startsWith('youtube-')) { return; } // Get the source URL or ID var source = player.media.getAttribute('src'); // Get from <div> if needed - if (is$1.empty(source)) { + if (is$2.empty(source)) { source = player.media.getAttribute(this.config.attributes.embed.id); } // Replace the <iframe> with a <div> due to YouTube API issues @@ -8849,7 +9125,7 @@ typeof navigator === "object" && (function (global, factory) { }, onReady: function onReady(event) { // Bail if onReady has already been called. See issue #1108 - if (is$1.function(player.media.play)) { + if (is$2.function(player.media.play)) { return; } // Get the instance @@ -8921,7 +9197,7 @@ typeof navigator === "object" && (function (global, factory) { return muted; }, set: function set(input) { - var toggle = is$1.boolean(input) ? input : muted; + var toggle = is$2.boolean(input) ? input : muted; muted = toggle; instance[toggle ? 'mute' : 'unMute'](); triggerEvent.call(player, player.media, 'volumechange'); @@ -9152,7 +9428,7 @@ typeof navigator === "object" && (function (global, factory) { if (this.enabled) { // Check if the Google IMA3 SDK is loaded or load it ourselves - if (!is$1.object(window.google) || !is$1.object(window.google.ima)) { + if (!is$2.object(window.google) || !is$2.object(window.google.ima)) { loadScript(this.player.config.urls.googleIMA.sdk).then(function () { _this2.ready(); }).catch(function () { @@ -9327,12 +9603,12 @@ typeof navigator === "object" && (function (global, factory) { var _this7 = this; // Add advertisement cue's within the time line if available - if (!is$1.empty(this.cuePoints)) { + if (!is$2.empty(this.cuePoints)) { this.cuePoints.forEach(function (cuePoint) { if (cuePoint !== 0 && cuePoint !== -1 && cuePoint < _this7.player.duration) { var seekElement = _this7.player.elements.progress; - if (is$1.element(seekElement)) { + if (is$2.element(seekElement)) { var cuePercentage = 100 / _this7.player.duration * cuePoint; var cue = createElement('span', { class: _this7.player.config.classNames.cues @@ -9489,7 +9765,7 @@ typeof navigator === "object" && (function (global, factory) { this.player.on('seeked', function () { var seekedTime = _this9.player.currentTime; - if (is$1.empty(_this9.cuePoints)) { + if (is$2.empty(_this9.cuePoints)) { return; } @@ -9637,9 +9913,9 @@ typeof navigator === "object" && (function (global, factory) { var handlers = this.events[event]; - if (is$1.array(handlers)) { + if (is$2.array(handlers)) { handlers.forEach(function (handler) { - if (is$1.function(handler)) { + if (is$2.function(handler)) { handler.apply(_this12, args); } }); @@ -9655,7 +9931,7 @@ typeof navigator === "object" && (function (global, factory) { }, { key: "on", value: function on$$1(event, callback) { - if (!is$1.array(this.events[event])) { + if (!is$2.array(this.events[event])) { this.events[event] = []; } @@ -9691,7 +9967,7 @@ typeof navigator === "object" && (function (global, factory) { }, { key: "clearSafetyTimer", value: function clearSafetyTimer(from) { - if (!is$1.nullOrUndefined(this.safetyTimer)) { + if (!is$2.nullOrUndefined(this.safetyTimer)) { this.player.debug.log("Safety timer cleared from: ".concat(from)); clearTimeout(this.safetyTimer); this.safetyTimer = null; @@ -9701,14 +9977,14 @@ typeof navigator === "object" && (function (global, factory) { key: "enabled", get: function get() { var config = this.config; - return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is$1.empty(config.publisherId) || is$1.url(config.tagUrl)); + return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is$2.empty(config.publisherId) || is$2.url(config.tagUrl)); } }, { key: "tagUrl", get: function get() { var config = this.config; - if (is$1.url(config.tagUrl)) { + if (is$2.url(config.tagUrl)) { return config.tagUrl; } @@ -9750,7 +10026,7 @@ typeof navigator === "object" && (function (global, factory) { var result = {}; var lines = frame.split(/\r\n|\n|\r/); lines.forEach(function (line) { - if (!is$1.number(result.startTime)) { + if (!is$2.number(result.startTime)) { // The line with start and end times on it is the first line of interest var matchTimes = line.match(/([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2,3})/); // Note that this currently ignores caption formatting directives that are optionally on the end of this line - fine for non-captions VTT @@ -9758,7 +10034,7 @@ typeof navigator === "object" && (function (global, factory) { result.startTime = Number(matchTimes[1]) * 60 * 60 + Number(matchTimes[2]) * 60 + Number(matchTimes[3]) + Number("0.".concat(matchTimes[4])); result.endTime = Number(matchTimes[6]) * 60 * 60 + Number(matchTimes[7]) * 60 + Number(matchTimes[8]) + Number("0.".concat(matchTimes[9])); } - } else if (!is$1.empty(line.trim()) && is$1.empty(result.text)) { + } else if (!is$2.empty(line.trim()) && is$2.empty(result.text)) { // If we already have the startTime, then we're definitely up to the text line(s) var lineSplit = line.trim().split('#xywh='); @@ -9855,12 +10131,12 @@ typeof navigator === "object" && (function (global, factory) { return new Promise(function (resolve) { var src = _this2.player.config.previewThumbnails.src; - if (is$1.empty(src)) { + if (is$2.empty(src)) { throw new Error('Missing previewThumbnails.src config attribute'); } // If string, convert into single-element list - var urls = is$1.string(src) ? [src] : src; // Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails + var urls = is$2.string(src) ? [src] : src; // Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails var promises = urls.map(function (u) { return _this2.getThumbnail(u); @@ -9919,7 +10195,7 @@ typeof navigator === "object" && (function (global, factory) { return; } - if (!is$1.event(event) || !['touchmove', 'mousemove'].includes(event.type)) { + if (!is$2.event(event) || !['touchmove', 'mousemove'].includes(event.type)) { return; } // Wait until media has a duration @@ -10413,11 +10689,11 @@ typeof navigator === "object" && (function (global, factory) { insertElements: function insertElements(type, attributes) { var _this = this; - if (is$1.string(attributes)) { + if (is$2.string(attributes)) { insertElement(type, this.media, { src: attributes }); - } else if (is$1.array(attributes)) { + } else if (is$2.array(attributes)) { attributes.forEach(function (attribute) { insertElement(type, _this.media, attribute); }); @@ -10443,7 +10719,7 @@ typeof navigator === "object" && (function (global, factory) { removeElement(_this2.media); _this2.media = null; // Reset class name - if (is$1.element(_this2.elements.container)) { + if (is$2.element(_this2.elements.container)) { _this2.elements.container.removeAttribute('class'); } // Set the type and provider @@ -10473,7 +10749,7 @@ typeof navigator === "object" && (function (global, factory) { _this2.elements.container.appendChild(_this2.media); // Autoplay the new source? - if (is$1.boolean(input.autoplay)) { + if (is$2.boolean(input.autoplay)) { _this2.config.autoplay = input.autoplay; } // Set attributes for audio and video @@ -10487,7 +10763,7 @@ typeof navigator === "object" && (function (global, factory) { _this2.media.setAttribute('autoplay', ''); } - if (!is$1.empty(input.poster)) { + if (!is$2.empty(input.poster)) { _this2.poster = input.poster; } @@ -10567,18 +10843,18 @@ typeof navigator === "object" && (function (global, factory) { this.media = target; // String selector passed - if (is$1.string(this.media)) { + if (is$2.string(this.media)) { this.media = document.querySelectorAll(this.media); } // jQuery, NodeList or Array passed, use first element - if (window.jQuery && this.media instanceof jQuery || is$1.nodeList(this.media) || is$1.array(this.media)) { + if (window.jQuery && this.media instanceof jQuery || is$2.nodeList(this.media) || is$2.array(this.media)) { // eslint-disable-next-line this.media = this.media[0]; } // Set config - this.config = extend({}, defaults, Plyr.defaults, options || {}, function () { + this.config = extend({}, defaults$1, Plyr.defaults, options || {}, function () { try { return JSON.parse(_this.media.getAttribute('data-plyr-config')); } catch (e) { @@ -10622,7 +10898,7 @@ typeof navigator === "object" && (function (global, factory) { this.debug.log('Config', this.config); this.debug.log('Support', support); // We need an element to setup - if (is$1.nullOrUndefined(this.media) || !is$1.element(this.media)) { + if (is$2.nullOrUndefined(this.media) || !is$2.element(this.media)) { this.debug.error('Setup failed: no suitable element passed'); return; } // Bail if the element is initialized @@ -10662,7 +10938,7 @@ typeof navigator === "object" && (function (global, factory) { // Find the frame iframe = this.media.querySelector('iframe'); // <iframe> type - if (is$1.element(iframe)) { + if (is$2.element(iframe)) { // Detect provider url = parseUrl(iframe.getAttribute('src')); this.provider = getProviderByUrl(url.toString()); // Rework elements @@ -10700,7 +10976,7 @@ typeof navigator === "object" && (function (global, factory) { } // Unsupported or missing provider - if (is$1.empty(this.provider) || !Object.keys(providers).includes(this.provider)) { + if (is$2.empty(this.provider) || !Object.keys(providers).includes(this.provider)) { this.debug.error('Setup failed: Invalid provider'); return; } // Audio will come later for external providers @@ -10757,7 +11033,7 @@ typeof navigator === "object" && (function (global, factory) { this.media.plyr = this; // Wrap media - if (!is$1.element(this.elements.container)) { + if (!is$2.element(this.elements.container)) { this.elements.container = createElement('div', { tabindex: 0 }); @@ -10821,7 +11097,7 @@ typeof navigator === "object" && (function (global, factory) { value: function play() { var _this2 = this; - if (!is$1.function(this.media.play)) { + if (!is$2.function(this.media.play)) { return null; } // Intecept play with ads @@ -10844,7 +11120,7 @@ typeof navigator === "object" && (function (global, factory) { }, { key: "pause", value: function pause() { - if (!this.playing || !is$1.function(this.media.pause)) { + if (!this.playing || !is$2.function(this.media.pause)) { return; } @@ -10863,7 +11139,7 @@ typeof navigator === "object" && (function (global, factory) { */ value: function togglePlay(input) { // Toggle based on current state if nothing passed - var toggle = is$1.boolean(input) ? input : !this.playing; + var toggle = is$2.boolean(input) ? input : !this.playing; if (toggle) { this.play(); @@ -10881,7 +11157,7 @@ typeof navigator === "object" && (function (global, factory) { if (this.isHTML5) { this.pause(); this.restart(); - } else if (is$1.function(this.media.stop)) { + } else if (is$2.function(this.media.stop)) { this.media.stop(); } } @@ -10902,7 +11178,7 @@ typeof navigator === "object" && (function (global, factory) { }, { key: "rewind", value: function rewind(seekTime) { - this.currentTime = this.currentTime - (is$1.number(seekTime) ? seekTime : this.config.seekTime); + this.currentTime = this.currentTime - (is$2.number(seekTime) ? seekTime : this.config.seekTime); } /** * Fast forward @@ -10912,7 +11188,7 @@ typeof navigator === "object" && (function (global, factory) { }, { key: "forward", value: function forward(seekTime) { - this.currentTime = this.currentTime + (is$1.number(seekTime) ? seekTime : this.config.seekTime); + this.currentTime = this.currentTime + (is$2.number(seekTime) ? seekTime : this.config.seekTime); } /** * Seek to a time @@ -10928,7 +11204,7 @@ typeof navigator === "object" && (function (global, factory) { */ value: function increaseVolume(step) { var volume = this.media.muted ? 0 : this.volume; - this.volume = volume + (is$1.number(step) ? step : 0); + this.volume = volume + (is$2.number(step) ? step : 0); } /** * Decrease volume @@ -10990,7 +11266,7 @@ typeof navigator === "object" && (function (global, factory) { var hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); // Close menu - if (hiding && this.config.controls.includes('settings') && !is$1.empty(this.config.settings)) { + if (hiding && this.config.controls.includes('settings') && !is$2.empty(this.config.settings)) { controls.toggleMenu.call(this, false); } // Trigger event on change @@ -11078,7 +11354,7 @@ typeof navigator === "object" && (function (global, factory) { } // Callback - if (is$1.function(callback)) { + if (is$2.function(callback)) { callback(); } } else { @@ -11089,7 +11365,7 @@ typeof navigator === "object" && (function (global, factory) { triggerEvent.call(_this3, _this3.elements.original, 'destroyed', true); // Callback - if (is$1.function(callback)) { + if (is$2.function(callback)) { callback.call(_this3.elements.original); } // Reset state @@ -11118,7 +11394,7 @@ typeof navigator === "object" && (function (global, factory) { clearInterval(this.timers.buffering); clearInterval(this.timers.playing); // Destroy YouTube API - if (this.embed !== null && is$1.function(this.embed.destroy)) { + if (this.embed !== null && is$2.function(this.embed.destroy)) { this.embed.destroy(); } // Clean up @@ -11223,7 +11499,7 @@ typeof navigator === "object" && (function (global, factory) { } // Validate input - var inputIsValid = is$1.number(input) && input > 0; // Set + var inputIsValid = is$2.number(input) && input > 0; // Set this.media.currentTime = inputIsValid ? Math.min(input, this.duration) : 0; // Logging @@ -11245,7 +11521,7 @@ typeof navigator === "object" && (function (global, factory) { get: function get() { var buffered = this.media.buffered; // YouTube / Vimeo return a float between 0-1 - if (is$1.number(buffered)) { + if (is$2.number(buffered)) { return buffered; } // HTML5 // TODO: Handle buffered chunks of the media @@ -11278,7 +11554,7 @@ typeof navigator === "object" && (function (global, factory) { var fauxDuration = parseFloat(this.config.duration); // Media duration can be NaN or Infinity before the media has loaded var realDuration = (this.media || {}).duration; - var duration = !is$1.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration + var duration = !is$2.number(realDuration) || realDuration === Infinity ? 0 : realDuration; // If config duration is funky, use regular duration return fauxDuration || duration; } @@ -11294,17 +11570,17 @@ typeof navigator === "object" && (function (global, factory) { var max = 1; var min = 0; - if (is$1.string(volume)) { + if (is$2.string(volume)) { volume = Number(volume); } // Load volume from storage if no value specified - if (!is$1.number(volume)) { + if (!is$2.number(volume)) { volume = this.storage.get('volume'); } // Use config if all else fails - if (!is$1.number(volume)) { + if (!is$2.number(volume)) { volume = this.config.volume; } // Maximum is volumeMax @@ -11323,7 +11599,7 @@ typeof navigator === "object" && (function (global, factory) { this.media.volume = volume; // If muted, and we're increasing volume manually, reset muted state - if (!is$1.empty(value) && this.muted && volume > 0) { + if (!is$2.empty(value) && this.muted && volume > 0) { this.muted = false; } } @@ -11339,12 +11615,12 @@ typeof navigator === "object" && (function (global, factory) { set: function set(mute) { var toggle = mute; // Load muted state from storage - if (!is$1.boolean(toggle)) { + if (!is$2.boolean(toggle)) { toggle = this.storage.get('muted'); } // Use config if all else fails - if (!is$1.boolean(toggle)) { + if (!is$2.boolean(toggle)) { toggle = this.config.muted; } // Update config @@ -11389,15 +11665,15 @@ typeof navigator === "object" && (function (global, factory) { set: function set(input) { var speed = null; - if (is$1.number(input)) { + if (is$2.number(input)) { speed = input; } - if (!is$1.number(speed)) { + if (!is$2.number(speed)) { speed = this.storage.get('speed'); } - if (!is$1.number(speed)) { + if (!is$2.number(speed)) { speed = this.config.speed.selected; } // Set min/max @@ -11443,7 +11719,7 @@ typeof navigator === "object" && (function (global, factory) { return; } - var quality = [!is$1.empty(input) && Number(input), this.storage.get('quality'), config.selected, config.default].find(is$1.number); + var quality = [!is$2.empty(input) && Number(input), this.storage.get('quality'), config.selected, config.default].find(is$2.number); var updateStorage = true; if (!options.includes(quality)) { @@ -11481,7 +11757,7 @@ typeof navigator === "object" && (function (global, factory) { }, { key: "loop", set: function set(input) { - var toggle = is$1.boolean(input) ? input : this.config.loop.active; + var toggle = is$2.boolean(input) ? input : this.config.loop.active; this.config.loop.active = toggle; this.media.loop = toggle; // Set default to be a true toggle @@ -11554,7 +11830,7 @@ typeof navigator === "object" && (function (global, factory) { key: "download", get: function get() { var download = this.config.urls.download; - return is$1.url(download) ? download : this.source; + return is$2.url(download) ? download : this.source; } /** * Set the poster image for a video @@ -11590,7 +11866,7 @@ typeof navigator === "object" && (function (global, factory) { }, { key: "autoplay", set: function set(input) { - var toggle = is$1.boolean(input) ? input : this.config.autoplay; + var toggle = is$2.boolean(input) ? input : this.config.autoplay; this.config.autoplay = toggle; } /** @@ -11648,15 +11924,15 @@ typeof navigator === "object" && (function (global, factory) { } // Toggle based on current state if not passed - var toggle = is$1.boolean(input) ? input : !this.pip; // Toggle based on current state + var toggle = is$2.boolean(input) ? input : !this.pip; // Toggle based on current state // Safari - if (is$1.function(this.media.webkitSetPresentationMode)) { + if (is$2.function(this.media.webkitSetPresentationMode)) { this.media.webkitSetPresentationMode(toggle ? pip.active : pip.inactive); } // Chrome - if (is$1.function(this.media.requestPictureInPicture)) { + if (is$2.function(this.media.requestPictureInPicture)) { if (!this.pip && toggle) { this.media.requestPictureInPicture(); } else if (this.pip && !toggle) { @@ -11674,7 +11950,7 @@ typeof navigator === "object" && (function (global, factory) { } // Safari - if (!is$1.empty(this.media.webkitPresentationMode)) { + if (!is$2.empty(this.media.webkitPresentationMode)) { return this.media.webkitPresentationMode === pip.active; } // Chrome @@ -11709,15 +11985,15 @@ typeof navigator === "object" && (function (global, factory) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var targets = null; - if (is$1.string(selector)) { + if (is$2.string(selector)) { targets = Array.from(document.querySelectorAll(selector)); - } else if (is$1.nodeList(selector)) { + } else if (is$2.nodeList(selector)) { targets = Array.from(selector); - } else if (is$1.array(selector)) { - targets = selector.filter(is$1.element); + } else if (is$2.array(selector)) { + targets = selector.filter(is$2.element); } - if (is$1.empty(targets)) { + if (is$2.empty(targets)) { return null; } @@ -11730,7 +12006,7 @@ typeof navigator === "object" && (function (global, factory) { return Plyr; }(); - Plyr.defaults = cloneDeep(defaults); + Plyr.defaults = cloneDeep(defaults$1); // ========================================================================== |