@tabler/core 1.0.0-beta17 → 1.0.0-beta19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -7
- package/dist/.DS_Store +0 -0
- package/dist/css/demo.css +13 -43
- package/dist/css/demo.min.css +3 -3
- package/dist/css/demo.rtl.css +13 -43
- package/dist/css/demo.rtl.min.css +3 -3
- package/dist/css/tabler-flags.css +5 -3
- package/dist/css/tabler-flags.min.css +3 -3
- package/dist/css/tabler-flags.rtl.css +5 -3
- package/dist/css/tabler-flags.rtl.min.css +3 -3
- package/dist/css/tabler-payments.css +12 -2
- package/dist/css/tabler-payments.min.css +3 -3
- package/dist/css/tabler-payments.rtl.css +12 -2
- package/dist/css/tabler-payments.rtl.min.css +3 -3
- package/dist/css/tabler-social.css +10 -0
- package/dist/css/tabler-social.min.css +8 -0
- package/dist/css/tabler-social.rtl.css +10 -0
- package/dist/css/tabler-social.rtl.min.css +8 -0
- package/dist/css/tabler-vendors.css +114 -38
- package/dist/css/tabler-vendors.min.css +3 -3
- package/dist/css/tabler-vendors.rtl.css +114 -38
- package/dist/css/tabler-vendors.rtl.min.css +3 -3
- package/dist/css/tabler.css +3831 -2185
- package/dist/css/tabler.min.css +7 -3
- package/dist/css/tabler.rtl.css +3831 -2186
- package/dist/css/tabler.rtl.min.css +7 -3
- package/dist/img/payments/epayco-dark.svg +1 -0
- package/dist/img/payments/epayco.svg +1 -0
- package/dist/js/demo-theme.js +9 -6
- package/dist/js/demo-theme.min.js +3 -3
- package/dist/js/demo.js +16 -16
- package/dist/js/demo.min.js +2 -2
- package/dist/js/tabler.esm.js +2115 -2970
- package/dist/js/tabler.esm.min.js +6 -6
- package/dist/js/tabler.js +2115 -2970
- package/dist/js/tabler.min.js +6 -6
- package/dist/libs/apexcharts/dist/apexcharts.amd.js +1 -1
- package/dist/libs/apexcharts/dist/apexcharts.common.js +5 -5
- package/dist/libs/apexcharts/dist/apexcharts.esm.js +5 -5
- package/dist/libs/apexcharts/dist/apexcharts.js +3010 -2741
- package/dist/libs/apexcharts/dist/apexcharts.min.js +5 -5
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +228 -228
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +3 -3
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +196 -195
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +3 -3
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.js +197 -196
- package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.min.js +3 -3
- package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -1
- package/dist/libs/countup.js/dist/countUp.d.ts +8 -3
- package/dist/libs/countup.js/dist/countUp.js +26 -8
- package/dist/libs/countup.js/dist/countUp.min.js +1 -1
- package/dist/libs/countup.js/dist/countUp.umd.js +1 -293
- package/dist/libs/countup.js/dist/requestAnimationFrame.polyfill.js +26 -0
- package/dist/libs/fslightbox/README.md +39 -33
- package/dist/libs/fslightbox/index.js +1 -1
- package/dist/libs/fslightbox/package.json +10 -44
- package/dist/libs/jsvectormap/dist/js/jsvectormap.js +517 -857
- package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -1
- package/dist/libs/nouislider/dist/nouislider.d.ts +2 -0
- package/dist/libs/nouislider/dist/nouislider.js +28 -0
- package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
- package/dist/libs/nouislider/dist/nouislider.min.mjs +1 -1
- package/dist/libs/nouislider/dist/nouislider.mjs +28 -0
- package/dist/libs/plyr/dist/plyr.css +1 -1
- package/dist/libs/plyr/dist/plyr.js +289 -229
- package/dist/libs/plyr/dist/plyr.min.js +1 -1
- package/dist/libs/plyr/dist/plyr.min.js.map +1 -1
- package/dist/libs/plyr/dist/plyr.min.mjs +1 -1
- package/dist/libs/plyr/dist/plyr.min.mjs.map +1 -1
- package/dist/libs/plyr/dist/plyr.mjs +289 -229
- package/dist/libs/plyr/dist/plyr.polyfilled.js +289 -229
- package/dist/libs/plyr/dist/plyr.polyfilled.min.js +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.min.js.map +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs.map +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.mjs +289 -229
- package/dist/libs/star-rating.js/dist/star-rating.cjs.js +481 -0
- package/dist/libs/star-rating.js/dist/star-rating.css +220 -0
- package/dist/libs/star-rating.js/dist/star-rating.esm.js +479 -0
- package/dist/libs/star-rating.js/dist/star-rating.esm.min.js +1 -0
- package/dist/libs/star-rating.js/dist/star-rating.js +491 -0
- package/dist/libs/star-rating.js/dist/star-rating.min.css +8 -0
- package/dist/libs/star-rating.js/dist/star-rating.min.js +8 -0
- package/dist/libs/tinymce/CHANGELOG.md +112 -0
- package/dist/libs/tinymce/composer.json +1 -1
- package/dist/libs/tinymce/icons/default/icons.js +4 -0
- package/dist/libs/tinymce/icons/default/icons.min.js +1 -1
- package/dist/libs/tinymce/models/dom/model.js +79 -23
- package/dist/libs/tinymce/models/dom/model.min.js +2 -2
- package/dist/libs/tinymce/package.json +1 -1
- package/dist/libs/tinymce/plugins/advlist/plugin.js +34 -28
- package/dist/libs/tinymce/plugins/advlist/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/anchor/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/anchor/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/autolink/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/autolink/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/autoresize/plugin.js +46 -11
- package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/autosave/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/autosave/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/charmap/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/charmap/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/code/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/code/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/codesample/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/codesample/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/directionality/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/directionality/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/emoticons/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/fullscreen/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/help/plugin.js +12 -4
- package/dist/libs/tinymce/plugins/help/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/image/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/image/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/importcss/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/importcss/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/link/plugin.js +21 -7
- package/dist/libs/tinymce/plugins/link/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/lists/plugin.js +132 -50
- package/dist/libs/tinymce/plugins/lists/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/media/plugin.js +7 -2
- package/dist/libs/tinymce/plugins/media/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/pagebreak/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/preview/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/preview/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/quickbars/plugin.js +21 -13
- package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/save/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/save/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/searchreplace/plugin.js +56 -43
- package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/table/plugin.js +73 -55
- package/dist/libs/tinymce/plugins/table/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/template/plugin.js +17 -14
- package/dist/libs/tinymce/plugins/template/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/visualblocks/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/visualchars/plugin.js +58 -7
- package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/wordcount/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +1 -1
- package/dist/libs/tinymce/skins/ui/oxide/skin.css +454 -6
- package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -1
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +454 -6
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +455 -6
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +454 -5
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/dist/libs/tinymce/themes/silver/theme.js +4374 -3074
- package/dist/libs/tinymce/themes/silver/theme.min.js +2 -2
- package/dist/libs/tinymce/tinymce.d.ts +305 -236
- package/dist/libs/tinymce/tinymce.js +1957 -1597
- package/dist/libs/tinymce/tinymce.min.js +2 -2
- package/package.json +63 -42
- package/src/js/demo-theme.js +13 -10
- package/src/js/demo.js +18 -15
- package/src/js/tabler.esm.js +7 -8
- package/src/js/tabler.js +12 -12
- package/src/scss/_bootstrap-components.scss +33 -33
- package/src/scss/_bootstrap-config.scss +6 -6
- package/src/scss/_bootstrap-override.scss +8 -12
- package/src/scss/_config.scss +2 -1
- package/src/scss/_core.scss +1 -1
- package/src/scss/_debug.scss +41 -30
- package/src/scss/_utilities.scss +21 -19
- package/src/scss/_variables-dark.scss +17 -0
- package/src/scss/_variables.scss +233 -169
- package/src/scss/demo/_examples.scss +0 -16
- package/src/scss/demo.scss +36 -25
- package/src/scss/layout/_core.scss +0 -1
- package/src/scss/layout/_dark.scss +47 -162
- package/src/scss/layout/_navbar.scss +19 -99
- package/src/scss/layout/_page.scss +9 -6
- package/src/scss/layout/_root.scss +21 -7
- package/src/scss/mixins/_functions.scss +2 -6
- package/src/scss/mixins/_mixins.scss +0 -32
- package/src/scss/tabler-social.scss +1 -0
- package/src/scss/tabler-vendors.scss +1 -0
- package/src/scss/tabler.scss +0 -1
- package/src/scss/ui/_avatars.scss +1 -1
- package/src/scss/ui/_buttons.scss +1 -1
- package/src/scss/ui/_dropdowns.scss +1 -3
- package/src/scss/ui/_grid.scss +2 -18
- package/src/scss/ui/_payments.scss +1 -1
- package/src/scss/ui/_status.scss +0 -10
- package/src/scss/ui/_tables.scss +12 -26
- package/src/scss/ui/_timeline.scss +3 -3
- package/src/scss/utils/_colors.scss +6 -2
- package/src/scss/vendor/_apexcharts.scss +16 -0
- package/src/scss/vendor/_jsvectormap.scss +1 -1
- package/src/scss/vendor/_nouislider.scss +1 -1
- package/src/scss/vendor/_stars-rating.scss +20 -0
- package/src/scss/vendor/_tinymce.scss +5 -7
- package/src/scss/vendor/_tom-select.scss +43 -2
- package/dist/libs/countup.js/dist/countUp.withPolyfill.min.js +0 -1
- package/dist/libs/fslightbox/jest-setup.js +0 -1
|
@@ -5,6 +5,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _defineProperty$1(obj, key, value) {
|
|
8
|
+
key = _toPropertyKey(key);
|
|
8
9
|
if (key in obj) {
|
|
9
10
|
Object.defineProperty(obj, key, {
|
|
10
11
|
value: value,
|
|
@@ -17,6 +18,20 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
17
18
|
}
|
|
18
19
|
return obj;
|
|
19
20
|
}
|
|
21
|
+
function _toPrimitive(input, hint) {
|
|
22
|
+
if (typeof input !== "object" || input === null) return input;
|
|
23
|
+
var prim = input[Symbol.toPrimitive];
|
|
24
|
+
if (prim !== undefined) {
|
|
25
|
+
var res = prim.call(input, hint || "default");
|
|
26
|
+
if (typeof res !== "object") return res;
|
|
27
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
28
|
+
}
|
|
29
|
+
return (hint === "string" ? String : Number)(input);
|
|
30
|
+
}
|
|
31
|
+
function _toPropertyKey(arg) {
|
|
32
|
+
var key = _toPrimitive(arg, "string");
|
|
33
|
+
return typeof key === "symbol" ? key : String(key);
|
|
34
|
+
}
|
|
20
35
|
|
|
21
36
|
function _classCallCheck(e, t) {
|
|
22
37
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -318,12 +333,20 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
318
333
|
// Unfortunately, due to mixed support, UA sniffing is required
|
|
319
334
|
// ==========================================================================
|
|
320
335
|
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
336
|
+
const isIE = Boolean(window.document.documentMode);
|
|
337
|
+
const isEdge = /Edge/g.test(navigator.userAgent);
|
|
338
|
+
const isWebKit = 'WebkitAppearance' in document.documentElement.style && !/Edge/g.test(navigator.userAgent);
|
|
339
|
+
const isIPhone = /iPhone|iPod/gi.test(navigator.userAgent) && navigator.maxTouchPoints > 1;
|
|
340
|
+
// navigator.platform may be deprecated but this check is still required
|
|
341
|
+
const isIPadOS = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
342
|
+
const isIos = /iPad|iPhone|iPod/gi.test(navigator.userAgent) && navigator.maxTouchPoints > 1;
|
|
343
|
+
var browser = {
|
|
344
|
+
isIE,
|
|
345
|
+
isEdge,
|
|
346
|
+
isWebKit,
|
|
347
|
+
isIPhone,
|
|
348
|
+
isIPadOS,
|
|
349
|
+
isIos
|
|
327
350
|
};
|
|
328
351
|
|
|
329
352
|
// ==========================================================================
|
|
@@ -396,9 +419,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
396
419
|
|
|
397
420
|
// Set attributes
|
|
398
421
|
function setAttributes(element, attributes) {
|
|
399
|
-
if (!is.element(element) || is.empty(attributes))
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
422
|
+
if (!is.element(element) || is.empty(attributes)) return;
|
|
402
423
|
|
|
403
424
|
// Assume null and undefined attributes should be left out,
|
|
404
425
|
// Setting them would otherwise convert them to "null" and "undefined"
|
|
@@ -424,19 +445,15 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
424
445
|
return element;
|
|
425
446
|
}
|
|
426
447
|
|
|
427
|
-
//
|
|
448
|
+
// Insert an element after another
|
|
428
449
|
function insertAfter(element, target) {
|
|
429
|
-
if (!is.element(element) || !is.element(target))
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
450
|
+
if (!is.element(element) || !is.element(target)) return;
|
|
432
451
|
target.parentNode.insertBefore(element, target.nextSibling);
|
|
433
452
|
}
|
|
434
453
|
|
|
435
454
|
// Insert a DocumentFragment
|
|
436
455
|
function insertElement(type, parent, attributes, text) {
|
|
437
|
-
if (!is.element(parent))
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
456
|
+
if (!is.element(parent)) return;
|
|
440
457
|
parent.appendChild(createElement(type, attributes, text));
|
|
441
458
|
}
|
|
442
459
|
|
|
@@ -454,9 +471,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
454
471
|
|
|
455
472
|
// Remove all child elements
|
|
456
473
|
function emptyElement(element) {
|
|
457
|
-
if (!is.element(element))
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
474
|
+
if (!is.element(element)) return;
|
|
460
475
|
let {
|
|
461
476
|
length
|
|
462
477
|
} = element.childNodes;
|
|
@@ -468,9 +483,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
468
483
|
|
|
469
484
|
// Replace element
|
|
470
485
|
function replaceElement(newChild, oldChild) {
|
|
471
|
-
if (!is.element(oldChild) || !is.element(oldChild.parentNode) || !is.element(newChild))
|
|
472
|
-
return null;
|
|
473
|
-
}
|
|
486
|
+
if (!is.element(oldChild) || !is.element(oldChild.parentNode) || !is.element(newChild)) return null;
|
|
474
487
|
oldChild.parentNode.replaceChild(newChild, oldChild);
|
|
475
488
|
return newChild;
|
|
476
489
|
}
|
|
@@ -482,9 +495,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
482
495
|
// '#test' to { id: 'test' }
|
|
483
496
|
// '[data-test="test"]' to { 'data-test': 'test' }
|
|
484
497
|
|
|
485
|
-
if (!is.string(sel) || is.empty(sel)) {
|
|
486
|
-
return {};
|
|
487
|
-
}
|
|
498
|
+
if (!is.string(sel) || is.empty(sel)) return {};
|
|
488
499
|
const attributes = {};
|
|
489
500
|
const existing = extend({}, existingAttributes);
|
|
490
501
|
sel.split(',').forEach(s => {
|
|
@@ -522,9 +533,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
522
533
|
|
|
523
534
|
// Toggle hidden
|
|
524
535
|
function toggleHidden(element, hidden) {
|
|
525
|
-
if (!is.element(element))
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
536
|
+
if (!is.element(element)) return;
|
|
528
537
|
let hide = hidden;
|
|
529
538
|
if (!is.boolean(hide)) {
|
|
530
539
|
hide = !element.hidden;
|
|
@@ -597,20 +606,14 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
597
606
|
}
|
|
598
607
|
|
|
599
608
|
// Set focus and tab focus class
|
|
600
|
-
function setFocus(element = null,
|
|
601
|
-
if (!is.element(element))
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
609
|
+
function setFocus(element = null, focusVisible = false) {
|
|
610
|
+
if (!is.element(element)) return;
|
|
604
611
|
|
|
605
612
|
// Set regular focus
|
|
606
613
|
element.focus({
|
|
607
|
-
preventScroll: true
|
|
614
|
+
preventScroll: true,
|
|
615
|
+
focusVisible
|
|
608
616
|
});
|
|
609
|
-
|
|
610
|
-
// If we want to mimic keyboard focus via tab
|
|
611
|
-
if (tabFocus) {
|
|
612
|
-
toggleClass(element, this.config.classNames.tabFocus);
|
|
613
|
-
}
|
|
614
617
|
}
|
|
615
618
|
|
|
616
619
|
// ==========================================================================
|
|
@@ -631,10 +634,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
631
634
|
video: 'canPlayType' in document.createElement('video'),
|
|
632
635
|
// Check for support
|
|
633
636
|
// Basic functionality vs full UI
|
|
634
|
-
check(type, provider
|
|
635
|
-
const canPlayInline = browser.isIPhone && playsinline && support.playsinline;
|
|
637
|
+
check(type, provider) {
|
|
636
638
|
const api = support[type] || provider !== 'html5';
|
|
637
|
-
const ui = api && support.rangeInput
|
|
639
|
+
const ui = api && support.rangeInput;
|
|
638
640
|
return {
|
|
639
641
|
api,
|
|
640
642
|
ui
|
|
@@ -1131,7 +1133,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
1131
1133
|
// Format string
|
|
1132
1134
|
function format(input, ...args) {
|
|
1133
1135
|
if (is.empty(input)) return input;
|
|
1134
|
-
return input.toString().replace(/{(\d+)}/g, (
|
|
1136
|
+
return input.toString().replace(/{(\d+)}/g, (_, i) => args[i].toString());
|
|
1135
1137
|
}
|
|
1136
1138
|
|
|
1137
1139
|
// Get percentage
|
|
@@ -1712,7 +1714,8 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
1712
1714
|
const attributes = getAttributesFromSelector(this.config.selectors.display[type], attrs);
|
|
1713
1715
|
const container = createElement('div', extend(attributes, {
|
|
1714
1716
|
class: `${attributes.class ? attributes.class : ''} ${this.config.classNames.display.time} `.trim(),
|
|
1715
|
-
'aria-label': i18n.get(type, this.config)
|
|
1717
|
+
'aria-label': i18n.get(type, this.config),
|
|
1718
|
+
role: 'timer'
|
|
1716
1719
|
}), '00:00');
|
|
1717
1720
|
|
|
1718
1721
|
// Reference for updates
|
|
@@ -1726,7 +1729,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
1726
1729
|
// Navigate through menus via arrow keys and space
|
|
1727
1730
|
on.call(this, menuItem, 'keydown keyup', event => {
|
|
1728
1731
|
// We only care about space and ⬆️ ⬇️️ ➡️
|
|
1729
|
-
if (!['
|
|
1732
|
+
if (![' ', 'ArrowUp', 'ArrowDown', 'ArrowRight'].includes(event.key)) {
|
|
1730
1733
|
return;
|
|
1731
1734
|
}
|
|
1732
1735
|
|
|
@@ -1741,11 +1744,11 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
1741
1744
|
const isRadioButton = matches(menuItem, '[role="menuitemradio"]');
|
|
1742
1745
|
|
|
1743
1746
|
// Show the respective menu
|
|
1744
|
-
if (!isRadioButton && ['
|
|
1747
|
+
if (!isRadioButton && [' ', 'ArrowRight'].includes(event.key)) {
|
|
1745
1748
|
controls.showMenuPanel.call(this, type, true);
|
|
1746
1749
|
} else {
|
|
1747
1750
|
let target;
|
|
1748
|
-
if (event.key !== '
|
|
1751
|
+
if (event.key !== ' ') {
|
|
1749
1752
|
if (event.key === 'ArrowDown' || isRadioButton && event.key === 'ArrowRight') {
|
|
1750
1753
|
target = menuItem.nextElementSibling;
|
|
1751
1754
|
if (!is.element(target)) {
|
|
@@ -1810,7 +1813,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
1810
1813
|
}
|
|
1811
1814
|
});
|
|
1812
1815
|
this.listeners.bind(menuItem, 'click keyup', event => {
|
|
1813
|
-
if (is.keyboardEvent(event) && event.key !== '
|
|
1816
|
+
if (is.keyboardEvent(event) && event.key !== ' ') {
|
|
1814
1817
|
return;
|
|
1815
1818
|
}
|
|
1816
1819
|
event.preventDefault();
|
|
@@ -1950,7 +1953,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
1950
1953
|
}
|
|
1951
1954
|
|
|
1952
1955
|
// WebKit only
|
|
1953
|
-
if (!browser.
|
|
1956
|
+
if (!browser.isWebKit && !browser.isIPadOS) {
|
|
1954
1957
|
return;
|
|
1955
1958
|
}
|
|
1956
1959
|
|
|
@@ -2333,7 +2336,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
2333
2336
|
toggleHidden(this.elements.settings.menu, !visible);
|
|
2334
2337
|
},
|
|
2335
2338
|
// Focus the first menu item in a given (or visible) menu
|
|
2336
|
-
focusFirstMenuItem(pane,
|
|
2339
|
+
focusFirstMenuItem(pane, focusVisible = false) {
|
|
2337
2340
|
if (this.elements.settings.popup.hidden) {
|
|
2338
2341
|
return;
|
|
2339
2342
|
}
|
|
@@ -2342,7 +2345,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
2342
2345
|
target = Object.values(this.elements.settings.panels).find(p => !p.hidden);
|
|
2343
2346
|
}
|
|
2344
2347
|
const firstItem = target.querySelector('[role^="menuitem"]');
|
|
2345
|
-
setFocus.call(this, firstItem,
|
|
2348
|
+
setFocus.call(this, firstItem, focusVisible);
|
|
2346
2349
|
},
|
|
2347
2350
|
// Show/hide menu
|
|
2348
2351
|
toggleMenu(input) {
|
|
@@ -2418,7 +2421,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
2418
2421
|
};
|
|
2419
2422
|
},
|
|
2420
2423
|
// Show a panel in the menu
|
|
2421
|
-
showMenuPanel(type = '',
|
|
2424
|
+
showMenuPanel(type = '', focusVisible = false) {
|
|
2422
2425
|
const target = this.elements.container.querySelector(`#plyr-settings-${this.id}-${type}`);
|
|
2423
2426
|
|
|
2424
2427
|
// Nothing to show, bail
|
|
@@ -2469,7 +2472,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
2469
2472
|
toggleHidden(target, false);
|
|
2470
2473
|
|
|
2471
2474
|
// Focus the first item
|
|
2472
|
-
controls.focusFirstMenuItem.call(this, target,
|
|
2475
|
+
controls.focusFirstMenuItem.call(this, target, focusVisible);
|
|
2473
2476
|
},
|
|
2474
2477
|
// Set the download URL
|
|
2475
2478
|
setDownloadUrl() {
|
|
@@ -2596,7 +2599,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
2596
2599
|
// Volume range control
|
|
2597
2600
|
// Ignored on iOS as it's handled globally
|
|
2598
2601
|
// https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
|
|
2599
|
-
if (control === 'volume' && !browser.isIos) {
|
|
2602
|
+
if (control === 'volume' && !browser.isIos && !browser.isIPadOS) {
|
|
2600
2603
|
// Set the attributes
|
|
2601
2604
|
const attributes = {
|
|
2602
2605
|
max: 1,
|
|
@@ -3388,8 +3391,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3388
3391
|
autoplay: false,
|
|
3389
3392
|
// Only allow one media playing at once (vimeo only)
|
|
3390
3393
|
autopause: true,
|
|
3391
|
-
// Allow inline playback on iOS
|
|
3392
|
-
// TODO: Remove iosNative fullscreen option in favour of this (logic needs work)
|
|
3394
|
+
// Allow inline playback on iOS
|
|
3393
3395
|
playsinline: true,
|
|
3394
3396
|
// Default time to skip when rewind/fast forward
|
|
3395
3397
|
seekTime: 10,
|
|
@@ -3419,7 +3421,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3419
3421
|
// Sprite (for icons)
|
|
3420
3422
|
loadSprite: true,
|
|
3421
3423
|
iconPrefix: 'plyr',
|
|
3422
|
-
iconUrl: 'https://cdn.plyr.io/3.7.
|
|
3424
|
+
iconUrl: 'https://cdn.plyr.io/3.7.8/plyr.svg',
|
|
3423
3425
|
// Blank video (used to prevent errors on source change)
|
|
3424
3426
|
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
|
3425
3427
|
// Quality default
|
|
@@ -3652,7 +3654,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3652
3654
|
marker: 'plyr__progress__marker',
|
|
3653
3655
|
hidden: 'plyr__sr-only',
|
|
3654
3656
|
hideControls: 'plyr--hide-controls',
|
|
3655
|
-
isIos: 'plyr--is-ios',
|
|
3656
3657
|
isTouch: 'plyr--is-touch',
|
|
3657
3658
|
uiSupported: 'plyr--full-ui',
|
|
3658
3659
|
noTransition: 'plyr--no-transition',
|
|
@@ -3680,7 +3681,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3680
3681
|
supported: 'plyr--airplay-supported',
|
|
3681
3682
|
active: 'plyr--airplay-active'
|
|
3682
3683
|
},
|
|
3683
|
-
tabFocus: 'plyr__tab-focus',
|
|
3684
3684
|
previewThumbnails: {
|
|
3685
3685
|
// Tooltip thumbs
|
|
3686
3686
|
thumbContainer: 'plyr__preview-thumb',
|
|
@@ -3825,9 +3825,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3825
3825
|
class Fullscreen {
|
|
3826
3826
|
constructor(player) {
|
|
3827
3827
|
_defineProperty$1(this, "onChange", () => {
|
|
3828
|
-
if (!this.
|
|
3829
|
-
return;
|
|
3830
|
-
}
|
|
3828
|
+
if (!this.supported) return;
|
|
3831
3829
|
|
|
3832
3830
|
// Update toggle button
|
|
3833
3831
|
const button = this.player.elements.buttons.fullscreen;
|
|
@@ -3844,8 +3842,8 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3844
3842
|
// Store or restore scroll position
|
|
3845
3843
|
if (toggle) {
|
|
3846
3844
|
this.scrollPosition = {
|
|
3847
|
-
x: window.scrollX
|
|
3848
|
-
y: window.scrollY
|
|
3845
|
+
x: window.scrollX ?? 0,
|
|
3846
|
+
y: window.scrollY ?? 0
|
|
3849
3847
|
};
|
|
3850
3848
|
} else {
|
|
3851
3849
|
window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
|
|
@@ -3872,9 +3870,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3872
3870
|
const hasProperty = is.string(viewport.content) && viewport.content.includes(property);
|
|
3873
3871
|
if (toggle) {
|
|
3874
3872
|
this.cleanupViewport = !hasProperty;
|
|
3875
|
-
if (!hasProperty) {
|
|
3876
|
-
viewport.content += `,${property}`;
|
|
3877
|
-
}
|
|
3873
|
+
if (!hasProperty) viewport.content += `,${property}`;
|
|
3878
3874
|
} else if (this.cleanupViewport) {
|
|
3879
3875
|
viewport.content = viewport.content.split(',').filter(part => part.trim() !== property).join(',');
|
|
3880
3876
|
}
|
|
@@ -3883,11 +3879,10 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3883
3879
|
// Toggle button and fire events
|
|
3884
3880
|
this.onChange();
|
|
3885
3881
|
});
|
|
3882
|
+
// Trap focus inside container
|
|
3886
3883
|
_defineProperty$1(this, "trapFocus", event => {
|
|
3887
|
-
// Bail if iOS, not active, not the tab key
|
|
3888
|
-
if (browser.isIos || !this.active || event.key !== 'Tab')
|
|
3889
|
-
return;
|
|
3890
|
-
}
|
|
3884
|
+
// Bail if iOS/iPadOS, not active, not the tab key
|
|
3885
|
+
if (browser.isIos || browser.isIPadOS || !this.active || event.key !== 'Tab') return;
|
|
3891
3886
|
|
|
3892
3887
|
// Get the current focused element
|
|
3893
3888
|
const focused = document.activeElement;
|
|
@@ -3904,28 +3899,22 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3904
3899
|
event.preventDefault();
|
|
3905
3900
|
}
|
|
3906
3901
|
});
|
|
3902
|
+
// Update UI
|
|
3907
3903
|
_defineProperty$1(this, "update", () => {
|
|
3908
|
-
if (this.
|
|
3904
|
+
if (this.supported) {
|
|
3909
3905
|
let mode;
|
|
3910
|
-
if (this.forceFallback)
|
|
3911
|
-
mode = 'Fallback (forced)';
|
|
3912
|
-
} else if (Fullscreen.native) {
|
|
3913
|
-
mode = 'Native';
|
|
3914
|
-
} else {
|
|
3915
|
-
mode = 'Fallback';
|
|
3916
|
-
}
|
|
3906
|
+
if (this.forceFallback) mode = 'Fallback (forced)';else if (Fullscreen.nativeSupported) mode = 'Native';else mode = 'Fallback';
|
|
3917
3907
|
this.player.debug.log(`${mode} fullscreen enabled`);
|
|
3918
3908
|
} else {
|
|
3919
3909
|
this.player.debug.log('Fullscreen not supported and fallback disabled');
|
|
3920
3910
|
}
|
|
3921
3911
|
|
|
3922
3912
|
// Add styling hook to show button
|
|
3923
|
-
toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.
|
|
3913
|
+
toggleClass(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.supported);
|
|
3924
3914
|
});
|
|
3915
|
+
// Make an element fullscreen
|
|
3925
3916
|
_defineProperty$1(this, "enter", () => {
|
|
3926
|
-
if (!this.
|
|
3927
|
-
return;
|
|
3928
|
-
}
|
|
3917
|
+
if (!this.supported) return;
|
|
3929
3918
|
|
|
3930
3919
|
// iOS native fullscreen doesn't need the request step
|
|
3931
3920
|
if (browser.isIos && this.player.config.fullscreen.iosNative) {
|
|
@@ -3934,7 +3923,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3934
3923
|
} else {
|
|
3935
3924
|
this.target.webkitEnterFullscreen();
|
|
3936
3925
|
}
|
|
3937
|
-
} else if (!Fullscreen.
|
|
3926
|
+
} else if (!Fullscreen.nativeSupported || this.forceFallback) {
|
|
3938
3927
|
this.toggleFallback(true);
|
|
3939
3928
|
} else if (!this.prefix) {
|
|
3940
3929
|
this.target.requestFullscreen({
|
|
@@ -3944,16 +3933,19 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3944
3933
|
this.target[`${this.prefix}Request${this.property}`]();
|
|
3945
3934
|
}
|
|
3946
3935
|
});
|
|
3936
|
+
// Bail from fullscreen
|
|
3947
3937
|
_defineProperty$1(this, "exit", () => {
|
|
3948
|
-
if (!this.
|
|
3949
|
-
return;
|
|
3950
|
-
}
|
|
3938
|
+
if (!this.supported) return;
|
|
3951
3939
|
|
|
3952
3940
|
// iOS native fullscreen
|
|
3953
3941
|
if (browser.isIos && this.player.config.fullscreen.iosNative) {
|
|
3954
|
-
this.
|
|
3942
|
+
if (this.player.isVimeo) {
|
|
3943
|
+
this.player.embed.exitFullscreen();
|
|
3944
|
+
} else {
|
|
3945
|
+
this.target.webkitEnterFullscreen();
|
|
3946
|
+
}
|
|
3955
3947
|
silencePromise(this.player.play());
|
|
3956
|
-
} else if (!Fullscreen.
|
|
3948
|
+
} else if (!Fullscreen.nativeSupported || this.forceFallback) {
|
|
3957
3949
|
this.toggleFallback(false);
|
|
3958
3950
|
} else if (!this.prefix) {
|
|
3959
3951
|
(document.cancelFullScreen || document.exitFullscreen).call(document);
|
|
@@ -3962,12 +3954,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
3962
3954
|
document[`${this.prefix}${action}${this.property}`]();
|
|
3963
3955
|
}
|
|
3964
3956
|
});
|
|
3957
|
+
// Toggle state
|
|
3965
3958
|
_defineProperty$1(this, "toggle", () => {
|
|
3966
|
-
if (!this.active)
|
|
3967
|
-
this.enter();
|
|
3968
|
-
} else {
|
|
3969
|
-
this.exit();
|
|
3970
|
-
}
|
|
3959
|
+
if (!this.active) this.enter();else this.exit();
|
|
3971
3960
|
});
|
|
3972
3961
|
// Keep reference to parent
|
|
3973
3962
|
this.player = player;
|
|
@@ -4010,26 +3999,22 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4010
3999
|
|
|
4011
4000
|
// Update the UI
|
|
4012
4001
|
this.update();
|
|
4013
|
-
|
|
4014
|
-
// this.toggle = this.toggle.bind(this);
|
|
4015
4002
|
}
|
|
4016
4003
|
|
|
4017
4004
|
// Determine if native supported
|
|
4018
|
-
static get
|
|
4005
|
+
static get nativeSupported() {
|
|
4019
4006
|
return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
|
|
4020
4007
|
}
|
|
4021
4008
|
|
|
4022
4009
|
// If we're actually using native
|
|
4023
|
-
get
|
|
4024
|
-
return Fullscreen.
|
|
4010
|
+
get useNative() {
|
|
4011
|
+
return Fullscreen.nativeSupported && !this.forceFallback;
|
|
4025
4012
|
}
|
|
4026
4013
|
|
|
4027
4014
|
// Get the prefix for handlers
|
|
4028
4015
|
static get prefix() {
|
|
4029
4016
|
// No prefix
|
|
4030
|
-
if (is.function(document.exitFullscreen))
|
|
4031
|
-
return '';
|
|
4032
|
-
}
|
|
4017
|
+
if (is.function(document.exitFullscreen)) return '';
|
|
4033
4018
|
|
|
4034
4019
|
// Check for fullscreen support by vendor prefix
|
|
4035
4020
|
let value = '';
|
|
@@ -4047,19 +4032,26 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4047
4032
|
return this.prefix === 'moz' ? 'FullScreen' : 'Fullscreen';
|
|
4048
4033
|
}
|
|
4049
4034
|
|
|
4050
|
-
// Determine if fullscreen is
|
|
4051
|
-
get
|
|
4052
|
-
return
|
|
4035
|
+
// Determine if fullscreen is supported
|
|
4036
|
+
get supported() {
|
|
4037
|
+
return [
|
|
4038
|
+
// Fullscreen is enabled in config
|
|
4039
|
+
this.player.config.fullscreen.enabled,
|
|
4040
|
+
// Must be a video
|
|
4041
|
+
this.player.isVideo,
|
|
4042
|
+
// Either native is supported or fallback enabled
|
|
4043
|
+
Fullscreen.nativeSupported || this.player.config.fullscreen.fallback,
|
|
4044
|
+
// YouTube has no way to trigger fullscreen, so on devices with no native support, playsinline
|
|
4045
|
+
// must be enabled and iosNative fullscreen must be disabled to offer the fullscreen fallback
|
|
4046
|
+
!this.player.isYouTube || Fullscreen.nativeSupported || !browser.isIos || this.player.config.playsinline && !this.player.config.fullscreen.iosNative].every(Boolean);
|
|
4053
4047
|
}
|
|
4054
4048
|
|
|
4055
4049
|
// Get active state
|
|
4056
4050
|
get active() {
|
|
4057
|
-
if (!this.
|
|
4058
|
-
return false;
|
|
4059
|
-
}
|
|
4051
|
+
if (!this.supported) return false;
|
|
4060
4052
|
|
|
4061
4053
|
// Fallback using classname
|
|
4062
|
-
if (!Fullscreen.
|
|
4054
|
+
if (!Fullscreen.nativeSupported || this.forceFallback) {
|
|
4063
4055
|
return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);
|
|
4064
4056
|
}
|
|
4065
4057
|
const element = !this.prefix ? this.target.getRootNode().fullscreenElement : this.target.getRootNode()[`${this.prefix}${this.property}Element`];
|
|
@@ -4068,7 +4060,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4068
4060
|
|
|
4069
4061
|
// Get target element
|
|
4070
4062
|
get target() {
|
|
4071
|
-
return browser.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen
|
|
4063
|
+
return browser.isIos && this.player.config.fullscreen.iosNative ? this.player.media : this.player.elements.fullscreen ?? this.player.elements.container;
|
|
4072
4064
|
}
|
|
4073
4065
|
}
|
|
4074
4066
|
|
|
@@ -4175,9 +4167,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4175
4167
|
// Check for airplay support
|
|
4176
4168
|
toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5);
|
|
4177
4169
|
|
|
4178
|
-
// Add iOS class
|
|
4179
|
-
toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos);
|
|
4180
|
-
|
|
4181
4170
|
// Add touch class
|
|
4182
4171
|
toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch);
|
|
4183
4172
|
|
|
@@ -4356,6 +4345,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4356
4345
|
|
|
4357
4346
|
class Listeners {
|
|
4358
4347
|
constructor(_player) {
|
|
4348
|
+
// Device is touch enabled
|
|
4359
4349
|
_defineProperty$1(this, "firstTouch", () => {
|
|
4360
4350
|
const {
|
|
4361
4351
|
player
|
|
@@ -4368,62 +4358,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4368
4358
|
// Add touch class
|
|
4369
4359
|
toggleClass(elements.container, player.config.classNames.isTouch, true);
|
|
4370
4360
|
});
|
|
4371
|
-
|
|
4372
|
-
const {
|
|
4373
|
-
player
|
|
4374
|
-
} = this;
|
|
4375
|
-
const {
|
|
4376
|
-
elements
|
|
4377
|
-
} = player;
|
|
4378
|
-
const {
|
|
4379
|
-
key,
|
|
4380
|
-
type,
|
|
4381
|
-
timeStamp
|
|
4382
|
-
} = event;
|
|
4383
|
-
clearTimeout(this.focusTimer);
|
|
4384
|
-
|
|
4385
|
-
// Ignore any key other than tab
|
|
4386
|
-
if (type === 'keydown' && key !== 'Tab') {
|
|
4387
|
-
return;
|
|
4388
|
-
}
|
|
4389
|
-
|
|
4390
|
-
// Store reference to event timeStamp
|
|
4391
|
-
if (type === 'keydown') {
|
|
4392
|
-
this.lastKeyDown = timeStamp;
|
|
4393
|
-
}
|
|
4394
|
-
|
|
4395
|
-
// Remove current classes
|
|
4396
|
-
const removeCurrent = () => {
|
|
4397
|
-
const className = player.config.classNames.tabFocus;
|
|
4398
|
-
const current = getElements.call(player, `.${className}`);
|
|
4399
|
-
toggleClass(current, className, false);
|
|
4400
|
-
};
|
|
4401
|
-
|
|
4402
|
-
// Determine if a key was pressed to trigger this event
|
|
4403
|
-
const wasKeyDown = timeStamp - this.lastKeyDown <= 20;
|
|
4404
|
-
|
|
4405
|
-
// Ignore focus events if a key was pressed prior
|
|
4406
|
-
if (type === 'focus' && !wasKeyDown) {
|
|
4407
|
-
return;
|
|
4408
|
-
}
|
|
4409
|
-
|
|
4410
|
-
// Remove all current
|
|
4411
|
-
removeCurrent();
|
|
4412
|
-
|
|
4413
|
-
// Delay the adding of classname until the focus has changed
|
|
4414
|
-
// This event fires before the focusin event
|
|
4415
|
-
if (type !== 'focusout') {
|
|
4416
|
-
this.focusTimer = setTimeout(() => {
|
|
4417
|
-
const focused = document.activeElement;
|
|
4418
|
-
|
|
4419
|
-
// Ignore if current focus element isn't inside the player
|
|
4420
|
-
if (!elements.container.contains(focused)) {
|
|
4421
|
-
return;
|
|
4422
|
-
}
|
|
4423
|
-
toggleClass(document.activeElement, player.config.classNames.tabFocus, true);
|
|
4424
|
-
}, 10);
|
|
4425
|
-
}
|
|
4426
|
-
});
|
|
4361
|
+
// Global window & document listeners
|
|
4427
4362
|
_defineProperty$1(this, "global", (toggle = true) => {
|
|
4428
4363
|
const {
|
|
4429
4364
|
player
|
|
@@ -4439,10 +4374,8 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4439
4374
|
|
|
4440
4375
|
// Detect touch by events
|
|
4441
4376
|
once.call(player, document.body, 'touchstart', this.firstTouch);
|
|
4442
|
-
|
|
4443
|
-
// Tab focus detection
|
|
4444
|
-
toggleListener.call(player, document.body, 'keydown focus blur focusout', this.setTabFocus, toggle, false, true);
|
|
4445
4377
|
});
|
|
4378
|
+
// Container listeners
|
|
4446
4379
|
_defineProperty$1(this, "container", () => {
|
|
4447
4380
|
const {
|
|
4448
4381
|
player
|
|
@@ -4550,6 +4483,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4550
4483
|
method.call(player, window, 'resize', resized);
|
|
4551
4484
|
});
|
|
4552
4485
|
});
|
|
4486
|
+
// Listen for media events
|
|
4553
4487
|
_defineProperty$1(this, "media", () => {
|
|
4554
4488
|
const {
|
|
4555
4489
|
player
|
|
@@ -4677,6 +4611,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4677
4611
|
triggerEvent.call(player, elements.container, event.type, true, detail);
|
|
4678
4612
|
});
|
|
4679
4613
|
});
|
|
4614
|
+
// Run default and custom handlers
|
|
4680
4615
|
_defineProperty$1(this, "proxy", (event, defaultHandler, customHandlerKey) => {
|
|
4681
4616
|
const {
|
|
4682
4617
|
player
|
|
@@ -4695,6 +4630,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4695
4630
|
defaultHandler.call(player, event);
|
|
4696
4631
|
}
|
|
4697
4632
|
});
|
|
4633
|
+
// Trigger custom and default handlers
|
|
4698
4634
|
_defineProperty$1(this, "bind", (element, type, defaultHandler, customHandlerKey, passive = true) => {
|
|
4699
4635
|
const {
|
|
4700
4636
|
player
|
|
@@ -4703,6 +4639,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4703
4639
|
const hasCustomHandler = is.function(customHandler);
|
|
4704
4640
|
on.call(player, element, type, event => this.proxy(event, defaultHandler, customHandlerKey), passive && !hasCustomHandler);
|
|
4705
4641
|
});
|
|
4642
|
+
// Listen for control events
|
|
4706
4643
|
_defineProperty$1(this, "controls", () => {
|
|
4707
4644
|
const {
|
|
4708
4645
|
player
|
|
@@ -4777,7 +4714,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4777
4714
|
// We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
|
|
4778
4715
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
|
|
4779
4716
|
this.bind(elements.buttons.settings, 'keyup', event => {
|
|
4780
|
-
if (!['
|
|
4717
|
+
if (![' ', 'Enter'].includes(event.key)) {
|
|
4781
4718
|
return;
|
|
4782
4719
|
}
|
|
4783
4720
|
|
|
@@ -4901,7 +4838,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
4901
4838
|
});
|
|
4902
4839
|
|
|
4903
4840
|
// Polyfill for lower fill in <input type="range"> for webkit
|
|
4904
|
-
if (browser.
|
|
4841
|
+
if (browser.isWebKit) {
|
|
4905
4842
|
Array.from(getElements.call(player, 'input[type="range"]')).forEach(element => {
|
|
4906
4843
|
this.bind(element, 'input', event => controls.updateRangeFill.call(player, event.target));
|
|
4907
4844
|
});
|
|
@@ -5002,7 +4939,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5002
4939
|
this.lastKeyDown = null;
|
|
5003
4940
|
this.handleKey = this.handleKey.bind(this);
|
|
5004
4941
|
this.toggleMenu = this.toggleMenu.bind(this);
|
|
5005
|
-
this.setTabFocus = this.setTabFocus.bind(this);
|
|
5006
4942
|
this.firstTouch = this.firstTouch.bind(this);
|
|
5007
4943
|
}
|
|
5008
4944
|
|
|
@@ -5059,13 +4995,13 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5059
4995
|
if (focused !== seek && matches(focused, editable)) {
|
|
5060
4996
|
return;
|
|
5061
4997
|
}
|
|
5062
|
-
if (event.key === '
|
|
4998
|
+
if (event.key === ' ' && matches(focused, 'button, [role^="menuitem"]')) {
|
|
5063
4999
|
return;
|
|
5064
5000
|
}
|
|
5065
5001
|
}
|
|
5066
5002
|
|
|
5067
5003
|
// Which keys should we prevent default
|
|
5068
|
-
const preventDefault = ['
|
|
5004
|
+
const preventDefault = [' ', 'ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'c', 'f', 'k', 'l', 'm'];
|
|
5069
5005
|
|
|
5070
5006
|
// If the key is found prevent default (e.g. prevent scrolling for arrows)
|
|
5071
5007
|
if (preventDefault.includes(key)) {
|
|
@@ -5087,7 +5023,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5087
5023
|
seekByIncrement(parseInt(key, 10));
|
|
5088
5024
|
}
|
|
5089
5025
|
break;
|
|
5090
|
-
case '
|
|
5026
|
+
case ' ':
|
|
5091
5027
|
case 'k':
|
|
5092
5028
|
if (!repeat) {
|
|
5093
5029
|
silencePromise(player.togglePlay());
|
|
@@ -5140,8 +5076,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5140
5076
|
toggleMenu(event) {
|
|
5141
5077
|
controls.toggleMenu.call(this.player, event);
|
|
5142
5078
|
}
|
|
5143
|
-
|
|
5144
|
-
// Device is touch enabled
|
|
5145
5079
|
}
|
|
5146
5080
|
|
|
5147
5081
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -5553,7 +5487,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5553
5487
|
autoplay: player.autoplay,
|
|
5554
5488
|
muted: player.muted,
|
|
5555
5489
|
gesture: 'media',
|
|
5556
|
-
playsinline:
|
|
5490
|
+
playsinline: player.config.playsinline,
|
|
5557
5491
|
// hash has to be added to iframe-URL
|
|
5558
5492
|
...hashParam,
|
|
5559
5493
|
...frameParams
|
|
@@ -5704,7 +5638,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5704
5638
|
},
|
|
5705
5639
|
set(input) {
|
|
5706
5640
|
const toggle = is.boolean(input) ? input : false;
|
|
5707
|
-
player.embed.
|
|
5641
|
+
player.embed.setMuted(toggle ? true : player.config.muted).then(() => {
|
|
5708
5642
|
muted = toggle;
|
|
5709
5643
|
triggerEvent.call(player, player.media, 'volumechange');
|
|
5710
5644
|
});
|
|
@@ -5977,7 +5911,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
5977
5911
|
const posterSrc = s => `https://i.ytimg.com/vi/${videoId}/${s}default.jpg`;
|
|
5978
5912
|
|
|
5979
5913
|
// Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
|
|
5980
|
-
loadImage(posterSrc('maxres'), 121) //
|
|
5914
|
+
loadImage(posterSrc('maxres'), 121) // Highest quality and un-padded
|
|
5981
5915
|
.catch(() => loadImage(posterSrc('sd'), 121)) // 480p padded 4:3
|
|
5982
5916
|
.catch(() => loadImage(posterSrc('hq'))) // 360p padded 4:3. Always exists
|
|
5983
5917
|
.then(image => ui.setPoster.call(player, image.src)).then(src => {
|
|
@@ -6003,7 +5937,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6003
5937
|
// Disable keyboard as we handle it
|
|
6004
5938
|
disablekb: 1,
|
|
6005
5939
|
// Allow iOS inline playback
|
|
6006
|
-
playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
|
|
5940
|
+
playsinline: player.config.playsinline && !player.config.fullscreen.iosNative ? 1 : 0,
|
|
6007
5941
|
// Captions are flaky on YouTube
|
|
6008
5942
|
cc_load_policy: player.captions.active ? 1 : 0,
|
|
6009
5943
|
cc_lang_pref: player.config.captions.language,
|
|
@@ -6022,7 +5956,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6022
5956
|
100: 'The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.',
|
|
6023
5957
|
101: 'The owner of the requested video does not allow it to be played in embedded players.',
|
|
6024
5958
|
150: 'The owner of the requested video does not allow it to be played in embedded players.'
|
|
6025
|
-
}[code] || 'An unknown error
|
|
5959
|
+
}[code] || 'An unknown error occurred';
|
|
6026
5960
|
player.media.error = {
|
|
6027
5961
|
code,
|
|
6028
5962
|
message
|
|
@@ -6334,6 +6268,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6334
6268
|
* @return {Ads}
|
|
6335
6269
|
*/
|
|
6336
6270
|
constructor(player) {
|
|
6271
|
+
/**
|
|
6272
|
+
* Load the IMA SDK
|
|
6273
|
+
*/
|
|
6337
6274
|
_defineProperty$1(this, "load", () => {
|
|
6338
6275
|
if (!this.enabled) {
|
|
6339
6276
|
return;
|
|
@@ -6351,6 +6288,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6351
6288
|
this.ready();
|
|
6352
6289
|
}
|
|
6353
6290
|
});
|
|
6291
|
+
/**
|
|
6292
|
+
* Get the ads instance ready
|
|
6293
|
+
*/
|
|
6354
6294
|
_defineProperty$1(this, "ready", () => {
|
|
6355
6295
|
// Double check we're enabled
|
|
6356
6296
|
if (!this.enabled) {
|
|
@@ -6372,6 +6312,14 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6372
6312
|
// Setup the IMA SDK
|
|
6373
6313
|
this.setupIMA();
|
|
6374
6314
|
});
|
|
6315
|
+
/**
|
|
6316
|
+
* In order for the SDK to display ads for our video, we need to tell it where to put them,
|
|
6317
|
+
* so here we define our ad container. This div is set up to render on top of the video player.
|
|
6318
|
+
* Using the code below, we tell the SDK to render ads within that div. We also provide a
|
|
6319
|
+
* handle to the content video player - the SDK will poll the current time of our player to
|
|
6320
|
+
* properly place mid-rolls. After we create the ad display container, we initialize it. On
|
|
6321
|
+
* mobile devices, this initialization is done as the result of a user action.
|
|
6322
|
+
*/
|
|
6375
6323
|
_defineProperty$1(this, "setupIMA", () => {
|
|
6376
6324
|
// Create the container for our advertisements
|
|
6377
6325
|
this.elements.container = createElement('div', {
|
|
@@ -6401,6 +6349,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6401
6349
|
// Request video ads to be pre-loaded
|
|
6402
6350
|
this.requestAds();
|
|
6403
6351
|
});
|
|
6352
|
+
/**
|
|
6353
|
+
* Request advertisements
|
|
6354
|
+
*/
|
|
6404
6355
|
_defineProperty$1(this, "requestAds", () => {
|
|
6405
6356
|
const {
|
|
6406
6357
|
container
|
|
@@ -6427,6 +6378,10 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6427
6378
|
this.onAdError(error);
|
|
6428
6379
|
}
|
|
6429
6380
|
});
|
|
6381
|
+
/**
|
|
6382
|
+
* Update the ad countdown
|
|
6383
|
+
* @param {Boolean} start
|
|
6384
|
+
*/
|
|
6430
6385
|
_defineProperty$1(this, "pollCountdown", (start = false) => {
|
|
6431
6386
|
if (!start) {
|
|
6432
6387
|
clearInterval(this.countdownTimer);
|
|
@@ -6440,6 +6395,10 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6440
6395
|
};
|
|
6441
6396
|
this.countdownTimer = setInterval(update, 100);
|
|
6442
6397
|
});
|
|
6398
|
+
/**
|
|
6399
|
+
* This method is called whenever the ads are ready inside the AdDisplayContainer
|
|
6400
|
+
* @param {Event} event - adsManagerLoadedEvent
|
|
6401
|
+
*/
|
|
6443
6402
|
_defineProperty$1(this, "onAdsManagerLoaded", event => {
|
|
6444
6403
|
// Load could occur after a source change (race condition)
|
|
6445
6404
|
if (!this.enabled) {
|
|
@@ -6490,6 +6449,12 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6490
6449
|
});
|
|
6491
6450
|
}
|
|
6492
6451
|
});
|
|
6452
|
+
/**
|
|
6453
|
+
* This is where all the event handling takes place. Retrieve the ad from the event. Some
|
|
6454
|
+
* events (e.g. ALL_ADS_COMPLETED) don't have the ad object associated
|
|
6455
|
+
* https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.AdEvent.Type
|
|
6456
|
+
* @param {Event} event
|
|
6457
|
+
*/
|
|
6493
6458
|
_defineProperty$1(this, "onAdEvent", event => {
|
|
6494
6459
|
const {
|
|
6495
6460
|
container
|
|
@@ -6585,10 +6550,19 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6585
6550
|
break;
|
|
6586
6551
|
}
|
|
6587
6552
|
});
|
|
6553
|
+
/**
|
|
6554
|
+
* Any ad error handling comes through here
|
|
6555
|
+
* @param {Event} event
|
|
6556
|
+
*/
|
|
6588
6557
|
_defineProperty$1(this, "onAdError", event => {
|
|
6589
6558
|
this.cancel();
|
|
6590
6559
|
this.player.debug.warn('Ads error', event);
|
|
6591
6560
|
});
|
|
6561
|
+
/**
|
|
6562
|
+
* Setup hooks for Plyr and window events. This ensures
|
|
6563
|
+
* the mid- and post-roll launch at the correct time. And
|
|
6564
|
+
* resize the advertisement when the player resizes
|
|
6565
|
+
*/
|
|
6592
6566
|
_defineProperty$1(this, "listeners", () => {
|
|
6593
6567
|
const {
|
|
6594
6568
|
container
|
|
@@ -6624,6 +6598,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6624
6598
|
}
|
|
6625
6599
|
});
|
|
6626
6600
|
});
|
|
6601
|
+
/**
|
|
6602
|
+
* Initialize the adsManager and start playing advertisements
|
|
6603
|
+
*/
|
|
6627
6604
|
_defineProperty$1(this, "play", () => {
|
|
6628
6605
|
const {
|
|
6629
6606
|
container
|
|
@@ -6656,6 +6633,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6656
6633
|
}
|
|
6657
6634
|
}).catch(() => {});
|
|
6658
6635
|
});
|
|
6636
|
+
/**
|
|
6637
|
+
* Resume our video
|
|
6638
|
+
*/
|
|
6659
6639
|
_defineProperty$1(this, "resumeContent", () => {
|
|
6660
6640
|
// Hide the advertisement container
|
|
6661
6641
|
this.elements.container.style.zIndex = '';
|
|
@@ -6666,6 +6646,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6666
6646
|
// Play video
|
|
6667
6647
|
silencePromise(this.player.media.play());
|
|
6668
6648
|
});
|
|
6649
|
+
/**
|
|
6650
|
+
* Pause our video
|
|
6651
|
+
*/
|
|
6669
6652
|
_defineProperty$1(this, "pauseContent", () => {
|
|
6670
6653
|
// Show the advertisement container
|
|
6671
6654
|
this.elements.container.style.zIndex = 3;
|
|
@@ -6676,6 +6659,12 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6676
6659
|
// Pause our video.
|
|
6677
6660
|
this.player.media.pause();
|
|
6678
6661
|
});
|
|
6662
|
+
/**
|
|
6663
|
+
* Destroy the adsManager so we can grab new ads after this. If we don't then we're not
|
|
6664
|
+
* allowed to call new ads based on google policies, as they interpret this as an accidental
|
|
6665
|
+
* video requests. https://developers.google.com/interactive-
|
|
6666
|
+
* media-ads/docs/sdks/android/faq#8
|
|
6667
|
+
*/
|
|
6679
6668
|
_defineProperty$1(this, "cancel", () => {
|
|
6680
6669
|
// Pause our video
|
|
6681
6670
|
if (this.initialized) {
|
|
@@ -6688,6 +6677,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6688
6677
|
// Re-create our adsManager
|
|
6689
6678
|
this.loadAds();
|
|
6690
6679
|
});
|
|
6680
|
+
/**
|
|
6681
|
+
* Re-create our adsManager
|
|
6682
|
+
*/
|
|
6691
6683
|
_defineProperty$1(this, "loadAds", () => {
|
|
6692
6684
|
// Tell our adsManager to go bye bye
|
|
6693
6685
|
this.managerPromise.then(() => {
|
|
@@ -6708,6 +6700,11 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6708
6700
|
this.requestAds();
|
|
6709
6701
|
}).catch(() => {});
|
|
6710
6702
|
});
|
|
6703
|
+
/**
|
|
6704
|
+
* Handles callbacks after an ad event was invoked
|
|
6705
|
+
* @param {String} event - Event type
|
|
6706
|
+
* @param args
|
|
6707
|
+
*/
|
|
6711
6708
|
_defineProperty$1(this, "trigger", (event, ...args) => {
|
|
6712
6709
|
const handlers = this.events[event];
|
|
6713
6710
|
if (is.array(handlers)) {
|
|
@@ -6718,6 +6715,12 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6718
6715
|
});
|
|
6719
6716
|
}
|
|
6720
6717
|
});
|
|
6718
|
+
/**
|
|
6719
|
+
* Add event listeners
|
|
6720
|
+
* @param {String} event - Event type
|
|
6721
|
+
* @param {Function} callback - Callback for when event occurs
|
|
6722
|
+
* @return {Ads}
|
|
6723
|
+
*/
|
|
6721
6724
|
_defineProperty$1(this, "on", (event, callback) => {
|
|
6722
6725
|
if (!is.array(this.events[event])) {
|
|
6723
6726
|
this.events[event] = [];
|
|
@@ -6725,6 +6728,14 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6725
6728
|
this.events[event].push(callback);
|
|
6726
6729
|
return this;
|
|
6727
6730
|
});
|
|
6731
|
+
/**
|
|
6732
|
+
* Setup a safety timer for when the ad network doesn't respond for whatever reason.
|
|
6733
|
+
* The advertisement has 12 seconds to get its things together. We stop this timer when the
|
|
6734
|
+
* advertisement is playing, or when a user action is required to start, then we clear the
|
|
6735
|
+
* timer on ad ready
|
|
6736
|
+
* @param {Number} time
|
|
6737
|
+
* @param {String} from
|
|
6738
|
+
*/
|
|
6728
6739
|
_defineProperty$1(this, "startSafetyTimer", (time, from) => {
|
|
6729
6740
|
this.player.debug.log(`Safety timer invoked from: ${from}`);
|
|
6730
6741
|
this.safetyTimer = setTimeout(() => {
|
|
@@ -6732,6 +6743,10 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6732
6743
|
this.clearSafetyTimer('startSafetyTimer()');
|
|
6733
6744
|
}, time);
|
|
6734
6745
|
});
|
|
6746
|
+
/**
|
|
6747
|
+
* Clear our safety timer(s)
|
|
6748
|
+
* @param {String} from
|
|
6749
|
+
*/
|
|
6735
6750
|
_defineProperty$1(this, "clearSafetyTimer", from => {
|
|
6736
6751
|
if (!is.nullOrUndefined(this.safetyTimer)) {
|
|
6737
6752
|
this.player.debug.log(`Safety timer cleared from: ${from}`);
|
|
@@ -6770,11 +6785,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6770
6785
|
} = this;
|
|
6771
6786
|
return this.player.isHTML5 && this.player.isVideo && config.enabled && (!is.empty(config.publisherId) || is.url(config.tagUrl));
|
|
6772
6787
|
}
|
|
6773
|
-
|
|
6774
|
-
/**
|
|
6775
|
-
* Load the IMA SDK
|
|
6776
|
-
*/
|
|
6777
|
-
|
|
6778
6788
|
// Build the tag URL
|
|
6779
6789
|
get tagUrl() {
|
|
6780
6790
|
const {
|
|
@@ -6795,15 +6805,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6795
6805
|
const base = 'https://go.aniview.com/api/adserver6/vast/';
|
|
6796
6806
|
return `${base}?${buildUrlParams(params)}`;
|
|
6797
6807
|
}
|
|
6798
|
-
|
|
6799
|
-
/**
|
|
6800
|
-
* In order for the SDK to display ads for our video, we need to tell it where to put them,
|
|
6801
|
-
* so here we define our ad container. This div is set up to render on top of the video player.
|
|
6802
|
-
* Using the code below, we tell the SDK to render ads within that div. We also provide a
|
|
6803
|
-
* handle to the content video player - the SDK will poll the current time of our player to
|
|
6804
|
-
* properly place mid-rolls. After we create the ad display container, we initialize it. On
|
|
6805
|
-
* mobile devices, this initialization is done as the result of a user action.
|
|
6806
|
-
*/
|
|
6807
6808
|
}
|
|
6808
6809
|
|
|
6809
6810
|
/**
|
|
@@ -6902,9 +6903,13 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6902
6903
|
|
|
6903
6904
|
// Check to see if thumb container size was specified manually in CSS
|
|
6904
6905
|
this.determineContainerAutoSizing();
|
|
6906
|
+
|
|
6907
|
+
// Set up listeners
|
|
6908
|
+
this.listeners();
|
|
6905
6909
|
this.loaded = true;
|
|
6906
6910
|
});
|
|
6907
6911
|
});
|
|
6912
|
+
// Download VTT files and parse them
|
|
6908
6913
|
_defineProperty$1(this, "getThumbnails", () => {
|
|
6909
6914
|
return new Promise(resolve => {
|
|
6910
6915
|
const {
|
|
@@ -6940,6 +6945,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
6940
6945
|
}
|
|
6941
6946
|
});
|
|
6942
6947
|
});
|
|
6948
|
+
// Process individual VTT file
|
|
6943
6949
|
_defineProperty$1(this, "getThumbnail", url => {
|
|
6944
6950
|
return new Promise(resolve => {
|
|
6945
6951
|
fetch(url).then(response => {
|
|
@@ -7046,6 +7052,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7046
7052
|
});
|
|
7047
7053
|
}
|
|
7048
7054
|
});
|
|
7055
|
+
/**
|
|
7056
|
+
* Setup hooks for Plyr and window events
|
|
7057
|
+
*/
|
|
7049
7058
|
_defineProperty$1(this, "listeners", () => {
|
|
7050
7059
|
// Hide thumbnail preview - on mouse click, mouse leave (in listeners.js for now), and video play/seek. All four are required, e.g., for buffering
|
|
7051
7060
|
this.player.on('play', () => {
|
|
@@ -7058,6 +7067,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7058
7067
|
this.lastTime = this.player.media.currentTime;
|
|
7059
7068
|
});
|
|
7060
7069
|
});
|
|
7070
|
+
/**
|
|
7071
|
+
* Create HTML elements for image containers
|
|
7072
|
+
*/
|
|
7061
7073
|
_defineProperty$1(this, "render", () => {
|
|
7062
7074
|
// Create HTML element: plyr__preview-thumbnail-container
|
|
7063
7075
|
this.elements.thumb.container = createElement('div', {
|
|
@@ -7133,6 +7145,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7133
7145
|
this.loadImage(qualityIndex);
|
|
7134
7146
|
}
|
|
7135
7147
|
});
|
|
7148
|
+
// Show the image that's currently specified in this.showingThumb
|
|
7136
7149
|
_defineProperty$1(this, "loadImage", (qualityIndex = 0) => {
|
|
7137
7150
|
const thumbNum = this.showingThumb;
|
|
7138
7151
|
const thumbnail = this.thumbnails[qualityIndex];
|
|
@@ -7186,6 +7199,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7186
7199
|
// Each step here has a short time delay, and only continues if still hovering/seeking the same spot. This is to protect slow connections from overloading
|
|
7187
7200
|
this.preloadNearby(thumbNum, true).then(this.preloadNearby(thumbNum, false)).then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename));
|
|
7188
7201
|
});
|
|
7202
|
+
// Remove all preview images that aren't the designated current image
|
|
7189
7203
|
_defineProperty$1(this, "removeOldImages", currentImage => {
|
|
7190
7204
|
// Get a list of all images, convert it from a DOM list to an array
|
|
7191
7205
|
Array.from(this.currentImageContainer.children).forEach(image => {
|
|
@@ -7210,6 +7224,8 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7210
7224
|
}
|
|
7211
7225
|
});
|
|
7212
7226
|
});
|
|
7227
|
+
// Preload images before and after the current one. Only if the user is still hovering/seeking the same frame
|
|
7228
|
+
// This will only preload the lowest quality
|
|
7213
7229
|
_defineProperty$1(this, "preloadNearby", (thumbNum, forward = true) => {
|
|
7214
7230
|
return new Promise(resolve => {
|
|
7215
7231
|
setTimeout(() => {
|
|
@@ -7255,6 +7271,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7255
7271
|
}, 300);
|
|
7256
7272
|
});
|
|
7257
7273
|
});
|
|
7274
|
+
// If user has been hovering current image for half a second, look for a higher quality one
|
|
7258
7275
|
_defineProperty$1(this, "getHigherQuality", (currentQualityIndex, previewImage, frame, thumbFilename) => {
|
|
7259
7276
|
if (currentQualityIndex < this.thumbnails.length - 1) {
|
|
7260
7277
|
// Only use the higher quality version if it's going to look any better - if the current thumb is of a lower pixel density than the thumbnail container
|
|
@@ -7296,6 +7313,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7296
7313
|
this.sizeSpecifiedInCSS = true;
|
|
7297
7314
|
}
|
|
7298
7315
|
});
|
|
7316
|
+
// Set the size to be about a quarter of the size of video. Unless option dynamicSize === false, in which case it needs to be set in CSS
|
|
7299
7317
|
_defineProperty$1(this, "setThumbContainerSizeAndPos", () => {
|
|
7300
7318
|
const {
|
|
7301
7319
|
imageContainer
|
|
@@ -7332,6 +7350,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7332
7350
|
// The arrow can follow the cursor
|
|
7333
7351
|
container.style.setProperty('--preview-arrow-offset', `${position - clamped}px`);
|
|
7334
7352
|
});
|
|
7353
|
+
// Can't use 100% width, in case the video is a different aspect ratio to the video container
|
|
7335
7354
|
_defineProperty$1(this, "setScrubbingContainerSize", () => {
|
|
7336
7355
|
const {
|
|
7337
7356
|
width,
|
|
@@ -7343,6 +7362,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7343
7362
|
this.elements.scrubbing.container.style.width = `${width}px`;
|
|
7344
7363
|
this.elements.scrubbing.container.style.height = `${height}px`;
|
|
7345
7364
|
});
|
|
7365
|
+
// Sprites need to be offset to the correct location
|
|
7346
7366
|
_defineProperty$1(this, "setImageSizeAndOffset", (previewImage, frame) => {
|
|
7347
7367
|
if (!this.usingSprites) return;
|
|
7348
7368
|
|
|
@@ -7567,6 +7587,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7567
7587
|
// Plyr instance
|
|
7568
7588
|
class Plyr {
|
|
7569
7589
|
constructor(target, options) {
|
|
7590
|
+
/**
|
|
7591
|
+
* Play the media, or play the advertisement (if they are not blocked)
|
|
7592
|
+
*/
|
|
7570
7593
|
_defineProperty$1(this, "play", () => {
|
|
7571
7594
|
if (!is.function(this.media.play)) {
|
|
7572
7595
|
return null;
|
|
@@ -7580,12 +7603,19 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7580
7603
|
// Return the promise (for HTML5)
|
|
7581
7604
|
return this.media.play();
|
|
7582
7605
|
});
|
|
7606
|
+
/**
|
|
7607
|
+
* Pause the media
|
|
7608
|
+
*/
|
|
7583
7609
|
_defineProperty$1(this, "pause", () => {
|
|
7584
7610
|
if (!this.playing || !is.function(this.media.pause)) {
|
|
7585
7611
|
return null;
|
|
7586
7612
|
}
|
|
7587
7613
|
return this.media.pause();
|
|
7588
7614
|
});
|
|
7615
|
+
/**
|
|
7616
|
+
* Toggle playback based on current status
|
|
7617
|
+
* @param {Boolean} input
|
|
7618
|
+
*/
|
|
7589
7619
|
_defineProperty$1(this, "togglePlay", input => {
|
|
7590
7620
|
// Toggle based on current state if nothing passed
|
|
7591
7621
|
const toggle = is.boolean(input) ? input : !this.playing;
|
|
@@ -7594,6 +7624,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7594
7624
|
}
|
|
7595
7625
|
return this.pause();
|
|
7596
7626
|
});
|
|
7627
|
+
/**
|
|
7628
|
+
* Stop playback
|
|
7629
|
+
*/
|
|
7597
7630
|
_defineProperty$1(this, "stop", () => {
|
|
7598
7631
|
if (this.isHTML5) {
|
|
7599
7632
|
this.pause();
|
|
@@ -7602,28 +7635,55 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7602
7635
|
this.media.stop();
|
|
7603
7636
|
}
|
|
7604
7637
|
});
|
|
7638
|
+
/**
|
|
7639
|
+
* Restart playback
|
|
7640
|
+
*/
|
|
7605
7641
|
_defineProperty$1(this, "restart", () => {
|
|
7606
7642
|
this.currentTime = 0;
|
|
7607
7643
|
});
|
|
7644
|
+
/**
|
|
7645
|
+
* Rewind
|
|
7646
|
+
* @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
|
|
7647
|
+
*/
|
|
7608
7648
|
_defineProperty$1(this, "rewind", seekTime => {
|
|
7609
7649
|
this.currentTime -= is.number(seekTime) ? seekTime : this.config.seekTime;
|
|
7610
7650
|
});
|
|
7651
|
+
/**
|
|
7652
|
+
* Fast forward
|
|
7653
|
+
* @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
|
|
7654
|
+
*/
|
|
7611
7655
|
_defineProperty$1(this, "forward", seekTime => {
|
|
7612
7656
|
this.currentTime += is.number(seekTime) ? seekTime : this.config.seekTime;
|
|
7613
7657
|
});
|
|
7658
|
+
/**
|
|
7659
|
+
* Increase volume
|
|
7660
|
+
* @param {Boolean} step - How much to decrease by (between 0 and 1)
|
|
7661
|
+
*/
|
|
7614
7662
|
_defineProperty$1(this, "increaseVolume", step => {
|
|
7615
7663
|
const volume = this.media.muted ? 0 : this.volume;
|
|
7616
7664
|
this.volume = volume + (is.number(step) ? step : 0);
|
|
7617
7665
|
});
|
|
7666
|
+
/**
|
|
7667
|
+
* Decrease volume
|
|
7668
|
+
* @param {Boolean} step - How much to decrease by (between 0 and 1)
|
|
7669
|
+
*/
|
|
7618
7670
|
_defineProperty$1(this, "decreaseVolume", step => {
|
|
7619
7671
|
this.increaseVolume(-step);
|
|
7620
7672
|
});
|
|
7673
|
+
/**
|
|
7674
|
+
* Trigger the airplay dialog
|
|
7675
|
+
* TODO: update player with state, support, enabled
|
|
7676
|
+
*/
|
|
7621
7677
|
_defineProperty$1(this, "airplay", () => {
|
|
7622
7678
|
// Show dialog if supported
|
|
7623
7679
|
if (support.airplay) {
|
|
7624
7680
|
this.media.webkitShowPlaybackTargetPicker();
|
|
7625
7681
|
}
|
|
7626
7682
|
});
|
|
7683
|
+
/**
|
|
7684
|
+
* Toggle the player controls
|
|
7685
|
+
* @param {Boolean} [toggle] - Whether to show the controls
|
|
7686
|
+
*/
|
|
7627
7687
|
_defineProperty$1(this, "toggleControls", toggle => {
|
|
7628
7688
|
// Don't toggle if missing UI support or if it's audio
|
|
7629
7689
|
if (this.supported.ui && !this.isAudio) {
|
|
@@ -7648,15 +7708,37 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7648
7708
|
}
|
|
7649
7709
|
return false;
|
|
7650
7710
|
});
|
|
7711
|
+
/**
|
|
7712
|
+
* Add event listeners
|
|
7713
|
+
* @param {String} event - Event type
|
|
7714
|
+
* @param {Function} callback - Callback for when event occurs
|
|
7715
|
+
*/
|
|
7651
7716
|
_defineProperty$1(this, "on", (event, callback) => {
|
|
7652
7717
|
on.call(this, this.elements.container, event, callback);
|
|
7653
7718
|
});
|
|
7719
|
+
/**
|
|
7720
|
+
* Add event listeners once
|
|
7721
|
+
* @param {String} event - Event type
|
|
7722
|
+
* @param {Function} callback - Callback for when event occurs
|
|
7723
|
+
*/
|
|
7654
7724
|
_defineProperty$1(this, "once", (event, callback) => {
|
|
7655
7725
|
once.call(this, this.elements.container, event, callback);
|
|
7656
7726
|
});
|
|
7727
|
+
/**
|
|
7728
|
+
* Remove event listeners
|
|
7729
|
+
* @param {String} event - Event type
|
|
7730
|
+
* @param {Function} callback - Callback for when event occurs
|
|
7731
|
+
*/
|
|
7657
7732
|
_defineProperty$1(this, "off", (event, callback) => {
|
|
7658
7733
|
off(this.elements.container, event, callback);
|
|
7659
7734
|
});
|
|
7735
|
+
/**
|
|
7736
|
+
* Destroy an instance
|
|
7737
|
+
* Event listeners are removed when elements are removed
|
|
7738
|
+
* http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
|
|
7739
|
+
* @param {Function} callback - Callback for when destroy is complete
|
|
7740
|
+
* @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
|
|
7741
|
+
*/
|
|
7660
7742
|
_defineProperty$1(this, "destroy", (callback, soft = false) => {
|
|
7661
7743
|
if (!this.ready) {
|
|
7662
7744
|
return;
|
|
@@ -7755,6 +7837,10 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7755
7837
|
setTimeout(done, 200);
|
|
7756
7838
|
}
|
|
7757
7839
|
});
|
|
7840
|
+
/**
|
|
7841
|
+
* Check for support for a mime type (HTML5 only)
|
|
7842
|
+
* @param {String} type - Mime type
|
|
7843
|
+
*/
|
|
7758
7844
|
_defineProperty$1(this, "supports", type => support.mime.call(this, type));
|
|
7759
7845
|
this.timers = {};
|
|
7760
7846
|
|
|
@@ -7952,7 +8038,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7952
8038
|
}
|
|
7953
8039
|
|
|
7954
8040
|
// Check for support again but with type
|
|
7955
|
-
this.supported = support.check(this.type, this.provider
|
|
8041
|
+
this.supported = support.check(this.type, this.provider);
|
|
7956
8042
|
|
|
7957
8043
|
// If no support for even API, bail
|
|
7958
8044
|
if (!this.supported.api) {
|
|
@@ -7972,9 +8058,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
7972
8058
|
|
|
7973
8059
|
// Wrap media
|
|
7974
8060
|
if (!is.element(this.elements.container)) {
|
|
7975
|
-
this.elements.container = createElement('div'
|
|
7976
|
-
tabindex: 0
|
|
7977
|
-
});
|
|
8061
|
+
this.elements.container = createElement('div');
|
|
7978
8062
|
wrap(this.media, this.elements.container);
|
|
7979
8063
|
}
|
|
7980
8064
|
|
|
@@ -8053,11 +8137,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
8053
8137
|
get isAudio() {
|
|
8054
8138
|
return this.type === types.audio;
|
|
8055
8139
|
}
|
|
8056
|
-
|
|
8057
|
-
/**
|
|
8058
|
-
* Play the media, or play the advertisement (if they are not blocked)
|
|
8059
|
-
*/
|
|
8060
|
-
|
|
8061
8140
|
/**
|
|
8062
8141
|
* Get playing state
|
|
8063
8142
|
*/
|
|
@@ -8085,12 +8164,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
8085
8164
|
get ended() {
|
|
8086
8165
|
return Boolean(this.media.ended);
|
|
8087
8166
|
}
|
|
8088
|
-
|
|
8089
|
-
/**
|
|
8090
|
-
* Toggle playback based on current status
|
|
8091
|
-
* @param {Boolean} input
|
|
8092
|
-
*/
|
|
8093
|
-
|
|
8094
8167
|
/**
|
|
8095
8168
|
* Seek to a time
|
|
8096
8169
|
* @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
|
|
@@ -8212,12 +8285,6 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
8212
8285
|
get volume() {
|
|
8213
8286
|
return Number(this.media.volume);
|
|
8214
8287
|
}
|
|
8215
|
-
|
|
8216
|
-
/**
|
|
8217
|
-
* Increase volume
|
|
8218
|
-
* @param {Boolean} step - How much to decrease by (between 0 and 1)
|
|
8219
|
-
*/
|
|
8220
|
-
|
|
8221
8288
|
/**
|
|
8222
8289
|
* Set muted state
|
|
8223
8290
|
* @param {Boolean} mute
|
|
@@ -8631,7 +8698,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
8631
8698
|
}
|
|
8632
8699
|
|
|
8633
8700
|
/**
|
|
8634
|
-
* Sets the preview
|
|
8701
|
+
* Sets the preview thumbnails for the current source
|
|
8635
8702
|
*/
|
|
8636
8703
|
setPreviewThumbnails(thumbnailSource) {
|
|
8637
8704
|
if (this.previewThumbnails && this.previewThumbnails.loaded) {
|
|
@@ -8645,20 +8712,13 @@ typeof navigator === "object" && (function (global, factory) {
|
|
|
8645
8712
|
this.previewThumbnails = new PreviewThumbnails(this);
|
|
8646
8713
|
}
|
|
8647
8714
|
}
|
|
8648
|
-
|
|
8649
|
-
/**
|
|
8650
|
-
* Trigger the airplay dialog
|
|
8651
|
-
* TODO: update player with state, support, enabled
|
|
8652
|
-
*/
|
|
8653
|
-
|
|
8654
8715
|
/**
|
|
8655
8716
|
* Check for support
|
|
8656
8717
|
* @param {String} type - Player type (audio/video)
|
|
8657
8718
|
* @param {String} provider - Provider (html5/youtube/vimeo)
|
|
8658
|
-
* @param {Boolean} inline - Where player has `playsinline` sttribute
|
|
8659
8719
|
*/
|
|
8660
|
-
static supported(type, provider
|
|
8661
|
-
return support.check(type, provider
|
|
8720
|
+
static supported(type, provider) {
|
|
8721
|
+
return support.check(type, provider);
|
|
8662
8722
|
}
|
|
8663
8723
|
|
|
8664
8724
|
/**
|