1"object" == typeof navigator && 2 (function (e, t) { 3 "object" == typeof exports && "undefined" != typeof module 4 ? (module.exports = t()) 5 : "function" == typeof define && define.amd 6 ? define("Plyr", t) 7 : ((e = 8 "undefined" != typeof globalThis 9 ? globalThis 10 : e || self).Plyr = t()); 11 })(this, function () { 12 "use strict"; 13 function e(e, t, i) { 14 return ( 15 (t = (function (e) { 16 var t = (function (e, t) { 17 if ("object" != typeof e || null === e) return e; 18 var i = e[Symbol.toPrimitive]; 19 if (void 0 !== i) { 20 var s = i.call(e, t || "default"); 21 if ("object" != typeof s) return s; 22 throw new TypeError( 23 "@@toPrimitive must return a primitive value." 24 ); 25 } 26 return ("string" === t ? String : Number)(e); 27 })(e, "string"); 28 return "symbol" == typeof t ? t : String(t); 29 })(t)) in e 30 ? Object.defineProperty(e, t, { 31 value: i, 32 enumerable: !0, 33 configurable: !0, 34 writable: !0, 35 }) 36 : (e[t] = i), 37 e 38 ); 39 } 40 function t(e, t) { 41 for (var i = 0; i < t.length; i++) { 42 var s = t[i]; 43 (s.enumerable = s.enumerable || !1), 44 (s.configurable = !0), 45 "value" in s && (s.writable = !0), 46 Object.defineProperty(e, s.key, s); 47 } 48 } 49 function i(e, t, i) { 50 return ( 51 t in e 52 ? Object.defineProperty(e, t, { 53 value: i, 54 enumerable: !0, 55 configurable: !0, 56 writable: !0, 57 }) 58 : (e[t] = i), 59 e 60 ); 61 } 62 function s(e, t) { 63 var i = Object.keys(e); 64 if (Object.getOwnPropertySymbols) { 65 var s = Object.getOwnPropertySymbols(e); 66 t && 67 (s = s.filter(function (t) { 68 return Object.getOwnPropertyDescriptor(e, t).enumerable; 69 })), 70 i.push.apply(i, s); 71 } 72 return i; 73 } 74 function n(e) { 75 for (var t = 1; t < arguments.length; t++) { 76 var n = null != arguments[t] ? arguments[t] : {}; 77 t % 2 78 ? s(Object(n), !0).forEach(function (t) { 79 i(e, t, n[t]); 80 }) 81 : Object.getOwnPropertyDescriptors 82 ? Object.defineProperties( 83 e, 84 Object.getOwnPropertyDescriptors(n) 85 ) 86 : s(Object(n)).forEach(function (t) { 87 Object.defineProperty( 88 e, 89 t, 90 Object.getOwnPropertyDescriptor(n, t) 91 ); 92 }); 93 } 94 return e; 95 } 96 var a = { addCSS: !0, thumbWidth: 15, watch: !0 }; 97 var l = function (e) { 98 return null != e ? e.constructor : null; 99 }, 100 r = function (e, t) { 101 return !!(e && t && e instanceof t); 102 }, 103 o = function (e) { 104 return null == e; 105 }, 106 c = function (e) { 107 return l(e) === Object; 108 }, 109 u = function (e) { 110 return l(e) === String; 111 }, 112 h = function (e) { 113 return Array.isArray(e); 114 }, 115 d = function (e) { 116 return r(e, NodeList); 117 }, 118 m = { 119 nullOrUndefined: o, 120 object: c, 121 number: function (e) { 122 return l(e) === Number && !Number.isNaN(e); 123 }, 124 string: u, 125 boolean: function (e) { 126 return l(e) === Boolean; 127 }, 128 function: function (e) { 129 return l(e) === Function; 130 }, 131 array: h, 132 nodeList: d, 133 element: function (e) { 134 return r(e, Element); 135 }, 136 event: function (e) { 137 return r(e, Event); 138 }, 139 empty: function (e) { 140 return ( 141 o(e) || 142 ((u(e) || h(e) || d(e)) && !e.length) || 143 (c(e) && !Object.keys(e).length) 144 ); 145 }, 146 }; 147 function p(e, t) { 148 if (1 > t) { 149 var i = (function (e) { 150 var t = "" 151 .concat(e) 152 .match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); 153 return t 154 ? Math.max( 155 0, 156 (t[1] ? t[1].length : 0) - (t[2] ? +t[2] : 0) 157 ) 158 : 0; 159 })(t); 160 return parseFloat(e.toFixed(i)); 161 } 162 return Math.round(e / t) * t; 163 } 164 var g = (function () { 165 function e(t, i) { 166 (function (e, t) { 167 if (!(e instanceof t)) 168 throw new TypeError( 169 "Cannot call a class as a function" 170 ); 171 })(this, e), 172 m.element(t) 173 ? (this.element = t) 174 : m.string(t) && 175 (this.element = document.querySelector(t)), 176 m.element(this.element) && 177 m.empty(this.element.rangeTouch) && 178 ((this.config = n({}, a, {}, i)), this.init()); 179 } 180 return ( 181 (function (e, i, s) { 182 i && t(e.prototype, i), s && t(e, s); 183 })( 184 e, 185 [ 186 { 187 key: "init", 188 value: function () { 189 e.enabled && 190 (this.config.addCSS && 191 ((this.element.style.userSelect = 192 "none"), 193 (this.element.style.webKitUserSelect = 194 "none"), 195 (this.element.style.touchAction = 196 "manipulation")), 197 this.listeners(!0), 198 (this.element.rangeTouch = this)); 199 }, 200 }, 201 {
202 key: "destroy", 203 value: function () { 204 e.enabled && 205 (this.config.addCSS && 206 ((this.element.style.userSelect = ""), 207 (this.element.style.webKitUserSelect = 208 ""), 209 (this.element.style.touchAction = "")), 210 this.listeners(!1), 211 (this.element.rangeTouch = null)); 212 }, 213 }, 214 { 215 key: "listeners", 216 value: function (e) { 217 var t = this, 218 i = e 219 ? "addEventListener" 220 : "removeEventListener"; 221 ["touchstart", "touchmove", "touchend"].forEach( 222 function (e) { 223 t.element[i]( 224 e, 225 function (e) { 226 return t.set(e); 227 }, 228 !1 229 ); 230 } 231 ); 232 }, 233 }, 234 { 235 key: "get", 236 value: function (t) { 237 if (!e.enabled || !m.event(t)) return null; 238 var i, 239 s = t.target, 240 n = t.changedTouches[0], 241 a = parseFloat(s.getAttribute("min")) || 0, 242 l = 243 parseFloat(s.getAttribute("max")) || 244 100, 245 r = parseFloat(s.getAttribute("step")) || 1, 246 o = s.getBoundingClientRect(), 247 c = 248 ((100 / o.width) * 249 (this.config.thumbWidth / 2)) / 250 100; 251 return ( 252 0 > 253 (i = (100 / o.width) * (n.clientX - o.left)) 254 ? (i = 0) 255 : 100 < i && (i = 100), 256 50 > i 257 ? (i -= (100 - 2 * i) * c) 258 : 50 < i && (i += 2 * (i - 50) * c), 259 a + p((i / 100) * (l - a), r) 260 ); 261 }, 262 }, 263 { 264 key: "set", 265 value: function (t) { 266 e.enabled && 267 m.event(t) && 268 !t.target.disabled && 269 (t.preventDefault(), 270 (t.target.value = this.get(t)), 271 (function (e, t) { 272 if (e && t) { 273 var i = new Event(t, { 274 bubbles: !0, 275 }); 276 e.dispatchEvent(i); 277 } 278 })( 279 t.target, 280 "touchend" === t.type 281 ? "change" 282 : "input" 283 )); 284 }, 285 }, 286 ], 287 [ 288 { 289 key: "setup", 290 value: function (t) { 291 var i = 292 1 < arguments.length && 293 void 0 !== arguments[1] 294 ? arguments[1] 295 : {}, 296 s = null; 297 if ( 298 (m.empty(t) || m.string(t) 299 ? (s = Array.from( 300 document.querySelectorAll( 301 m.string(t) 302 ? t 303 : 'input[type="range"]' 304 ) 305 )) 306 : m.element(t) 307 ? (s = [t]) 308 : m.nodeList(t) 309 ? (s = Array.from(t)) 310 : m.array(t) && 311 (s = t.filter(m.element)), 312 m.empty(s)) 313 ) 314 return null; 315 var l = n({}, a, {}, i); 316 if (m.string(t) && l.watch) { 317 var r = new MutationObserver(function (i) { 318 Array.from(i).forEach(function (i) { 319 Array.from(i.addedNodes).forEach( 320 function (i) { 321 m.element(i) && 322 (function (e, t) { 323 return function () { 324 return Array.from( 325 document.querySelectorAll( 326 t 327 ) 328 ).includes( 329 this 330 ); 331 }.call(e, t); 332 })(i, t) && 333 new e(i, l); 334 } 335 ); 336 }); 337 }); 338 r.observe(document.body, { 339 childList: !0, 340 subtree: !0, 341 }); 342 } 343 return s.map(function (t) { 344 return new e(t, i); 345 }); 346 }, 347 }, 348 { 349 key: "enabled", 350 get: function () { 351 return ( 352 "ontouchstart" in document.documentElement 353 ); 354 }, 355 }, 356 ] 357 ), 358 e 359 ); 360 })(); 361 const f = (e) => (null != e ? e.constructor : null), 362 y = (e, t) => Boolean(e && t && e instanceof t), 363 b = (e) => null == e, 364 v = (e) => f(e) === Object, 365 w = (e) => f(e) === String, 366 T = (e) => "function" == typeof e, 367 k = (e) => Array.isArray(e), 368 C = (e) => y(e, NodeList), 369 A = (e) => 370 b(e) || 371 ((w(e) || k(e) || C(e)) && !e.length) || 372 (v(e) && !Object.keys(e).length); 373 var S = { 374 nullOrUndefined: b, 375 object: v, 376 number: (e) => f(e) === Number && !Number.isNaN(e), 377 string: w, 378 boolean: (e) => f(e) === Boolean, 379 function: T, 380 array: k, 381 weakMap: (e) => y(e, WeakMap), 382 nodeList: C, 383 element: (e) => 384 null !== e && 385 "object" == typeof e && 386 1 === e.nodeType && 387 "object" == typeof e.style && 388 "object" == typeof e.ownerDocument, 389 textNode: (e) => f(e) === Text, 390 event: (e) => y(e, Event), 391 keyboardEvent: (e) => y(e, KeyboardEvent), 392 cue: (e) => y(e, window.TextTrackCue) || y(e, window.VTTCue), 393 track: (e) => y(e, TextTrack) || (!b(e) && w(e.kind)), 394 promise: (e) => y(e, Promise) && T(e.then), 395 url: (e) => { 396 if (y(e, window.URL)) return !0; 397 if (!w(e)) return !1; 398 let t = e; 399 (e.startsWith("http://") && e.startsWith("https://")) || 400 (t = `http://${e}`);
401 try { 402 return !A(new URL(t).hostname); 403 } catch (e) { 404 return !1; 405 } 406 }, 407 empty: A, 408 }; 409 const E = (() => { 410 const e = document.createElement("span"), 411 t = { 412 WebkitTransition: "webkitTransitionEnd", 413 MozTransition: "transitionend", 414 OTransition: "oTransitionEnd otransitionend", 415 transition: "transitionend", 416 }, 417 i = Object.keys(t).find((t) => void 0 !== e.style[t]); 418 return !!S.string(i) && t[i]; 419 })(); 420 function P(e, t) { 421 setTimeout(() => { 422 try { 423 (e.hidden = !0), e.offsetHeight, (e.hidden = !1); 424 } catch (e) {} 425 }, t); 426 } 427 var M = { 428 isIE: Boolean(window.document.documentMode), 429 isEdge: /Edge/g.test(navigator.userAgent), 430 isWebKit: 431 "WebkitAppearance" in document.documentElement.style && 432 !/Edge/g.test(navigator.userAgent), 433 isIPhone: 434 /iPhone|iPod/gi.test(navigator.userAgent) && 435 navigator.maxTouchPoints > 1, 436 isIPadOS: 437 "MacIntel" === navigator.platform && 438 navigator.maxTouchPoints > 1, 439 isIos: 440 /iPad|iPhone|iPod/gi.test(navigator.userAgent) && 441 navigator.maxTouchPoints > 1, 442 }; 443 function N(e, t) { 444 return t.split(".").reduce((e, t) => e && e[t], e); 445 } 446 function x(e = {}, ...t) { 447 if (!t.length) return e; 448 const i = t.shift(); 449 return S.object(i)
450 ? (Object.keys(i).forEach((t) => { 451 S.object(i[t]) 452 ? (Object.keys(e).includes(t) || 453 Object.assign(e, { [t]: {} }), 454 x(e[t], i[t])) 455 : Object.assign(e, { [t]: i[t] }); 456 }), 457 x(e, ...t)) 458 : e; 459 } 460 function L(e, t) { 461 const i = e.length ? e : [e]; 462 Array.from(i) 463 .reverse() 464 .forEach((e, i) => { 465 const s = i > 0 ? t.cloneNode(!0) : t, 466 n = e.parentNode, 467 a = e.nextSibling; 468 s.appendChild(e), 469 a ? n.insertBefore(s, a) : n.appendChild(s); 470 }); 471 } 472 function I(e, t) { 473 S.element(e) && 474 !S.empty(t) && 475 Object.entries(t) 476 .filter(([, e]) => !S.nullOrUndefined(e)) 477 .forEach(([t, i]) => e.setAttribute(t, i)); 478 } 479 function $(e, t, i) { 480 const s = document.createElement(e); 481 return S.object(t) && I(s, t), S.string(i) && (s.innerText = i), s; 482 } 483 function _(e, t, i, s) { 484 S.element(t) && t.appendChild($(e, i, s)); 485 } 486 function O(e) { 487 S.nodeList(e) || S.array(e) 488 ? Array.from(e).forEach(O) 489 : S.element(e) && 490 S.element(e.parentNode) && 491 e.parentNode.removeChild(e); 492 } 493 function j(e) { 494 if (!S.element(e)) return; 495 let { length: t } = e.childNodes; 496 for (; t > 0; ) e.removeChild(e.lastChild), (t -= 1); 497 } 498 function q(e, t) { 499 return S.element(t) && S.element(t.parentNode) && S.element(e) 500 ? (t.parentNode.replaceChild(e, t), e) 501 : null; 502 } 503 function D(e, t) { 504 if (!S.string(e) || S.empty(e)) return {}; 505 const i = {}, 506 s = x({}, t); 507 return ( 508 e.split(",").forEach((e) => { 509 const t = e.trim(), 510 n = t.replace(".", ""), 511 a = t.replace(/[[\]]/g, "").split("="), 512 [l] = a, 513 r = a.length > 1 ? a[1].replace(/["']/g, "") : ""; 514 switch (t.charAt(0)) { 515 case ".": 516 S.string(s.class) 517 ? (i.class = `${s.class} ${n}`) 518 : (i.class = n); 519 break; 520 case "#": 521 i.id = t.replace("#", ""); 522 break; 523 case "[": 524 i[l] = r; 525 } 526 }), 527 x(s, i) 528 ); 529 } 530 function H(e, t) { 531 if (!S.element(e)) return; 532 let i = t; 533 S.boolean(i) || (i = !e.hidden), (e.hidden = i); 534 } 535 function R(e, t, i) { 536 if (S.nodeList(e)) return Array.from(e).map((e) => R(e, t, i)); 537 if (S.element(e)) { 538 let s = "toggle"; 539 return ( 540 void 0 !== i && (s = i ? "add" : "remove"), 541 e.classList[s](t), 542 e.classList.contains(t) 543 ); 544 } 545 return !1; 546 } 547 function F(e, t) { 548 return S.element(e) && e.classList.contains(t); 549 } 550 function V(e, t) { 551 const { prototype: i } = Element; 552 return ( 553 i.matches || 554 i.webkitMatchesSelector || 555 i.mozMatchesSelector || 556 i.msMatchesSelector || 557 function () { 558 return Array.from(document.querySelectorAll(t)).includes( 559 this 560 ); 561 } 562 ).call(e, t); 563 } 564 function U(e) { 565 return this.elements.container.querySelectorAll(e); 566 } 567 function B(e) { 568 return this.elements.container.querySelector(e); 569 } 570 function W(e = null, t = !1) { 571 S.element(e) && e.focus({ preventScroll: !0, focusVisible: t }); 572 } 573 const z = { 574 "audio/ogg": "vorbis", 575 "audio/wav": "1", 576 "video/webm": "vp8, vorbis", 577 "video/mp4": "avc1.42E01E, mp4a.40.2", 578 "video/ogg": "theora", 579 }, 580 K = { 581 audio: "canPlayType" in document.createElement("audio"), 582 video: "canPlayType" in document.createElement("video"), 583 check(e, t) { 584 const i = K[e] || "html5" !== t; 585 return { api: i, ui: i && K.rangeInput }; 586 }, 587 pip: !( 588 M.isIPhone || 589 (!S.function($("video").webkitSetPresentationMode) && 590 (!document.pictureInPictureEnabled || 591 $("video").disablePictureInPicture)) 592 ), 593 airplay: S.function( 594 window.WebKitPlaybackTargetAvailabilityEvent 595 ), 596 playsinline: "playsInline" in document.createElement("video"), 597 mime(e) { 598 if (S.empty(e)) return !1; 599 const [t] = e.split("/"); 600 let i = e; 601 if (!this.isHTML5 || t !== this.type) return !1; 602 Object.keys(z).includes(i) && (i += `; codecs="${z[e]}"`); 603 try { 604 return Boolean( 605 i && this.media.canPlayType(i).replace(/no/, "") 606 ); 607 } catch (e) { 608 return !1; 609 } 610 }, 611 textTracks: "textTracks" in document.createElement("video"), 612 rangeInput: (() => { 613 const e = document.createElement("input"); 614 return (e.type = "range"), "range" === e.type; 615 })(), 616 touch: "ontouchstart" in document.documentElement, 617 transitions: !1 !== E, 618 reducedMotion:
619 "matchMedia" in window && 620 window.matchMedia("(prefers-reduced-motion)").matches, 621 }, 622 Y = (() => { 623 let e = !1; 624 try { 625 const t = Object.defineProperty({}, "passive", { 626 get: () => ((e = !0), null), 627 }); 628 window.addEventListener("test", null, t), 629 window.removeEventListener("test", null, t); 630 } catch (e) {} 631 return e; 632 })(); 633 function Q(e, t, i, s = !1, n = !0, a = !1) { 634 if ( 635 !e || 636 !("addEventListener" in e) || 637 S.empty(t) || 638 !S.function(i) 639 ) 640 return; 641 const l = t.split(" "); 642 let r = a; 643 Y && (r = { passive: n, capture: a }), 644 l.forEach((t) => { 645 this && 646 this.eventListeners && 647 s && 648 this.eventListeners.push({ 649 element: e, 650 type: t, 651 callback: i, 652 options: r, 653 }), 654 e[s ? "addEventListener" : "removeEventListener"]( 655 t, 656 i, 657 r 658 ); 659 }); 660 } 661 function X(e, t = "", i, s = !0, n = !1) { 662 Q.call(this, e, t, i, !0, s, n); 663 } 664 function J(e, t = "", i, s = !0, n = !1) { 665 Q.call(this, e, t, i, !1, s, n); 666 } 667 function G(e, t = "", i, s = !0, n = !1) { 668 const a = (...l) => { 669 J(e, t, a, s, n), i.apply(this, l); 670 }; 671 Q.call(this, e, t, a, !0, s, n); 672 } 673 function Z(e, t = "", i = !1, s = {}) { 674 if (!S.element(e) || S.empty(t)) return; 675 const n = new CustomEvent(t, { 676 bubbles: i, 677 detail: { ...s, plyr: this }, 678 }); 679 e.dispatchEvent(n); 680 } 681 function ee() { 682 this && 683 this.eventListeners && 684 (this.eventListeners.forEach((e) => { 685 const { element: t, type: i, callback: s, options: n } = e; 686 t.removeEventListener(i, s, n); 687 }), 688 (this.eventListeners = [])); 689 } 690 function te() { 691 return new Promise((e) => 692 this.ready 693 ? setTimeout(e, 0) 694 : X.call(this, this.elements.container, "ready", e) 695 ).then(() => {}); 696 } 697 function ie(e) { 698 S.promise(e) && e.then(null, () => {}); 699 } 700 function se(e) { 701 return S.array(e) ? e.filter((t, i) => e.indexOf(t) === i) : e; 702 } 703 function ne(e, t) { 704 return S.array(e) && e.length 705 ? e.reduce((e, i) => 706 Math.abs(i - t) < Math.abs(e - t) ? i : e 707 ) 708 : null; 709 } 710 function ae(e) { 711 return !(!window || !window.CSS) && window.CSS.supports(e); 712 } 713 const le = [ 714 [1, 1], 715 [4, 3], 716 [3, 4], 717 [5, 4], 718 [4, 5], 719 [3, 2], 720 [2, 3], 721 [16, 10], 722 [10, 16], 723 [16, 9], 724 [9, 16], 725 [21, 9], 726 [9, 21], 727 [32, 9], 728 [9, 32], 729 ].reduce((e, [t, i]) => ({ ...e, [t / i]: [t, i] }), {}); 730 function re(e) { 731 if (!(S.array(e) || (S.string(e) && e.includes(":")))) return !1; 732 return (S.array(e) ? e : e.split(":")).map(Number).every(S.number); 733 } 734 function oe(e) { 735 if (!S.array(e) || !e.every(S.number)) return null; 736 const [t, i] = e, 737 s = (e, t) => (0 === t ? e : s(t, e % t)), 738 n = s(t, i); 739 return [t / n, i / n]; 740 } 741 function ce(e) { 742 const t = (e) => (re(e) ? e.split(":").map(Number) : null); 743 let i = t(e); 744 if ( 745 (null === i && (i = t(this.config.ratio)), 746 null === i && 747 !S.empty(this.embed) && 748 S.array(this.embed.ratio) && 749 ({ ratio: i } = this.embed), 750 null === i && this.isHTML5) 751 ) { 752 const { videoWidth: e, videoHeight: t } = this.media; 753 i = [e, t]; 754 } 755 return oe(i); 756 } 757 function ue(e) { 758 if (!this.isVideo) return {}; 759 const { wrapper: t } = this.elements, 760 i = ce.call(this, e); 761 if (!S.array(i)) return {}; 762 const [s, n] = oe(i), 763 a = (100 / s) * n; 764 if ( 765 (ae(`aspect-ratio: ${s}/${n}`) 766 ? (t.style.aspectRatio = `${s}/${n}`) 767 : (t.style.paddingBottom = `${a}%`), 768 this.isVimeo && !this.config.vimeo.premium && this.supported.ui) 769 ) { 770 const e = 771 (100 / this.media.offsetWidth) * 772 parseInt( 773 window.getComputedStyle(this.media).paddingBottom, 774 10 775 ), 776 i = (e - a) / (e / 50); 777 this.fullscreen.active 778 ? (t.style.paddingBottom = null) 779 : (this.media.style.transform = `translateY(-${i}%)`); 780 } else this.isHTML5 && t.classList.add(this.config.classNames.videoFixedRatio); 781 return { padding: a, ratio: i }; 782 } 783 function he(e, t, i = 0.05) { 784 const s = e / t, 785 n = ne(Object.keys(le), s); 786 return Math.abs(n - s) <= i ? le[n] : [e, t]; 787 } 788 const de = { 789 getSources() { 790 if (!this.isHTML5) return []; 791 return Array.from(this.media.querySelectorAll("source")).filter( 792 (e) => { 793 const t = e.getAttribute("type"); 794 return !!S.empty(t) || K.mime.call(this, t); 795 } 796 ); 797 }, 798 getQualityOptions() { 799 return this.config.quality.forced 800 ? this.config.quality.options 801 : de.getSources 802 .call(this) 803 .map((e) => Number(e.getAttribute("size"))) 804 .filter(Boolean); 805 }, 806 setup() { 807 if (!this.isHTML5) return; 808 const e = this; 809 (e.options.speed = e.config.speed.options), 810 S.empty(this.config.ratio) || ue.call(e), 811 Object.defineProperty(e.media, "quality", { 812 get() { 813 const t = de.getSources 814 .call(e) 815 .find( 816 (t) => t.getAttribute("src") === e.source 817 ); 818 return t && Number(t.getAttribute("size")); 819 }, 820 set(t) { 821 if (e.quality !== t) { 822 if ( 823 e.config.quality.forced && 824 S.function(e.config.quality.onChange) 825 ) 826 e.config.quality.onChange(t); 827 else { 828 const i = de.getSources 829 .call(e) 830 .find( 831 (e) => 832 Number( 833 e.getAttribute("size") 834 ) === t 835 ); 836 if (!i) return; 837 const { 838 currentTime: s, 839 paused: n, 840 preload: a, 841 readyState: l, 842 playbackRate: r, 843 } = e.media; 844 (e.media.src = i.getAttribute("src")), 845 ("none" !== a || l) && 846 (e.once("loadedmetadata", () => { 847 (e.speed = r), 848 (e.currentTime = s), 849 n || ie(e.play()); 850 }), 851 e.media.load()); 852 } 853 Z.call(e, e.media, "qualitychange", !1, { 854 quality: t, 855 }); 856 } 857 }, 858 }); 859 }, 860 cancelRequests() { 861 this.isHTML5 && 862 (O(de.getSources.call(this)), 863 this.media.setAttribute("src", this.config.blankVideo), 864 this.media.load(), 865 this.debug.log("Cancelled network requests")); 866 }, 867 }; 868 function me(e, ...t) { 869 return S.empty(e) 870 ? e 871 : e.toString().replace(/{(\d+)}/g, (e, i) => t[i].toString()); 872 } 873 const pe = (e = "", t = "", i = "") => 874 e.replace( 875 new RegExp( 876 t 877 .toString() 878 .replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1"), 879 "g" 880 ), 881 i.toString() 882 ), 883 ge = (e = "") => 884 e 885 .toString() 886 .replace( 887 /\w\S*/g, 888 (e) => 889 e.charAt(0).toUpperCase() + e.slice(1).toLowerCase() 890 ); 891 function fe(e = "") { 892 let t = e.toString(); 893 return ( 894 (t = (function (e = "") { 895 let t = e.toString(); 896 return ( 897 (t = pe(t, "-", " ")), 898 (t = pe(t, "_", " ")), 899 (t = ge(t)), 900 pe(t, " ", "") 901 ); 902 })(t)), 903 t.charAt(0).toLowerCase() + t.slice(1) 904 ); 905 } 906 function ye(e) { 907 const t = document.createElement("div"); 908 return t.appendChild(e), t.innerHTML; 909 } 910 const be = { 911 pip: "PIP", 912 airplay: "AirPlay", 913 html5: "HTML5", 914 vimeo: "Vimeo", 915 youtube: "YouTube", 916 }, 917 ve = { 918 get(e = "", t = {}) { 919 if (S.empty(e) || S.empty(t)) return ""; 920 let i = N(t.i18n, e); 921 if (S.empty(i)) 922 return Object.keys(be).includes(e) ? be[e] : ""; 923 const s = { "{seektime}": t.seekTime, "{title}": t.title }; 924 return (
925 Object.entries(s).forEach(([e, t]) => { 926 i = pe(i, e, t); 927 }), 928 i 929 ); 930 }, 931 }; 932 class we { 933 constructor(t) { 934 e(this, "get", (e) => { 935 if (!we.supported || !this.enabled) return null; 936 const t = window.localStorage.getItem(this.key); 937 if (S.empty(t)) return null; 938 const i = JSON.parse(t); 939 return S.string(e) && e.length ? i[e] : i; 940 }), 941 e(this, "set", (e) => { 942 if (!we.supported || !this.enabled) return; 943 if (!S.object(e)) return; 944 let t = this.get(); 945 S.empty(t) && (t = {}), x(t, e); 946 try { 947 window.localStorage.setItem( 948 this.key, 949 JSON.stringify(t) 950 ); 951 } catch (e) {} 952 }), 953 (this.enabled = t.config.storage.enabled), 954 (this.key = t.config.storage.key); 955 } 956 static get supported() { 957 try { 958 if (!("localStorage" in window)) return !1; 959 const e = "___test"; 960 return ( 961 window.localStorage.setItem(e, e), 962 window.localStorage.removeItem(e), 963 !0 964 ); 965 } catch (e) { 966 return !1; 967 } 968 } 969 } 970 function Te(e, t = "text") { 971 return new Promise((i, s) => { 972 try { 973 const s = new XMLHttpRequest(); 974 if (!("withCredentials" in s)) return; 975 s.addEventListener("load", () => { 976 if ("text" === t) 977 try { 978 i(JSON.parse(s.responseText)); 979 } catch (e) { 980 i(s.responseText); 981 } 982 else i(s.response); 983 }), 984 s.addEventListener("error", () => { 985 throw new Error(s.status); 986 }), 987 s.open("GET", e, !0), 988 (s.responseType = t), 989 s.send(); 990 } catch (e) { 991 s(e); 992 } 993 }); 994 } 995 function ke(e, t) { 996 if (!S.string(e)) return; 997 const i = "cache", 998 s = S.string(t); 999 let n = !1; 1000 const a = () => null !== document.getElementById(t), 1001 l = (e, t) => { 1002 (e.innerHTML = t), 1003 (s && a()) || 1004 document.body.insertAdjacentElement( 1005 "afterbegin", 1006 e 1007 ); 1008 }; 1009 if (!s || !a()) { 1010 const a = we.supported, 1011 r = document.createElement("div"); 1012 if ( 1013 (r.setAttribute("hidden", ""), 1014 s && r.setAttribute("id", t), 1015 a) 1016 ) { 1017 const e = window.localStorage.getItem(`${i}-${t}`); 1018 if (((n = null !== e), n)) { 1019 const t = JSON.parse(e); 1020 l(r, t.content); 1021 } 1022 } 1023 Te(e) 1024 .then((e) => { 1025 if (!S.empty(e)) { 1026 if (a) 1027 try { 1028 window.localStorage.setItem( 1029 `${i}-${t}`, 1030 JSON.stringify({ content: e }) 1031 ); 1032 } catch (e) {} 1033 l(r, e); 1034 } 1035 }) 1036 .catch(() => {}); 1037 } 1038 } 1039 const Ce = (e) => Math.trunc((e / 60 / 60) % 60, 10), 1040 Ae = (e) => Math.trunc((e / 60) % 60, 10), 1041 Se = (e) => Math.trunc(e % 60, 10); 1042 function Ee(e = 0, t = !1, i = !1) { 1043 if (!S.number(e)) return Ee(void 0, t, i); 1044 const s = (e) => `0${e}`.slice(-2); 1045 let n = Ce(e); 1046 const a = Ae(e), 1047 l = Se(e); 1048 return ( 1049 (n = t || n > 0 ? `${n}:` : ""), 1050 `${i && e > 0 ? "-" : ""}${n}${s(a)}:${s(l)}` 1051 ); 1052 } 1053 const Pe = { 1054 getIconUrl() { 1055 const e = new URL(this.config.iconUrl, window.location), 1056 t = window.location.host 1057 ? window.location.host 1058 : window.top.location.host, 1059 i = e.host !== t || (M.isIE && !window.svg4everybody); 1060 return { url: this.config.iconUrl, cors: i }; 1061 }, 1062 findElements() { 1063 try { 1064 return ( 1065 (this.elements.controls = B.call( 1066 this, 1067 this.config.selectors.controls.wrapper 1068 )), 1069 (this.elements.buttons = { 1070 play: U.call( 1071 this, 1072 this.config.selectors.buttons.play 1073 ), 1074 pause: B.call( 1075 this, 1076 this.config.selectors.buttons.pause 1077 ), 1078 restart: B.call( 1079 this, 1080 this.config.selectors.buttons.restart 1081 ), 1082 rewind: B.call( 1083 this, 1084 this.config.selectors.buttons.rewind 1085 ), 1086 fastForward: B.call( 1087 this, 1088 this.config.selectors.buttons.fastForward 1089 ), 1090 mute: B.call( 1091 this, 1092 this.config.selectors.buttons.mute 1093 ), 1094 pip: B.call( 1095 this, 1096 this.config.selectors.buttons.pip 1097 ), 1098 airplay: B.call( 1099 this, 1100 this.config.selectors.buttons.airplay 1101 ), 1102 settings: B.call( 1103 this, 1104 this.config.selectors.buttons.settings 1105 ), 1106 captions: B.call( 1107 this, 1108 this.config.selectors.buttons.captions 1109 ), 1110 fullscreen: B.call( 1111 this, 1112 this.config.selectors.buttons.fullscreen 1113 ), 1114 }), 1115 (this.elements.progress = B.call( 1116 this, 1117 this.config.selectors.progress 1118 )), 1119 (this.elements.inputs = { 1120 seek: B.call( 1121 this, 1122 this.config.selectors.inputs.seek 1123 ), 1124 volume: B.call( 1125 this, 1126 this.config.selectors.inputs.volume 1127 ), 1128 }), 1129 (this.elements.display = { 1130 buffer: B.call( 1131 this, 1132 this.config.selectors.display.buffer 1133 ), 1134 currentTime: B.call( 1135 this, 1136 this.config.selectors.display.currentTime 1137 ),
1138 duration: B.call( 1139 this, 1140 this.config.selectors.display.duration 1141 ), 1142 }), 1143 S.element(this.elements.progress) && 1144 (this.elements.display.seekTooltip = 1145 this.elements.progress.querySelector( 1146 `.${this.config.classNames.tooltip}` 1147 )), 1148 !0 1149 ); 1150 } catch (e) { 1151 return ( 1152 this.debug.warn( 1153 "It looks like there is a problem with your custom controls HTML", 1154 e 1155 ), 1156 this.toggleNativeControls(!0), 1157 !1 1158 ); 1159 } 1160 }, 1161 createIcon(e, t) { 1162 const i = "http://www.w3.org/2000/svg", 1163 s = Pe.getIconUrl.call(this), 1164 n = `${s.cors ? "" : s.url}#${this.config.iconPrefix}`, 1165 a = document.createElementNS(i, "svg"); 1166 I(a, x(t, { "aria-hidden": "true", focusable: "false" })); 1167 const l = document.createElementNS(i, "use"), 1168 r = `${n}-${e}`; 1169 return ( 1170 "href" in l && 1171 l.setAttributeNS( 1172 "http://www.w3.org/1999/xlink", 1173 "href", 1174 r 1175 ), 1176 l.setAttributeNS( 1177 "http://www.w3.org/1999/xlink", 1178 "xlink:href", 1179 r 1180 ), 1181 a.appendChild(l), 1182 a 1183 ); 1184 }, 1185 createLabel(e, t = {}) { 1186 const i = ve.get(e, this.config); 1187 return $( 1188 "span", 1189 { 1190 ...t, 1191 class: [t.class, this.config.classNames.hidden] 1192 .filter(Boolean) 1193 .join(" "), 1194 }, 1195 i 1196 ); 1197 }, 1198 createBadge(e) { 1199 if (S.empty(e)) return null; 1200 const t = $("span", { 1201 class: this.config.classNames.menu.value, 1202 }); 1203 return ( 1204 t.appendChild( 1205 $( 1206 "span", 1207 { class: this.config.classNames.menu.badge }, 1208 e 1209 ) 1210 ), 1211 t 1212 ); 1213 }, 1214 createButton(e, t) { 1215 const i = x({}, t); 1216 let s = fe(e); 1217 const n = { 1218 element: "button", 1219 toggle: !1, 1220 label: null, 1221 icon: null, 1222 labelPressed: null, 1223 iconPressed: null, 1224 }; 1225 switch ( 1226 (["element", "icon", "label"].forEach((e) => { 1227 Object.keys(i).includes(e) && 1228 ((n[e] = i[e]), delete i[e]); 1229 }), 1230 "button" !== n.element || 1231 Object.keys(i).includes("type") || 1232 (i.type = "button"), 1233 Object.keys(i).includes("class") 1234 ? i.class 1235 .split(" ") 1236 .some( 1237 (e) => e === this.config.classNames.control 1238 ) || 1239 x(i, { 1240 class: `${i.class} ${this.config.classNames.control}`, 1241 }) 1242 : (i.class = this.config.classNames.control), 1243 e) 1244 ) { 1245 case "play": 1246 (n.toggle = !0), 1247 (n.label = "play"), 1248 (n.labelPressed = "pause"), 1249 (n.icon = "play"), 1250 (n.iconPressed = "pause"); 1251 break; 1252 case "mute": 1253 (n.toggle = !0), 1254 (n.label = "mute"), 1255 (n.labelPressed = "unmute"), 1256 (n.icon = "volume"), 1257 (n.iconPressed = "muted"); 1258 break; 1259 case "captions": 1260 (n.toggle = !0), 1261 (n.label = "enableCaptions"), 1262 (n.labelPressed = "disableCaptions"), 1263 (n.icon = "captions-off"), 1264 (n.iconPressed = "captions-on"); 1265 break; 1266 case "fullscreen": 1267 (n.toggle = !0), 1268 (n.label = "enterFullscreen"), 1269 (n.labelPressed = "exitFullscreen"), 1270 (n.icon = "enter-fullscreen"), 1271 (n.iconPressed = "exit-fullscreen"); 1272 break; 1273 case "play-large": 1274 (i.class += ` ${this.config.classNames.control}--overlaid`), 1275 (s = "play"), 1276 (n.label = "play"), 1277 (n.icon = "play"); 1278 break; 1279 default: 1280 S.empty(n.label) && (n.label = s), 1281 S.empty(n.icon) && (n.icon = e); 1282 } 1283 const a = $(n.element); 1284 return ( 1285 n.toggle 1286 ? (a.appendChild( 1287 Pe.createIcon.call(this, n.iconPressed, { 1288 class: "icon--pressed", 1289 }) 1290 ), 1291 a.appendChild( 1292 Pe.createIcon.call(this, n.icon, { 1293 class: "icon--not-pressed", 1294 }) 1295 ), 1296 a.appendChild( 1297 Pe.createLabel.call(this, n.labelPressed, { 1298 class: "label--pressed", 1299 }) 1300 ), 1301 a.appendChild( 1302 Pe.createLabel.call(this, n.label, { 1303 class: "label--not-pressed", 1304 }) 1305 )) 1306 : (a.appendChild(Pe.createIcon.call(this, n.icon)), 1307 a.appendChild(Pe.createLabel.call(this, n.label))), 1308 x(i, D(this.config.selectors.buttons[s], i)), 1309 I(a, i), 1310 "play" === s 1311 ? (S.array(this.elements.buttons[s]) || 1312 (this.elements.buttons[s] = []), 1313 this.elements.buttons[s].push(a)) 1314 : (this.elements.buttons[s] = a), 1315 a 1316 ); 1317 }, 1318 createRange(e, t) { 1319 const i = $( 1320 "input", 1321 x( 1322 D(this.config.selectors.inputs[e]), 1323 { 1324 type: "range", 1325 min: 0, 1326 max: 100, 1327 step: 0.01, 1328 value: 0, 1329 autocomplete: "off", 1330 role: "slider", 1331 "aria-label": ve.get(e, this.config), 1332 "aria-valuemin": 0, 1333 "aria-valuemax": 100, 1334 "aria-valuenow": 0, 1335 }, 1336 t 1337 ) 1338 ); 1339 return ( 1340 (this.elements.inputs[e] = i), 1341 Pe.updateRangeFill.call(this, i), 1342 g.setup(i), 1343 i 1344 ); 1345 }, 1346 createProgress(e, t) { 1347 const i = $( 1348 "progress", 1349 x( 1350 D(this.config.selectors.display[e]), 1351 { 1352 min: 0, 1353 max: 100, 1354 value: 0, 1355 role: "progressbar", 1356 "aria-hidden": !0, 1357 }, 1358 t 1359 ) 1360 ); 1361 if ("volume" !== e) { 1362 i.appendChild($("span", null, "0")); 1363 const t = { played: "played", buffer: "buffered" }[e], 1364 s = t ? ve.get(t, this.config) : ""; 1365 i.innerText = `% ${s.toLowerCase()}`; 1366 }
1367 return (this.elements.display[e] = i), i; 1368 }, 1369 createTime(e, t) { 1370 const i = D(this.config.selectors.display[e], t), 1371 s = $( 1372 "div", 1373 x(i, { 1374 class: `${i.class ? i.class : ""} ${ 1375 this.config.classNames.display.time 1376 } `.trim(), 1377 "aria-label": ve.get(e, this.config), 1378 role: "timer", 1379 }), 1380 "00:00" 1381 ); 1382 return (this.elements.display[e] = s), s; 1383 }, 1384 bindMenuItemShortcuts(e, t) { 1385 X.call( 1386 this, 1387 e, 1388 "keydown keyup", 1389 (i) => { 1390 if ( 1391 ![ 1392 " ", 1393 "ArrowUp", 1394 "ArrowDown", 1395 "ArrowRight", 1396 ].includes(i.key) 1397 ) 1398 return; 1399 if ( 1400 (i.preventDefault(), 1401 i.stopPropagation(), 1402 "keydown" === i.type) 1403 ) 1404 return; 1405 const s = V(e, '[role="menuitemradio"]'); 1406 if (!s && [" ", "ArrowRight"].includes(i.key)) 1407 Pe.showMenuPanel.call(this, t, !0); 1408 else { 1409 let t; 1410 " " !== i.key && 1411 ("ArrowDown" === i.key || 1412 (s && "ArrowRight" === i.key) 1413 ? ((t = e.nextElementSibling), 1414 S.element(t) || 1415 (t = 1416 e.parentNode.firstElementChild)) 1417 : ((t = e.previousElementSibling), 1418 S.element(t) || 1419 (t = 1420 e.parentNode.lastElementChild)), 1421 W.call(this, t, !0)); 1422 } 1423 }, 1424 !1 1425 ), 1426 X.call(this, e, "keyup", (e) => { 1427 "Return" === e.key && 1428 Pe.focusFirstMenuItem.call(this, null, !0); 1429 }); 1430 }, 1431 createMenuItem({ 1432 value: e, 1433 list: t, 1434 type: i, 1435 title: s, 1436 badge: n = null, 1437 checked: a = !1, 1438 }) { 1439 const l = D(this.config.selectors.inputs[i]), 1440 r = $( 1441 "button", 1442 x(l, { 1443 type: "button", 1444 role: "menuitemradio", 1445 class: `${this.config.classNames.control} ${ 1446 l.class ? l.class : "" 1447 }`.trim(), 1448 "aria-checked": a, 1449 value: e, 1450 }) 1451 ), 1452 o = $("span"); 1453 (o.innerHTML = s), 1454 S.element(n) && o.appendChild(n), 1455 r.appendChild(o), 1456 Object.defineProperty(r, "checked", { 1457 enumerable: !0, 1458 get: () => "true" === r.getAttribute("aria-checked"), 1459 set(e) { 1460 e && 1461 Array.from(r.parentNode.children) 1462 .filter((e) => 1463 V(e, '[role="menuitemradio"]') 1464 ) 1465 .forEach((e) => 1466 e.setAttribute("aria-checked", "false") 1467 ), 1468 r.setAttribute( 1469 "aria-checked", 1470 e ? "true" : "false" 1471 ); 1472 }, 1473 }), 1474 this.listeners.bind( 1475 r, 1476 "click keyup", 1477 (t) => { 1478 if (!S.keyboardEvent(t) || " " === t.key) { 1479 switch ( 1480 (t.preventDefault(), 1481 t.stopPropagation(), 1482 (r.checked = !0), 1483 i) 1484 ) { 1485 case "language": 1486 this.currentTrack = Number(e); 1487 break; 1488 case "quality": 1489 this.quality = e; 1490 break; 1491 case "speed": 1492 this.speed = parseFloat(e); 1493 } 1494 Pe.showMenuPanel.call( 1495 this, 1496 "home", 1497 S.keyboardEvent(t) 1498 ); 1499 } 1500 }, 1501 i, 1502 !1 1503 ), 1504 Pe.bindMenuItemShortcuts.call(this, r, i), 1505 t.appendChild(r); 1506 }, 1507 formatTime(e = 0, t = !1) { 1508 if (!S.number(e)) return e; 1509 return Ee(e, Ce(this.duration) > 0, t); 1510 }, 1511 updateTimeDisplay(e = null, t = 0, i = !1) { 1512 S.element(e) && 1513 S.number(t) && 1514 (e.innerText = Pe.formatTime(t, i)); 1515 }, 1516 updateVolume() { 1517 this.supported.ui && 1518 (S.element(this.elements.inputs.volume) && 1519 Pe.setRange.call( 1520 this, 1521 this.elements.inputs.volume, 1522 this.muted ? 0 : this.volume 1523 ), 1524 S.element(this.elements.buttons.mute) && 1525 (this.elements.buttons.mute.pressed = 1526 this.muted || 0 === this.volume)); 1527 }, 1528 setRange(e, t = 0) { 1529 S.element(e) && 1530 ((e.value = t), Pe.updateRangeFill.call(this, e)); 1531 }, 1532 updateProgress(e) { 1533 if (!this.supported.ui || !S.event(e)) return; 1534 let t = 0; 1535 const i = (e, t) => { 1536 const i = S.number(t) ? t : 0, 1537 s = S.element(e) ? e : this.elements.display.buffer;
1538 if (S.element(s)) { 1539 s.value = i; 1540 const e = s.getElementsByTagName("span")[0]; 1541 S.element(e) && (e.childNodes[0].nodeValue = i); 1542 } 1543 }; 1544 if (e) 1545 switch (e.type) { 1546 case "timeupdate": 1547 case "seeking": 1548 case "seeked": 1549 (s = this.currentTime), 1550 (n = this.duration), 1551 (t = 1552 0 === s || 1553 0 === n || 1554 Number.isNaN(s) || 1555 Number.isNaN(n) 1556 ? 0 1557 : ((s / n) * 100).toFixed(2)), 1558 "timeupdate" === e.type && 1559 Pe.setRange.call( 1560 this, 1561 this.elements.inputs.seek, 1562 t 1563 ); 1564 break; 1565 case "playing": 1566 case "progress": 1567 i( 1568 this.elements.display.buffer, 1569 100 * this.buffered 1570 ); 1571 } 1572 var s, n; 1573 }, 1574 updateRangeFill(e) { 1575 const t = S.event(e) ? e.target : e; 1576 if (S.element(t) && "range" === t.getAttribute("type")) { 1577 if (V(t, this.config.selectors.inputs.seek)) { 1578 t.setAttribute("aria-valuenow", this.currentTime); 1579 const e = Pe.formatTime(this.currentTime), 1580 i = Pe.formatTime(this.duration), 1581 s = ve.get("seekLabel", this.config); 1582 t.setAttribute( 1583 "aria-valuetext", 1584 s 1585 .replace("{currentTime}", e) 1586 .replace("{duration}", i) 1587 ); 1588 } else if (V(t, this.config.selectors.inputs.volume)) { 1589 const e = 100 * t.value; 1590 t.setAttribute("aria-valuenow", e), 1591 t.setAttribute( 1592 "aria-valuetext", 1593 `${e.toFixed(1)}%` 1594 ); 1595 } else t.setAttribute("aria-valuenow", t.value); 1596 (M.isWebKit || M.isIPadOS) && 1597 t.style.setProperty( 1598 "--value", 1599 (t.value / t.max) * 100 + "%" 1600 ); 1601 } 1602 }, 1603 updateSeekTooltip(e) { 1604 var t, i; 1605 if ( 1606 !this.config.tooltips.seek || 1607 !S.element(this.elements.inputs.seek) || 1608 !S.element(this.elements.display.seekTooltip) || 1609 0 === this.duration 1610 ) 1611 return; 1612 const s = this.elements.display.seekTooltip, 1613 n = `${this.config.classNames.tooltip}--visible`, 1614 a = (e) => R(s, n, e); 1615 if (this.touch) return void a(!1); 1616 let l = 0; 1617 const r = this.elements.progress.getBoundingClientRect(); 1618 if (S.event(e)) l = (100 / r.width) * (e.pageX - r.left); 1619 else { 1620 if (!F(s, n)) return; 1621 l = parseFloat(s.style.left, 10); 1622 } 1623 l < 0 ? (l = 0) : l > 100 && (l = 100); 1624 const o = (this.duration / 100) * l; 1625 s.innerText = Pe.formatTime(o); 1626 const c = 1627 null === (t = this.config.markers) || 1628 void 0 === t || 1629 null === (i = t.points) || 1630 void 0 === i 1631 ? void 0 1632 : i.find(({ time: e }) => e === Math.round(o)); 1633 c && s.insertAdjacentHTML("afterbegin", `${c.label}<br>`), 1634 (s.style.left = `${l}%`), 1635 S.event(e) && 1636 ["mouseenter", "mouseleave"].includes(e.type) && 1637 a("mouseenter" === e.type); 1638 }, 1639 timeUpdate(e) { 1640 const t = 1641 !S.element(this.elements.display.duration) && 1642 this.config.invertTime; 1643 Pe.updateTimeDisplay.call( 1644 this, 1645 this.elements.display.currentTime, 1646 t ? this.duration - this.currentTime : this.currentTime, 1647 t 1648 ), 1649 (e && "timeupdate" === e.type && this.media.seeking) || 1650 Pe.updateProgress.call(this, e); 1651 }, 1652 durationUpdate() { 1653 if ( 1654 !this.supported.ui || 1655 (!this.config.invertTime && this.currentTime) 1656 ) 1657 return; 1658 if (this.duration >= 2 ** 32) 1659 return ( 1660 H(this.elements.display.currentTime, !0), 1661 void H(this.elements.progress, !0) 1662 ); 1663 S.element(this.elements.inputs.seek) && 1664 this.elements.inputs.seek.setAttribute( 1665 "aria-valuemax", 1666 this.duration 1667 ); 1668 const e = S.element(this.elements.display.duration); 1669 !e && 1670 this.config.displayDuration && 1671 this.paused && 1672 Pe.updateTimeDisplay.call( 1673 this, 1674 this.elements.display.currentTime, 1675 this.duration 1676 ), 1677 e && 1678 Pe.updateTimeDisplay.call( 1679 this, 1680 this.elements.display.duration, 1681 this.duration 1682 ), 1683 this.config.markers.enabled && Pe.setMarkers.call(this), 1684 Pe.updateSeekTooltip.call(this); 1685 }, 1686 toggleMenuButton(e, t) { 1687 H(this.elements.settings.buttons[e], !t); 1688 }, 1689 updateSetting(e, t, i) { 1690 const s = this.elements.settings.panels[e]; 1691 let n = null, 1692 a = t; 1693 if ("captions" === e) n = this.currentTrack; 1694 else { 1695 if ( 1696 ((n = S.empty(i) ? this[e] : i), 1697 S.empty(n) && (n = this.config[e].default), 1698 !S.empty(this.options[e]) && 1699 !this.options[e].includes(n)) 1700 ) 1701 return void this.debug.warn( 1702 `Unsupported value of '${n}' for ${e}` 1703 ); 1704 if (!this.config[e].options.includes(n)) 1705 return void this.debug.warn( 1706 `Disabled value of '${n}' for ${e}` 1707 ); 1708 } 1709 if (
1710 (S.element(a) || 1711 (a = s && s.querySelector('[role="menu"]')), 1712 !S.element(a)) 1713 ) 1714 return; 1715 this.elements.settings.buttons[e].querySelector( 1716 `.${this.config.classNames.menu.value}` 1717 ).innerHTML = Pe.getLabel.call(this, e, n); 1718 const l = a && a.querySelector(`[value="${n}"]`); 1719 S.element(l) && (l.checked = !0); 1720 }, 1721 getLabel(e, t) { 1722 switch (e) { 1723 case "speed": 1724 return 1 === t 1725 ? ve.get("normal", this.config) 1726 : `${t}×`; 1727 case "quality": 1728 if (S.number(t)) { 1729 const e = ve.get(`qualityLabel.${t}`, this.config); 1730 return e.length ? e : `${t}p`; 1731 } 1732 return ge(t); 1733 case "captions": 1734 return xe.getLabel.call(this); 1735 default: 1736 return null; 1737 } 1738 }, 1739 setQualityMenu(e) { 1740 if (!S.element(this.elements.settings.panels.quality)) return; 1741 const t = "quality", 1742 i = 1743 this.elements.settings.panels.quality.querySelector( 1744 '[role="menu"]' 1745 ); 1746 S.array(e) && 1747 (this.options.quality = se(e).filter((e) => 1748 this.config.quality.options.includes(e) 1749 )); 1750 const s = 1751 !S.empty(this.options.quality) && 1752 this.options.quality.length > 1; 1753 if ( 1754 (Pe.toggleMenuButton.call(this, t, s), 1755 j(i), 1756 Pe.checkMenu.call(this), 1757 !s) 1758 ) 1759 return; 1760 const n = (e) => { 1761 const t = ve.get(`qualityBadge.${e}`, this.config); 1762 return t.length ? Pe.createBadge.call(this, t) : null; 1763 }; 1764 this.options.quality 1765 .sort((e, t) => { 1766 const i = this.config.quality.options; 1767 return i.indexOf(e) > i.indexOf(t) ? 1 : -1; 1768 }) 1769 .forEach((e) => { 1770 Pe.createMenuItem.call(this, { 1771 value: e, 1772 list: i, 1773 type: t, 1774 title: Pe.getLabel.call(this, "quality", e), 1775 badge: n(e), 1776 }); 1777 }), 1778 Pe.updateSetting.call(this, t, i); 1779 }, 1780 setCaptionsMenu() { 1781 if (!S.element(this.elements.settings.panels.captions)) return; 1782 const e = "captions", 1783 t = 1784 this.elements.settings.panels.captions.querySelector( 1785 '[role="menu"]' 1786 ), 1787 i = xe.getTracks.call(this), 1788 s = Boolean(i.length); 1789 if ( 1790 (Pe.toggleMenuButton.call(this, e, s), 1791 j(t), 1792 Pe.checkMenu.call(this), 1793 !s) 1794 ) 1795 return; 1796 const n = i.map((e, i) => ({ 1797 value: i, 1798 checked: this.captions.toggled && this.currentTrack === i, 1799 title: xe.getLabel.call(this, e), 1800 badge: 1801 e.language && 1802 Pe.createBadge.call(this, e.language.toUpperCase()), 1803 list: t, 1804 type: "language", 1805 })); 1806 n.unshift({ 1807 value: -1, 1808 checked: !this.captions.toggled, 1809 title: ve.get("disabled", this.config), 1810 list: t, 1811 type: "language", 1812 }),
1813 n.forEach(Pe.createMenuItem.bind(this)), 1814 Pe.updateSetting.call(this, e, t); 1815 }, 1816 setSpeedMenu() { 1817 if (!S.element(this.elements.settings.panels.speed)) return; 1818 const e = "speed", 1819 t = 1820 this.elements.settings.panels.speed.querySelector( 1821 '[role="menu"]' 1822 ); 1823 this.options.speed = this.options.speed.filter( 1824 (e) => e >= this.minimumSpeed && e <= this.maximumSpeed 1825 ); 1826 const i = 1827 !S.empty(this.options.speed) && 1828 this.options.speed.length > 1; 1829 Pe.toggleMenuButton.call(this, e, i), 1830 j(t), 1831 Pe.checkMenu.call(this), 1832 i && 1833 (this.options.speed.forEach((i) => { 1834 Pe.createMenuItem.call(this, { 1835 value: i, 1836 list: t, 1837 type: e, 1838 title: Pe.getLabel.call(this, "speed", i), 1839 }); 1840 }), 1841 Pe.updateSetting.call(this, e, t)); 1842 }, 1843 checkMenu() { 1844 const { buttons: e } = this.elements.settings, 1845 t = !S.empty(e) && Object.values(e).some((e) => !e.hidden); 1846 H(this.elements.settings.menu, !t); 1847 }, 1848 focusFirstMenuItem(e, t = !1) { 1849 if (this.elements.settings.popup.hidden) return; 1850 let i = e; 1851 S.element(i) || 1852 (i = Object.values(this.elements.settings.panels).find( 1853 (e) => !e.hidden 1854 )); 1855 const s = i.querySelector('[role^="menuitem"]'); 1856 W.call(this, s, t); 1857 }, 1858 toggleMenu(e) { 1859 const { popup: t } = this.elements.settings, 1860 i = this.elements.buttons.settings; 1861 if (!S.element(t) || !S.element(i)) return; 1862 const { hidden: s } = t; 1863 let n = s; 1864 if (S.boolean(e)) n = e; 1865 else if (S.keyboardEvent(e) && "Escape" === e.key) n = !1; 1866 else if (S.event(e)) { 1867 const s = S.function(e.composedPath) 1868 ? e.composedPath()[0] 1869 : e.target, 1870 a = t.contains(s); 1871 if (a || (!a && e.target !== i && n)) return; 1872 } 1873 i.setAttribute("aria-expanded", n), 1874 H(t, !n), 1875 R( 1876 this.elements.container, 1877 this.config.classNames.menu.open, 1878 n 1879 ), 1880 n && S.keyboardEvent(e) 1881 ? Pe.focusFirstMenuItem.call(this, null, !0) 1882 : n || s || W.call(this, i, S.keyboardEvent(e)); 1883 }, 1884 getMenuSize(e) { 1885 const t = e.cloneNode(!0); 1886 (t.style.position = "absolute"), 1887 (t.style.opacity = 0), 1888 t.removeAttribute("hidden"), 1889 e.parentNode.appendChild(t); 1890 const i = t.scrollWidth, 1891 s = t.scrollHeight; 1892 return O(t), { width: i, height: s }; 1893 }, 1894 showMenuPanel(e = "", t = !1) { 1895 const i = this.elements.container.querySelector( 1896 `#plyr-settings-${this.id}-${e}` 1897 ); 1898 if (!S.element(i)) return; 1899 const s = i.parentNode, 1900 n = Array.from(s.children).find((e) => !e.hidden); 1901 if (K.transitions && !K.reducedMotion) { 1902 (s.style.width = `${n.scrollWidth}px`), 1903 (s.style.height = `${n.scrollHeight}px`); 1904 const e = Pe.getMenuSize.call(this, i), 1905 t = (e) => { 1906 e.target === s && 1907 ["width", "height"].includes(e.propertyName) && 1908 ((s.style.width = ""), 1909 (s.style.height = ""), 1910 J.call(this, s, E, t)); 1911 }; 1912 X.call(this, s, E, t), 1913 (s.style.width = `${e.width}px`), 1914 (s.style.height = `${e.height}px`); 1915 } 1916 H(n, !0), H(i, !1), Pe.focusFirstMenuItem.call(this, i, t); 1917 },
1918 setDownloadUrl() { 1919 const e = this.elements.buttons.download; 1920 S.element(e) && e.setAttribute("href", this.download); 1921 }, 1922 create(e) { 1923 const { 1924 bindMenuItemShortcuts: t, 1925 createButton: i, 1926 createProgress: s, 1927 createRange: n, 1928 createTime: a, 1929 setQualityMenu: l, 1930 setSpeedMenu: r, 1931 showMenuPanel: o, 1932 } = Pe; 1933 (this.elements.controls = null), 1934 S.array(this.config.controls) && 1935 this.config.controls.includes("play-large") && 1936 this.elements.container.appendChild( 1937 i.call(this, "play-large") 1938 ); 1939 const c = $("div", D(this.config.selectors.controls.wrapper)); 1940 this.elements.controls = c; 1941 const u = { class: "plyr__controls__item" }; 1942 return ( 1943 se( 1944 S.array(this.config.controls) 1945 ? this.config.controls 1946 : [] 1947 ).forEach((l) => { 1948 if ( 1949 ("restart" === l && 1950 c.appendChild(i.call(this, "restart", u)), 1951 "rewind" === l && 1952 c.appendChild(i.call(this, "rewind", u)), 1953 "play" === l && 1954 c.appendChild(i.call(this, "play", u)), 1955 "fast-forward" === l && 1956 c.appendChild(i.call(this, "fast-forward", u)), 1957 "progress" === l) 1958 ) { 1959 const t = $("div", { 1960 class: `${u.class} plyr__progress__container`, 1961 }), 1962 i = $("div", D(this.config.selectors.progress)); 1963 if ( 1964 (i.appendChild( 1965 n.call(this, "seek", { 1966 id: `plyr-seek-${e.id}`, 1967 }) 1968 ), 1969 i.appendChild(s.call(this, "buffer")), 1970 this.config.tooltips.seek) 1971 ) { 1972 const e = $( 1973 "span", 1974 { class: this.config.classNames.tooltip }, 1975 "00:00" 1976 ); 1977 i.appendChild(e), 1978 (this.elements.display.seekTooltip = e); 1979 } 1980 (this.elements.progress = i), 1981 t.appendChild(this.elements.progress), 1982 c.appendChild(t); 1983 } 1984 if ( 1985 ("current-time" === l && 1986 c.appendChild(a.call(this, "currentTime", u)), 1987 "duration" === l && 1988 c.appendChild(a.call(this, "duration", u)), 1989 "mute" === l || "volume" === l) 1990 ) { 1991 let { volume: t } = this.elements; 1992 if ( 1993 ((S.element(t) && c.contains(t)) || 1994 ((t = $( 1995 "div", 1996 x({}, u, { 1997 class: `${u.class} plyr__volume`.trim(), 1998 }) 1999 )), 2000 (this.elements.volume = t), 2001 c.appendChild(t)), 2002 "mute" === l && 2003 t.appendChild(i.call(this, "mute")), 2004 "volume" === l && !M.isIos && !M.isIPadOS) 2005 ) { 2006 const i = { 2007 max: 1, 2008 step: 0.05, 2009 value: this.config.volume, 2010 }; 2011 t.appendChild( 2012 n.call( 2013 this, 2014 "volume", 2015 x(i, { id: `plyr-volume-${e.id}` }) 2016 ) 2017 ); 2018 } 2019 } 2020 if ( 2021 ("captions" === l && 2022 c.appendChild(i.call(this, "captions", u)), 2023 "settings" === l && !S.empty(this.config.settings)) 2024 ) { 2025 const s = $( 2026 "div", 2027 x({}, u, { 2028 class: `${u.class} plyr__menu`.trim(), 2029 hidden: "", 2030 }) 2031 ); 2032 s.appendChild( 2033 i.call(this, "settings", { 2034 "aria-haspopup": !0, 2035 "aria-controls": `plyr-settings-${e.id}`, 2036 "aria-expanded": !1, 2037 }) 2038 ); 2039 const n = $("div", { 2040 class: "plyr__menu__container", 2041 id: `plyr-settings-${e.id}`, 2042 hidden: "", 2043 }), 2044 a = $("div"), 2045 l = $("div", { 2046 id: `plyr-settings-${e.id}-home`, 2047 }), 2048 r = $("div", { role: "menu" }); 2049 l.appendChild(r), 2050 a.appendChild(l), 2051 (this.elements.settings.panels.home = l), 2052 this.config.settings.forEach((i) => { 2053 const s = $( 2054 "button", 2055 x( 2056 D( 2057 this.config.selectors.buttons 2058 .settings 2059 ), 2060 { 2061 type: "button", 2062 class: `${this.config.classNames.control} ${this.config.classNames.control}--forward`, 2063 role: "menuitem", 2064 "aria-haspopup": !0, 2065 hidden: "", 2066 } 2067 ) 2068 ); 2069 t.call(this, s, i), 2070 X.call(this, s, "click", () => { 2071 o.call(this, i, !1); 2072 }); 2073 const n = $( 2074 "span", 2075 null, 2076 ve.get(i, this.config) 2077 ), 2078 l = $("span", { 2079 class: this.config.classNames.menu 2080 .value, 2081 }); 2082 (l.innerHTML = e[i]), 2083 n.appendChild(l), 2084 s.appendChild(n), 2085 r.appendChild(s); 2086 const c = $("div", { 2087 id: `plyr-settings-${e.id}-${i}`, 2088 hidden: "", 2089 }), 2090 u = $("button", { 2091 type: "button",
2092 class: `${this.config.classNames.control} ${this.config.classNames.control}--back`, 2093 }); 2094 u.appendChild( 2095 $( 2096 "span", 2097 { "aria-hidden": !0 }, 2098 ve.get(i, this.config) 2099 ) 2100 ), 2101 u.appendChild( 2102 $( 2103 "span", 2104 { 2105 class: this.config 2106 .classNames.hidden, 2107 }, 2108 ve.get("menuBack", this.config) 2109 ) 2110 ), 2111 X.call( 2112 this, 2113 c, 2114 "keydown", 2115 (e) => { 2116 "ArrowLeft" === e.key && 2117 (e.preventDefault(), 2118 e.stopPropagation(), 2119 o.call(this, "home", !0)); 2120 }, 2121 !1 2122 ), 2123 X.call(this, u, "click", () => { 2124 o.call(this, "home", !1); 2125 }), 2126 c.appendChild(u), 2127 c.appendChild( 2128 $("div", { role: "menu" }) 2129 ), 2130 a.appendChild(c), 2131 (this.elements.settings.buttons[i] = s), 2132 (this.elements.settings.panels[i] = c); 2133 }), 2134 n.appendChild(a), 2135 s.appendChild(n), 2136 c.appendChild(s), 2137 (this.elements.settings.popup = n), 2138 (this.elements.settings.menu = s); 2139 } 2140 if ( 2141 ("pip" === l && 2142 K.pip && 2143 c.appendChild(i.call(this, "pip", u)), 2144 "airplay" === l && 2145 K.airplay && 2146 c.appendChild(i.call(this, "airplay", u)), 2147 "download" === l) 2148 ) { 2149 const e = x({}, u, { 2150 element: "a", 2151 href: this.download, 2152 target: "_blank", 2153 }); 2154 this.isHTML5 && (e.download = ""); 2155 const { download: t } = this.config.urls; 2156 !S.url(t) && 2157 this.isEmbed && 2158 x(e, { 2159 icon: `logo-${this.provider}`, 2160 label: this.provider, 2161 }), 2162 c.appendChild(i.call(this, "download", e)); 2163 } 2164 "fullscreen" === l && 2165 c.appendChild(i.call(this, "fullscreen", u)); 2166 }), 2167 this.isHTML5 && 2168 l.call(this, de.getQualityOptions.call(this)), 2169 r.call(this), 2170 c 2171 ); 2172 }, 2173 inject() { 2174 if (this.config.loadSprite) { 2175 const e = Pe.getIconUrl.call(this); 2176 e.cors && ke(e.url, "sprite-plyr"); 2177 } 2178 this.id = Math.floor(1e4 * Math.random()); 2179 let e = null; 2180 this.elements.controls = null; 2181 const t = { 2182 id: this.id, 2183 seektime: this.config.seekTime, 2184 title: this.config.title, 2185 }; 2186 let i = !0; 2187 S.function(this.config.controls) && 2188 (this.config.controls = this.config.controls.call(this, t)), 2189 this.config.controls || (this.config.controls = []), 2190 S.element(this.config.controls) || 2191 S.string(this.config.controls) 2192 ? (e = this.config.controls) 2193 : ((e = Pe.create.call(this, { 2194 id: this.id, 2195 seektime: this.config.seekTime, 2196 speed: this.speed, 2197 quality: this.quality, 2198 captions: xe.getLabel.call(this), 2199 })), 2200 (i = !1)); 2201 let s; 2202 i && 2203 S.string(this.config.controls) && 2204 (e = ((e) => { 2205 let i = e; 2206 return ( 2207 Object.entries(t).forEach(([e, t]) => { 2208 i = pe(i, `{${e}}`, t); 2209 }), 2210 i 2211 ); 2212 })(e)), 2213 S.string(this.config.selectors.controls.container) && 2214 (s = document.querySelector( 2215 this.config.selectors.controls.container 2216 )), 2217 S.element(s) || (s = this.elements.container); 2218 if ( 2219 (s[ 2220 S.element(e) 2221 ? "insertAdjacentElement" 2222 : "insertAdjacentHTML" 2223 ]("afterbegin", e), 2224 S.element(this.elements.controls) || 2225 Pe.findElements.call(this), 2226 !S.empty(this.elements.buttons)) 2227 ) { 2228 const e = (e) => { 2229 const t = this.config.classNames.controlPressed; 2230 e.setAttribute("aria-pressed", "false"), 2231 Object.defineProperty(e, "pressed", { 2232 configurable: !0, 2233 enumerable: !0, 2234 get: () => F(e, t), 2235 set(i = !1) { 2236 R(e, t, i), 2237 e.setAttribute( 2238 "aria-pressed", 2239 i ? "true" : "false" 2240 ); 2241 }, 2242 }); 2243 }; 2244 Object.values(this.elements.buttons) 2245 .filter(Boolean) 2246 .forEach((t) => { 2247 S.array(t) || S.nodeList(t)
2248 ? Array.from(t).filter(Boolean).forEach(e) 2249 : e(t); 2250 }); 2251 } 2252 if ((M.isEdge && P(s), this.config.tooltips.controls)) { 2253 const { classNames: e, selectors: t } = this.config, 2254 i = `${t.controls.wrapper} ${t.labels} .${e.hidden}`, 2255 s = U.call(this, i); 2256 Array.from(s).forEach((e) => { 2257 R(e, this.config.classNames.hidden, !1), 2258 R(e, this.config.classNames.tooltip, !0); 2259 }); 2260 } 2261 }, 2262 setMediaMetadata() { 2263 try { 2264 "mediaSession" in navigator && 2265 (navigator.mediaSession.metadata = 2266 new window.MediaMetadata({ 2267 title: this.config.mediaMetadata.title, 2268 artist: this.config.mediaMetadata.artist, 2269 album: this.config.mediaMetadata.album, 2270 artwork: this.config.mediaMetadata.artwork, 2271 })); 2272 } catch (e) {} 2273 }, 2274 setMarkers() { 2275 var e, t; 2276 if (!this.duration || this.elements.markers) return; 2277 const i = 2278 null === (e = this.config.markers) || 2279 void 0 === e || 2280 null === (t = e.points) || 2281 void 0 === t 2282 ? void 0 2283 : t.filter(({ time: e }) => e > 0 && e < this.duration); 2284 if (null == i || !i.length) return; 2285 const s = document.createDocumentFragment(), 2286 n = document.createDocumentFragment(); 2287 let a = null; 2288 const l = `${this.config.classNames.tooltip}--visible`, 2289 r = (e) => R(a, l, e); 2290 i.forEach((e) => { 2291 const t = $( 2292 "span", 2293 { class: this.config.classNames.marker }, 2294 "" 2295 ), 2296 i = (e.time / this.duration) * 100 + "%"; 2297 a && 2298 (t.addEventListener("mouseenter", () => { 2299 e.label || 2300 ((a.style.left = i), 2301 (a.innerHTML = e.label), 2302 r(!0)); 2303 }), 2304 t.addEventListener("mouseleave", () => { 2305 r(!1); 2306 })), 2307 t.addEventListener("click", () => { 2308 this.currentTime = e.time; 2309 }), 2310 (t.style.left = i), 2311 n.appendChild(t); 2312 }), 2313 s.appendChild(n), 2314 this.config.tooltips.seek || 2315 ((a = $( 2316 "span", 2317 { class: this.config.classNames.tooltip }, 2318 "" 2319 )), 2320 s.appendChild(a)), 2321 (this.elements.markers = { points: n, tip: a }), 2322 this.elements.progress.appendChild(s); 2323 }, 2324 }; 2325 function Me(e, t = !0) { 2326 let i = e; 2327 if (t) { 2328 const e = document.createElement("a"); 2329 (e.href = i), (i = e.href); 2330 } 2331 try { 2332 return new URL(i); 2333 } catch (e) { 2334 return null; 2335 } 2336 } 2337 function Ne(e) { 2338 const t = new URLSearchParams(); 2339 return ( 2340 S.object(e) && 2341 Object.entries(e).forEach(([e, i]) => { 2342 t.set(e, i); 2343 }), 2344 t 2345 ); 2346 } 2347 const xe = { 2348 setup() { 2349 if (!this.supported.ui) return; 2350 if ( 2351 !this.isVideo || 2352 this.isYouTube || 2353 (this.isHTML5 && !K.textTracks) 2354 ) 2355 return void ( 2356 S.array(this.config.controls) && 2357 this.config.controls.includes("settings") && 2358 this.config.settings.includes("captions") && 2359 Pe.setCaptionsMenu.call(this) 2360 ); 2361 var e, t; 2362 if ( 2363 (S.element(this.elements.captions) || 2364 ((this.elements.captions = $( 2365 "div", 2366 D(this.config.selectors.captions) 2367 )), 2368 this.elements.captions.setAttribute("dir", "auto"), 2369 (e = this.elements.captions), 2370 (t = this.elements.wrapper), 2371 S.element(e) && 2372 S.element(t) && 2373 t.parentNode.insertBefore(e, t.nextSibling)), 2374 M.isIE && window.URL) 2375 ) { 2376 const e = this.media.querySelectorAll("track"); 2377 Array.from(e).forEach((e) => { 2378 const t = e.getAttribute("src"), 2379 i = Me(t); 2380 null !== i && 2381 i.hostname !== window.location.href.hostname && 2382 ["http:", "https:"].includes(i.protocol) && 2383 Te(t, "blob") 2384 .then((t) => { 2385 e.setAttribute( 2386 "src", 2387 window.URL.createObjectURL(t) 2388 ); 2389 }) 2390 .catch(() => { 2391 O(e); 2392 }); 2393 }); 2394 } 2395 const i = se( 2396 ( 2397 navigator.languages || [ 2398 navigator.language || 2399 navigator.userLanguage || 2400 "en", 2401 ] 2402 ).map((e) => e.split("-")[0]) 2403 ); 2404 let s = ( 2405 this.storage.get("language") || 2406 this.config.captions.language || 2407 "auto" 2408 ).toLowerCase(); 2409 "auto" === s && ([s] = i); 2410 let n = this.storage.get("captions"); 2411 if ( 2412 (S.boolean(n) || ({ active: n } = this.config.captions), 2413 Object.assign(this.captions, { 2414 toggled: !1, 2415 active: n, 2416 language: s, 2417 languages: i, 2418 }), 2419 this.isHTML5) 2420 ) { 2421 const e = this.config.captions.update 2422 ? "addtrack removetrack" 2423 : "removetrack"; 2424 X.call( 2425 this, 2426 this.media.textTracks, 2427 e, 2428 xe.update.bind(this) 2429 ); 2430 } 2431 setTimeout(xe.update.bind(this), 0); 2432 }, 2433 update() { 2434 const e = xe.getTracks.call(this, !0), 2435 { 2436 active: t, 2437 language: i, 2438 meta: s, 2439 currentTrackNode: n, 2440 } = this.captions, 2441 a = Boolean(e.find((e) => e.language === i)); 2442 this.isHTML5 && 2443 this.isVideo && 2444 e 2445 .filter((e) => !s.get(e)) 2446 .forEach((e) => { 2447 this.debug.log("Track added", e), 2448 s.set(e, { default: "showing" === e.mode }), 2449 "showing" === e.mode && (e.mode = "hidden"), 2450 X.call(this, e, "cuechange", () => 2451 xe.updateCues.call(this) 2452 ); 2453 }), 2454 ((a && this.language !== i) || !e.includes(n)) && 2455 (xe.setLanguage.call(this, i), 2456 xe.toggle.call(this, t && a)), 2457 this.elements && 2458 R( 2459 this.elements.container, 2460 this.config.classNames.captions.enabled, 2461 !S.empty(e) 2462 ), 2463 S.array(this.config.controls) && 2464 this.config.controls.includes("settings") && 2465 this.config.settings.includes("captions") && 2466 Pe.setCaptionsMenu.call(this); 2467 }, 2468 toggle(e, t = !0) { 2469 if (!this.supported.ui) return; 2470 const { toggled: i } = this.captions, 2471 s = this.config.classNames.captions.active, 2472 n = S.nullOrUndefined(e) ? !i : e; 2473 if (n !== i) { 2474 if ( 2475 (t || 2476 ((this.captions.active = n), 2477 this.storage.set({ captions: n })), 2478 !this.language && n && !t) 2479 ) { 2480 const e = xe.getTracks.call(this), 2481 t = xe.findTrack.call( 2482 this, 2483 [ 2484 this.captions.language, 2485 ...this.captions.languages, 2486 ], 2487 !0 2488 ); 2489 return ( 2490 (this.captions.language = t.language), 2491 void xe.set.call(this, e.indexOf(t)) 2492 ); 2493 } 2494 this.elements.buttons.captions && 2495 (this.elements.buttons.captions.pressed = n), 2496 R(this.elements.container, s, n), 2497 (this.captions.toggled = n), 2498 Pe.updateSetting.call(this, "captions"), 2499 Z.call( 2500 this, 2501 this.media, 2502 n ? "captionsenabled" : "captionsdisabled" 2503 ); 2504 } 2505 setTimeout(() => { 2506 n && 2507 this.captions.toggled && 2508 (this.captions.currentTrackNode.mode = "hidden"); 2509 }); 2510 }, 2511 set(e, t = !0) { 2512 const i = xe.getTracks.call(this); 2513 if (-1 !== e) 2514 if (S.number(e))
2515 if (e in i) { 2516 if (this.captions.currentTrack !== e) { 2517 this.captions.currentTrack = e; 2518 const s = i[e], 2519 { language: n } = s || {}; 2520 (this.captions.currentTrackNode = s), 2521 Pe.updateSetting.call(this, "captions"), 2522 t || 2523 ((this.captions.language = n), 2524 this.storage.set({ language: n })), 2525 this.isVimeo && 2526 this.embed.enableTextTrack(n), 2527 Z.call( 2528 this, 2529 this.media, 2530 "languagechange" 2531 ); 2532 } 2533 xe.toggle.call(this, !0, t), 2534 this.isHTML5 && 2535 this.isVideo && 2536 xe.updateCues.call(this); 2537 } else this.debug.warn("Track not found", e); 2538 else this.debug.warn("Invalid caption argument", e); 2539 else xe.toggle.call(this, !1, t); 2540 }, 2541 setLanguage(e, t = !0) { 2542 if (!S.string(e)) 2543 return void this.debug.warn( 2544 "Invalid language argument", 2545 e 2546 ); 2547 const i = e.toLowerCase(); 2548 this.captions.language = i; 2549 const s = xe.getTracks.call(this), 2550 n = xe.findTrack.call(this, [i]); 2551 xe.set.call(this, s.indexOf(n), t); 2552 }, 2553 getTracks(e = !1) { 2554 return Array.from((this.media || {}).textTracks || []) 2555 .filter( 2556 (t) => 2557 !this.isHTML5 || e || this.captions.meta.has(t) 2558 ) 2559 .filter((e) => 2560 ["captions", "subtitles"].includes(e.kind) 2561 ); 2562 }, 2563 findTrack(e, t = !1) { 2564 const i = xe.getTracks.call(this), 2565 s = (e) => 2566 Number((this.captions.meta.get(e) || {}).default), 2567 n = Array.from(i).sort((e, t) => s(t) - s(e)); 2568 let a; 2569 return ( 2570 e.every( 2571 (e) => ((a = n.find((t) => t.language === e)), !a) 2572 ), 2573 a || (t ? n[0] : void 0) 2574 ); 2575 }, 2576 getCurrentTrack() { 2577 return xe.getTracks.call(this)[this.currentTrack]; 2578 }, 2579 getLabel(e) { 2580 let t = e; 2581 return ( 2582 !S.track(t) && 2583 K.textTracks && 2584 this.captions.toggled && 2585 (t = xe.getCurrentTrack.call(this)), 2586 S.track(t) 2587 ? S.empty(t.label) 2588 ? S.empty(t.language) 2589 ? ve.get("enabled", this.config) 2590 : e.language.toUpperCase() 2591 : t.label 2592 : ve.get("disabled", this.config) 2593 ); 2594 }, 2595 updateCues(e) { 2596 if (!this.supported.ui) return; 2597 if (!S.element(this.elements.captions)) 2598 return void this.debug.warn( 2599 "No captions element to render to" 2600 ); 2601 if (!S.nullOrUndefined(e) && !Array.isArray(e)) 2602 return void this.debug.warn( 2603 "updateCues: Invalid input", 2604 e 2605 ); 2606 let t = e; 2607 if (!t) { 2608 const e = xe.getCurrentTrack.call(this); 2609 t = Array.from((e || {}).activeCues || []) 2610 .map((e) => e.getCueAsHTML()) 2611 .map(ye); 2612 } 2613 const i = t.map((e) => e.trim()).join("\n"); 2614 if (i !== this.elements.captions.innerHTML) { 2615 j(this.elements.captions); 2616 const e = $("span", D(this.config.selectors.caption)); 2617 (e.innerHTML = i), 2618 this.elements.captions.appendChild(e), 2619 Z.call(this, this.media, "cuechange"); 2620 } 2621 }, 2622 }, 2623 Le = { 2624 enabled: !0, 2625 title: "", 2626 debug: !1, 2627 autoplay: !1, 2628 autopause: !0, 2629 playsinline: !0, 2630 seekTime: 10, 2631 volume: 1, 2632 muted: !1, 2633 duration: null, 2634 displayDuration: !0, 2635 invertTime: !0, 2636 toggleInvert: !0, 2637 ratio: null, 2638 clickToPlay: !0, 2639 hideControls: !0, 2640 resetOnEnd: !1, 2641 disableContextMenu: !0, 2642 loadSprite: !0, 2643 iconPrefix: "plyr", 2644 iconUrl: "https://cdn.plyr.io/3.7.8/plyr.svg", 2645 blankVideo: "https://cdn.plyr.io/static/blank.mp4", 2646 quality: { 2647 default: 576, 2648 options: [ 2649 4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240, 2650 ], 2651 forced: !1, 2652 onChange: null, 2653 }, 2654 loop: { active: !1 }, 2655 speed: { 2656 selected: 1, 2657 options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4], 2658 }, 2659 keyboard: { focused: !0, global: !1 }, 2660 tooltips: { controls: !1, seek: !0 }, 2661 captions: { active: !1, language: "auto", update: !1 }, 2662 fullscreen: { enabled: !0, fallback: !0, iosNative: !1 }, 2663 storage: { enabled: !0, key: "plyr" }, 2664 controls: [ 2665 "play-large", 2666 "play", 2667 "progress", 2668 "current-time", 2669 "mute", 2670 "volume", 2671 "captions", 2672 "settings", 2673 "pip", 2674 "airplay", 2675 "fullscreen", 2676 ], 2677 settings: ["captions", "quality", "speed"], 2678 i18n: { 2679 restart: "Restart", 2680 rewind: "Rewind {seektime}s", 2681 play: "Play", 2682 pause: "Pause", 2683 fastForward: "Forward {seektime}s", 2684 seek: "Seek", 2685 seekLabel: "{currentTime} of {duration}", 2686 played: "Played", 2687 buffered: "Buffered", 2688 currentTime: "Current time", 2689 duration: "Duration", 2690 volume: "Volume", 2691 mute: "Mute", 2692 unmute: "Unmute", 2693 enableCaptions: "Enable captions", 2694 disableCaptions: "Disable captions", 2695 download: "Download", 2696 enterFullscreen: "Enter fullscreen", 2697 exitFullscreen: "Exit fullscreen", 2698 frameTitle: "Player for {title}", 2699 captions: "Captions", 2700 settings: "Settings", 2701 pip: "PIP", 2702 menuBack: "Go back to previous menu", 2703 speed: "Speed", 2704 normal: "Normal", 2705 quality: "Quality", 2706 loop: "Loop", 2707 start: "Start", 2708 end: "End", 2709 all: "All", 2710 reset: "Reset", 2711 disabled: "Disabled", 2712 enabled: "Enabled", 2713 advertisement: "Ad", 2714 qualityBadge: { 2715 2160: "4K", 2716 1440: "HD", 2717 1080: "HD", 2718 720: "HD", 2719 576: "SD", 2720 480: "SD", 2721 }, 2722 }, 2723 urls: { 2724 download: null, 2725 vimeo: { 2726 sdk: "https://player.vimeo.com/api/player.js", 2727 iframe: "https://player.vimeo.com/video/{0}?{1}", 2728 api: "https://vimeo.com/api/oembed.json?url={0}", 2729 }, 2730 youtube: { 2731 sdk: "https://www.youtube.com/iframe_api", 2732 api: "https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}", 2733 }, 2734 googleIMA: { 2735 sdk: "https://imasdk.googleapis.com/js/sdkloader/ima3.js", 2736 }, 2737 }, 2738 listeners: { 2739 seek: null, 2740 play: null, 2741 pause: null, 2742 restart: null, 2743 rewind: null, 2744 fastForward: null, 2745 mute: null, 2746 volume: null, 2747 captions: null, 2748 download: null, 2749 fullscreen: null, 2750 pip: null, 2751 airplay: null, 2752 speed: null, 2753 quality: null, 2754 loop: null, 2755 language: null, 2756 }, 2757 events: [ 2758 "ended", 2759 "progress", 2760 "stalled", 2761 "playing", 2762 "waiting", 2763 "canplay", 2764 "canplaythrough", 2765 "loadstart", 2766 "loadeddata", 2767 "loadedmetadata", 2768 "timeupdate", 2769 "volumechange", 2770 "play", 2771 "pause", 2772 "error", 2773 "seeking", 2774 "seeked", 2775 "emptied", 2776 "ratechange", 2777 "cuechange", 2778 "download", 2779 "enterfullscreen", 2780 "exitfullscreen", 2781 "captionsenabled", 2782 "captionsdisabled", 2783 "languagechange", 2784 "controlshidden", 2785 "controlsshown", 2786 "ready", 2787 "statechange", 2788 "qualitychange", 2789 "adsloaded", 2790 "adscontentpause", 2791 "adscontentresume", 2792 "adstarted", 2793 "adsmidpoint", 2794 "adscomplete", 2795 "adsallcomplete", 2796 "adsimpression", 2797 "adsclick", 2798 ], 2799 selectors: { 2800 editable: "input, textarea, select, [contenteditable]", 2801 container: ".plyr", 2802 controls: { container: null, wrapper: ".plyr__controls" }, 2803 labels: "[data-plyr]", 2804 buttons: { 2805 play: '[data-plyr="play"]', 2806 pause: '[data-plyr="pause"]', 2807 restart: '[data-plyr="restart"]', 2808 rewind: '[data-plyr="rewind"]', 2809 fastForward: '[data-plyr="fast-forward"]', 2810 mute: '[data-plyr="mute"]', 2811 captions: '[data-plyr="captions"]', 2812 download: '[data-plyr="download"]', 2813 fullscreen: '[data-plyr="fullscreen"]', 2814 pip: '[data-plyr="pip"]', 2815 airplay: '[data-plyr="airplay"]', 2816 settings: '[data-plyr="settings"]', 2817 loop: '[data-plyr="loop"]', 2818 }, 2819 inputs: { 2820 seek: '[data-plyr="seek"]', 2821 volume: '[data-plyr="volume"]', 2822 speed: '[data-plyr="speed"]', 2823 language: '[data-plyr="language"]',
2824 quality: '[data-plyr="quality"]', 2825 }, 2826 display: { 2827 currentTime: ".plyr__time--current", 2828 duration: ".plyr__time--duration", 2829 buffer: ".plyr__progress__buffer", 2830 loop: ".plyr__progress__loop", 2831 volume: ".plyr__volume--display", 2832 }, 2833 progress: ".plyr__progress", 2834 captions: ".plyr__captions", 2835 caption: ".plyr__caption", 2836 }, 2837 classNames: { 2838 type: "plyr--{0}", 2839 provider: "plyr--{0}", 2840 video: "plyr__video-wrapper", 2841 embed: "plyr__video-embed", 2842 videoFixedRatio: "plyr__video-wrapper--fixed-ratio", 2843 embedContainer: "plyr__video-embed__container", 2844 poster: "plyr__poster", 2845 posterEnabled: "plyr__poster-enabled", 2846 ads: "plyr__ads", 2847 control: "plyr__control", 2848 controlPressed: "plyr__control--pressed", 2849 playing: "plyr--playing", 2850 paused: "plyr--paused", 2851 stopped: "plyr--stopped", 2852 loading: "plyr--loading", 2853 hover: "plyr--hover", 2854 tooltip: "plyr__tooltip", 2855 cues: "plyr__cues", 2856 marker: "plyr__progress__marker", 2857 hidden: "plyr__sr-only", 2858 hideControls: "plyr--hide-controls", 2859 isTouch: "plyr--is-touch", 2860 uiSupported: "plyr--full-ui", 2861 noTransition: "plyr--no-transition", 2862 display: { time: "plyr__time" }, 2863 menu: { 2864 value: "plyr__menu__value", 2865 badge: "plyr__badge", 2866 open: "plyr--menu-open", 2867 }, 2868 captions: { 2869 enabled: "plyr--captions-enabled", 2870 active: "plyr--captions-active", 2871 }, 2872 fullscreen: { 2873 enabled: "plyr--fullscreen-enabled", 2874 fallback: "plyr--fullscreen-fallback", 2875 }, 2876 pip: { 2877 supported: "plyr--pip-supported", 2878 active: "plyr--pip-active", 2879 }, 2880 airplay: { 2881 supported: "plyr--airplay-supported", 2882 active: "plyr--airplay-active", 2883 }, 2884 previewThumbnails: { 2885 thumbContainer: "plyr__preview-thumb", 2886 thumbContainerShown: "plyr__preview-thumb--is-shown", 2887 imageContainer: "plyr__preview-thumb__image-container", 2888 timeContainer: "plyr__preview-thumb__time-container", 2889 scrubbingContainer: "plyr__preview-scrubbing", 2890 scrubbingContainerShown: 2891 "plyr__preview-scrubbing--is-shown", 2892 }, 2893 }, 2894 attributes: { 2895 embed: { 2896 provider: "data-plyr-provider", 2897 id: "data-plyr-embed-id", 2898 hash: "data-plyr-embed-hash", 2899 }, 2900 }, 2901 ads: { enabled: !1, publisherId: "", tagUrl: "" }, 2902 previewThumbnails: { enabled: !1, src: "" }, 2903 vimeo: { 2904 byline: !1, 2905 portrait: !1, 2906 title: !1, 2907 speed: !0, 2908 transparent: !1, 2909 customControls: !0, 2910 referrerPolicy: null, 2911 premium: !1, 2912 }, 2913 youtube: { 2914 rel: 0, 2915 showinfo: 0, 2916 iv_load_policy: 3, 2917 modestbranding: 1, 2918 customControls: !0, 2919 noCookie: !1, 2920 }, 2921 mediaMetadata: { 2922 title: "", 2923 artist: "", 2924 album: "", 2925 artwork: [], 2926 }, 2927 markers: { enabled: !1, points: [] }, 2928 }, 2929 Ie = "picture-in-picture", 2930 $e = "inline", 2931 _e = { html5: "html5", youtube: "youtube", vimeo: "vimeo" }, 2932 Oe = "audio", 2933 je = "video"; 2934 const qe = () => {}; 2935 class De { 2936 constructor(e = !1) { 2937 (this.enabled = window.console && e), 2938 this.enabled && this.log("Debugging enabled"); 2939 } 2940 get log() { 2941 return this.enabled 2942 ? Function.prototype.bind.call(console.log, console) 2943 : qe; 2944 } 2945 get warn() { 2946 return this.enabled 2947 ? Function.prototype.bind.call(console.warn, console) 2948 : qe; 2949 } 2950 get error() { 2951 return this.enabled 2952 ? Function.prototype.bind.call(console.error, console) 2953 : qe; 2954 } 2955 } 2956 class He { 2957 constructor(t) { 2958 e(this, "onChange", () => { 2959 if (!this.supported) return; 2960 const e = this.player.elements.buttons.fullscreen; 2961 S.element(e) && (e.pressed = this.active); 2962 const t = 2963 this.target === this.player.media 2964 ? this.target 2965 : this.player.elements.container; 2966 Z.call( 2967 this.player, 2968 t, 2969 this.active ? "enterfullscreen" : "exitfullscreen", 2970 !0 2971 ); 2972 }), 2973 e(this, "toggleFallback", (e = !1) => { 2974 if ( 2975 (e 2976 ? (this.scrollPosition = { 2977 x: window.scrollX ?? 0, 2978 y: window.scrollY ?? 0, 2979 }) 2980 : window.scrollTo( 2981 this.scrollPosition.x, 2982 this.scrollPosition.y 2983 ), 2984 (document.body.style.overflow = e ? "hidden" : ""), 2985 R( 2986 this.target, 2987 this.player.config.classNames.fullscreen 2988 .fallback, 2989 e 2990 ), 2991 M.isIos) 2992 ) { 2993 let t = document.head.querySelector( 2994 'meta[name="viewport"]' 2995 ); 2996 const i = "viewport-fit=cover"; 2997 t || 2998 ((t = document.createElement("meta")), 2999 t.setAttribute("name", "viewport")); 3000 const s = 3001 S.string(t.content) && t.content.includes(i); 3002 e 3003 ? ((this.cleanupViewport = !s), 3004 s || (t.content += `,${i}`)) 3005 : this.cleanupViewport && 3006 (t.content = t.content 3007 .split(",") 3008 .filter((e) => e.trim() !== i) 3009 .join(",")); 3010 } 3011 this.onChange(); 3012 }), 3013 e(this, "trapFocus", (e) => { 3014 if ( 3015 M.isIos || 3016 M.isIPadOS || 3017 !this.active || 3018 "Tab" !== e.key 3019 ) 3020 return; 3021 const t = document.activeElement, 3022 i = U.call( 3023 this.player, 3024 "a[href], button:not(:disabled), input:not(:disabled), [tabindex]" 3025 ), 3026 [s] = i, 3027 n = i[i.length - 1]; 3028 t !== n || e.shiftKey 3029 ? t === s && 3030 e.shiftKey && 3031 (n.focus(), e.preventDefault()) 3032 : (s.focus(), e.preventDefault()); 3033 }), 3034 e(this, "update", () => { 3035 if (this.supported) { 3036 let e; 3037 (e = this.forceFallback 3038 ? "Fallback (forced)" 3039 : He.nativeSupported 3040 ? "Native" 3041 : "Fallback"), 3042 this.player.debug.log( 3043 `${e} fullscreen enabled` 3044 ); 3045 } else 3046 this.player.debug.log( 3047 "Fullscreen not supported and fallback disabled" 3048 ); 3049 R( 3050 this.player.elements.container, 3051 this.player.config.classNames.fullscreen.enabled, 3052 this.supported 3053 ); 3054 }), 3055 e(this, "enter", () => { 3056 this.supported && 3057 (M.isIos && this.player.config.fullscreen.iosNative 3058 ? this.player.isVimeo 3059 ? this.player.embed.requestFullscreen() 3060 : this.target.webkitEnterFullscreen() 3061 : !He.nativeSupported || this.forceFallback 3062 ? this.toggleFallback(!0) 3063 : this.prefix 3064 ? S.empty(this.prefix) || 3065 this.target[ 3066 `${this.prefix}Request${this.property}` 3067 ]() 3068 : this.target.requestFullscreen({ 3069 navigationUI: "hide", 3070 })); 3071 }), 3072 e(this, "exit", () => { 3073 if (this.supported) 3074 if ( 3075 M.isIos && 3076 this.player.config.fullscreen.iosNative 3077 ) 3078 this.player.isVimeo 3079 ? this.player.embed.exitFullscreen() 3080 : this.target.webkitEnterFullscreen(), 3081 ie(this.player.play()); 3082 else if (!He.nativeSupported || this.forceFallback) 3083 this.toggleFallback(!1); 3084 else if (this.prefix) { 3085 if (!S.empty(this.prefix)) { 3086 const e = 3087 "moz" === this.prefix 3088 ? "Cancel" 3089 : "Exit"; 3090 document[ 3091 `${this.prefix}${e}${this.property}` 3092 ](); 3093 } 3094 } else 3095 ( 3096 document.cancelFullScreen || 3097 document.exitFullscreen
3098 ).call(document); 3099 }), 3100 e(this, "toggle", () => { 3101 this.active ? this.exit() : this.enter(); 3102 }), 3103 (this.player = t), 3104 (this.prefix = He.prefix), 3105 (this.property = He.property), 3106 (this.scrollPosition = { x: 0, y: 0 }), 3107 (this.forceFallback = 3108 "force" === t.config.fullscreen.fallback), 3109 (this.player.elements.fullscreen = 3110 t.config.fullscreen.container && 3111 (function (e, t) { 3112 const { prototype: i } = Element; 3113 return ( 3114 i.closest || 3115 function () { 3116 let e = this; 3117 do { 3118 if (V.matches(e, t)) return e; 3119 e = e.parentElement || e.parentNode; 3120 } while (null !== e && 1 === e.nodeType); 3121 return null; 3122 } 3123 ).call(e, t); 3124 })( 3125 this.player.elements.container, 3126 t.config.fullscreen.container 3127 )), 3128 X.call( 3129 this.player, 3130 document, 3131 "ms" === this.prefix 3132 ? "MSFullscreenChange" 3133 : `${this.prefix}fullscreenchange`, 3134 () => { 3135 this.onChange(); 3136 } 3137 ), 3138 X.call( 3139 this.player, 3140 this.player.elements.container, 3141 "dblclick", 3142 (e) => { 3143 (S.element(this.player.elements.controls) && 3144 this.player.elements.controls.contains( 3145 e.target 3146 )) || 3147 this.player.listeners.proxy( 3148 e, 3149 this.toggle, 3150 "fullscreen" 3151 ); 3152 } 3153 ), 3154 X.call( 3155 this, 3156 this.player.elements.container, 3157 "keydown", 3158 (e) => this.trapFocus(e) 3159 ), 3160 this.update(); 3161 } 3162 static get nativeSupported() { 3163 return !!( 3164 document.fullscreenEnabled || 3165 document.webkitFullscreenEnabled || 3166 document.mozFullScreenEnabled || 3167 document.msFullscreenEnabled 3168 ); 3169 } 3170 get useNative() { 3171 return He.nativeSupported && !this.forceFallback; 3172 } 3173 static get prefix() { 3174 if (S.function(document.exitFullscreen)) return ""; 3175 let e = ""; 3176 return ( 3177 ["webkit", "moz", "ms"].some( 3178 (t) => 3179 !( 3180 !S.function(document[`${t}ExitFullscreen`]) && 3181 !S.function(document[`${t}CancelFullScreen`]) 3182 ) && ((e = t), !0) 3183 ), 3184 e 3185 ); 3186 } 3187 static get property() { 3188 return "moz" === this.prefix ? "FullScreen" : "Fullscreen"; 3189 } 3190 get supported() { 3191 return [ 3192 this.player.config.fullscreen.enabled, 3193 this.player.isVideo, 3194 He.nativeSupported || 3195 this.player.config.fullscreen.fallback, 3196 !this.player.isYouTube || 3197 He.nativeSupported || 3198 !M.isIos || 3199 (this.player.config.playsinline && 3200 !this.player.config.fullscreen.iosNative), 3201 ].every(Boolean); 3202 } 3203 get active() { 3204 if (!this.supported) return !1; 3205 if (!He.nativeSupported || this.forceFallback) 3206 return F( 3207 this.target, 3208 this.player.config.classNames.fullscreen.fallback 3209 ); 3210 const e = this.prefix 3211 ? this.target.getRootNode()[ 3212 `${this.prefix}${this.property}Element` 3213 ] 3214 : this.target.getRootNode().fullscreenElement; 3215 return e && e.shadowRoot 3216 ? e === this.target.getRootNode().host 3217 : e === this.target; 3218 } 3219 get target() { 3220 return M.isIos && this.player.config.fullscreen.iosNative 3221 ? this.player.media 3222 : this.player.elements.fullscreen ?? 3223 this.player.elements.container; 3224 } 3225 } 3226 function Re(e, t = 1) { 3227 return new Promise((i, s) => { 3228 const n = new Image(), 3229 a = () => { 3230 delete n.onload, 3231 delete n.onerror, 3232 (n.naturalWidth >= t ? i : s)(n); 3233 }; 3234 Object.assign(n, { onload: a, onerror: a, src: e }); 3235 }); 3236 } 3237 const Fe = { 3238 addStyleHook() { 3239 R( 3240 this.elements.container, 3241 this.config.selectors.container.replace(".", ""), 3242 !0 3243 ), 3244 R( 3245 this.elements.container, 3246 this.config.classNames.uiSupported, 3247 this.supported.ui 3248 ); 3249 }, 3250 toggleNativeControls(e = !1) { 3251 e && this.isHTML5 3252 ? this.media.setAttribute("controls", "") 3253 : this.media.removeAttribute("controls"); 3254 }, 3255 build() { 3256 if ((this.listeners.media(), !this.supported.ui)) 3257 return ( 3258 this.debug.warn( 3259 `Basic support only for ${this.provider} ${this.type}` 3260 ), 3261 void Fe.toggleNativeControls.call(this, !0) 3262 );
3263 S.element(this.elements.controls) || 3264 (Pe.inject.call(this), this.listeners.controls()), 3265 Fe.toggleNativeControls.call(this), 3266 this.isHTML5 && xe.setup.call(this), 3267 (this.volume = null), 3268 (this.muted = null), 3269 (this.loop = null), 3270 (this.quality = null), 3271 (this.speed = null), 3272 Pe.updateVolume.call(this), 3273 Pe.timeUpdate.call(this), 3274 Pe.durationUpdate.call(this), 3275 Fe.checkPlaying.call(this), 3276 R( 3277 this.elements.container, 3278 this.config.classNames.pip.supported, 3279 K.pip && this.isHTML5 && this.isVideo 3280 ), 3281 R( 3282 this.elements.container, 3283 this.config.classNames.airplay.supported, 3284 K.airplay && this.isHTML5 3285 ), 3286 R( 3287 this.elements.container, 3288 this.config.classNames.isTouch, 3289 this.touch 3290 ), 3291 (this.ready = !0), 3292 setTimeout(() => { 3293 Z.call(this, this.media, "ready"); 3294 }, 0), 3295 Fe.setTitle.call(this), 3296 this.poster && 3297 Fe.setPoster 3298 .call(this, this.poster, !1) 3299 .catch(() => {}), 3300 this.config.duration && Pe.durationUpdate.call(this), 3301 this.config.mediaMetadata && Pe.setMediaMetadata.call(this); 3302 }, 3303 setTitle() { 3304 let e = ve.get("play", this.config); 3305 if ( 3306 (S.string(this.config.title) && 3307 !S.empty(this.config.title) && 3308 (e += `, ${this.config.title}`), 3309 Array.from(this.elements.buttons.play || []).forEach( 3310 (t) => { 3311 t.setAttribute("aria-label", e); 3312 } 3313 ), 3314 this.isEmbed) 3315 ) { 3316 const e = B.call(this, "iframe"); 3317 if (!S.element(e)) return; 3318 const t = S.empty(this.config.title) 3319 ? "video" 3320 : this.config.title, 3321 i = ve.get("frameTitle", this.config); 3322 e.setAttribute("title", i.replace("{title}", t)); 3323 } 3324 }, 3325 togglePoster(e) { 3326 R( 3327 this.elements.container, 3328 this.config.classNames.posterEnabled, 3329 e 3330 ); 3331 }, 3332 setPoster(e, t = !0) { 3333 return t && this.poster 3334 ? Promise.reject(new Error("Poster already set")) 3335 : (this.media.setAttribute("data-poster", e), 3336 this.elements.poster.removeAttribute("hidden"), 3337 te 3338 .call(this) 3339 .then(() => Re(e)) 3340 .catch((t) => { 3341 throw ( 3342 (e === this.poster && 3343 Fe.togglePoster.call(this, !1), 3344 t) 3345 ); 3346 }) 3347 .then(() => { 3348 if (e !== this.poster) 3349 throw new Error( 3350 "setPoster cancelled by later call to setPoster" 3351 ); 3352 }) 3353 .then( 3354 () => ( 3355 Object.assign(this.elements.poster.style, { 3356 backgroundImage: `url('${e}')`, 3357 backgroundSize: "", 3358 }), 3359 Fe.togglePoster.call(this, !0), 3360 e 3361 ) 3362 )); 3363 }, 3364 checkPlaying(e) { 3365 R( 3366 this.elements.container, 3367 this.config.classNames.playing, 3368 this.playing 3369 ), 3370 R( 3371 this.elements.container, 3372 this.config.classNames.paused, 3373 this.paused 3374 ), 3375 R( 3376 this.elements.container, 3377 this.config.classNames.stopped, 3378 this.stopped 3379 ), 3380 Array.from(this.elements.buttons.play || []).forEach( 3381 (e) => { 3382 Object.assign(e, { pressed: this.playing }), 3383 e.setAttribute( 3384 "aria-label", 3385 ve.get( 3386 this.playing ? "pause" : "play", 3387 this.config 3388 ) 3389 ); 3390 } 3391 ), 3392 (S.event(e) && "timeupdate" === e.type) || 3393 Fe.toggleControls.call(this); 3394 }, 3395 checkLoading(e) { 3396 (this.loading = ["stalled", "waiting"].includes(e.type)), 3397 clearTimeout(this.timers.loading), 3398 (this.timers.loading = setTimeout( 3399 () => { 3400 R( 3401 this.elements.container, 3402 this.config.classNames.loading, 3403 this.loading 3404 ), 3405 Fe.toggleControls.call(this); 3406 }, 3407 this.loading ? 250 : 0 3408 )); 3409 }, 3410 toggleControls(e) { 3411 const { controls: t } = this.elements; 3412 if (t && this.config.hideControls) { 3413 const i = 3414 this.touch && this.lastSeekTime + 2e3 > Date.now(); 3415 this.toggleControls( 3416 Boolean( 3417 e || 3418 this.loading || 3419 this.paused || 3420 t.pressed || 3421 t.hover || 3422 i 3423 ) 3424 ); 3425 } 3426 }, 3427 migrateStyles() { 3428 Object.values({ ...this.media.style }) 3429 .filter( 3430 (e) => 3431 !S.empty(e) && S.string(e) && e.startsWith("--plyr") 3432 ) 3433 .forEach((e) => { 3434 this.elements.container.style.setProperty( 3435 e, 3436 this.media.style.getPropertyValue(e) 3437 ), 3438 this.media.style.removeProperty(e); 3439 }), 3440 S.empty(this.media.style) && 3441 this.media.removeAttribute("style"); 3442 }, 3443 }; 3444 class Ve {
3445 constructor(t) { 3446 e(this, "firstTouch", () => { 3447 const { player: e } = this, 3448 { elements: t } = e; 3449 (e.touch = !0), 3450 R(t.container, e.config.classNames.isTouch, !0); 3451 }), 3452 e(this, "global", (e = !0) => { 3453 const { player: t } = this; 3454 t.config.keyboard.global && 3455 Q.call( 3456 t, 3457 window, 3458 "keydown keyup", 3459 this.handleKey, 3460 e, 3461 !1 3462 ), 3463 Q.call( 3464 t, 3465 document.body, 3466 "click", 3467 this.toggleMenu, 3468 e 3469 ), 3470 G.call( 3471 t, 3472 document.body, 3473 "touchstart", 3474 this.firstTouch 3475 ); 3476 }), 3477 e(this, "container", () => { 3478 const { player: e } = this, 3479 { config: t, elements: i, timers: s } = e; 3480 !t.keyboard.global && 3481 t.keyboard.focused && 3482 X.call( 3483 e, 3484 i.container, 3485 "keydown keyup", 3486 this.handleKey, 3487 !1 3488 ), 3489 X.call( 3490 e, 3491 i.container, 3492 "mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen", 3493 (t) => { 3494 const { controls: n } = i; 3495 n && 3496 "enterfullscreen" === t.type && 3497 ((n.pressed = !1), (n.hover = !1)); 3498 let a = 0; 3499 [ 3500 "touchstart", 3501 "touchmove", 3502 "mousemove", 3503 ].includes(t.type) && 3504 (Fe.toggleControls.call(e, !0), 3505 (a = e.touch ? 3e3 : 2e3)), 3506 clearTimeout(s.controls), 3507 (s.controls = setTimeout( 3508 () => Fe.toggleControls.call(e, !1), 3509 a 3510 )); 3511 } 3512 ); 3513 const n = () => { 3514 if (!e.isVimeo || e.config.vimeo.premium) 3515 return; 3516 const t = i.wrapper, 3517 { active: s } = e.fullscreen, 3518 [n, a] = ce.call(e), 3519 l = ae(`aspect-ratio: ${n} / ${a}`); 3520 if (!s) 3521 return void (l 3522 ? ((t.style.width = null),
3523 (t.style.height = null)) 3524 : ((t.style.maxWidth = null), 3525 (t.style.margin = null))); 3526 const [r, o] = [ 3527 Math.max( 3528 document.documentElement 3529 .clientWidth || 0, 3530 window.innerWidth || 0 3531 ), 3532 Math.max( 3533 document.documentElement 3534 .clientHeight || 0, 3535 window.innerHeight || 0 3536 ), 3537 ], 3538 c = r / o > n / a; 3539 l 3540 ? ((t.style.width = c ? "auto" : "100%"), 3541 (t.style.height = c ? "100%" : "auto")) 3542 : ((t.style.maxWidth = c 3543 ? (o / a) * n + "px" 3544 : null), 3545 (t.style.margin = c ? "0 auto" : null)); 3546 }, 3547 a = () => { 3548 clearTimeout(s.resized), 3549 (s.resized = setTimeout(n, 50)); 3550 }; 3551 X.call( 3552 e, 3553 i.container, 3554 "enterfullscreen exitfullscreen", 3555 (t) => { 3556 const { target: s } = e.fullscreen; 3557 if (s !== i.container) return; 3558 if (!e.isEmbed && S.empty(e.config.ratio)) 3559 return; 3560 n(); 3561 ("enterfullscreen" === t.type ? X : J).call( 3562 e, 3563 window, 3564 "resize", 3565 a 3566 ); 3567 } 3568 ); 3569 }), 3570 e(this, "media", () => { 3571 const { player: e } = this, 3572 { elements: t } = e; 3573 if ( 3574 (X.call( 3575 e, 3576 e.media, 3577 "timeupdate seeking seeked", 3578 (t) => Pe.timeUpdate.call(e, t) 3579 ), 3580 X.call( 3581 e, 3582 e.media, 3583 "durationchange loadeddata loadedmetadata", 3584 (t) => Pe.durationUpdate.call(e, t) 3585 ), 3586 X.call(e, e.media, "ended", () => { 3587 e.isHTML5 && 3588 e.isVideo && 3589 e.config.resetOnEnd && 3590 (e.restart(), e.pause()); 3591 }), 3592 X.call( 3593 e, 3594 e.media, 3595 "progress playing seeking seeked", 3596 (t) => Pe.updateProgress.call(e, t) 3597 ), 3598 X.call(e, e.media, "volumechange", (t) => 3599 Pe.updateVolume.call(e, t) 3600 ), 3601 X.call( 3602 e, 3603 e.media, 3604 "playing play pause ended emptied timeupdate", 3605 (t) => Fe.checkPlaying.call(e, t) 3606 ), 3607 X.call( 3608 e, 3609 e.media, 3610 "waiting canplay seeked playing", 3611 (t) => Fe.checkLoading.call(e, t) 3612 ), 3613 e.supported.ui && 3614 e.config.clickToPlay && 3615 !e.isAudio) 3616 ) { 3617 const i = B.call( 3618 e, 3619 `.${e.config.classNames.video}` 3620 ); 3621 if (!S.element(i)) return; 3622 X.call(e, t.container, "click", (s) => { 3623 ([t.container, i].includes(s.target) || 3624 i.contains(s.target)) && 3625 ((e.touch && e.config.hideControls) || 3626 (e.ended 3627 ? (this.proxy( 3628 s, 3629 e.restart, 3630 "restart" 3631 ), 3632 this.proxy( 3633 s, 3634 () => { 3635 ie(e.play()); 3636 }, 3637 "play" 3638 )) 3639 : this.proxy( 3640 s, 3641 () => { 3642 ie(e.togglePlay()); 3643 }, 3644 "play" 3645 ))); 3646 }); 3647 } 3648 e.supported.ui && 3649 e.config.disableContextMenu && 3650 X.call( 3651 e, 3652 t.wrapper, 3653 "contextmenu", 3654 (e) => { 3655 e.preventDefault(); 3656 }, 3657 !1 3658 ), 3659 X.call(e, e.media, "volumechange", () => { 3660 e.storage.set({ 3661 volume: e.volume, 3662 muted: e.muted, 3663 }); 3664 }), 3665 X.call(e, e.media, "ratechange", () => { 3666 Pe.updateSetting.call(e, "speed"), 3667 e.storage.set({ speed: e.speed }); 3668 }), 3669 X.call(e, e.media, "qualitychange", (t) => { 3670 Pe.updateSetting.call( 3671 e, 3672 "quality", 3673 null, 3674 t.detail.quality 3675 ); 3676 }), 3677 X.call(e, e.media, "ready qualitychange", () => { 3678 Pe.setDownloadUrl.call(e); 3679 }); 3680 const i = e.config.events 3681 .concat(["keyup", "keydown"]) 3682 .join(" "); 3683 X.call(e, e.media, i, (i) => { 3684 let { detail: s = {} } = i; 3685 "error" === i.type && (s = e.media.error), 3686 Z.call(e, t.container, i.type, !0, s); 3687 }); 3688 }), 3689 e(this, "proxy", (e, t, i) => { 3690 const { player: s } = this, 3691 n = s.config.listeners[i]; 3692 let a = !0; 3693 S.function(n) && (a = n.call(s, e)), 3694 !1 !== a && S.function(t) && t.call(s, e); 3695 }), 3696 e(this, "bind", (e, t, i, s, n = !0) => { 3697 const { player: a } = this, 3698 l = a.config.listeners[s], 3699 r = S.function(l); 3700 X.call(a, e, t, (e) => this.proxy(e, i, s), n && !r); 3701 }), 3702 e(this, "controls", () => { 3703 const { player: e } = this, 3704 { elements: t } = e, 3705 i = M.isIE ? "change" : "input"; 3706 if ( 3707 (t.buttons.play &&
3708 Array.from(t.buttons.play).forEach((t) => { 3709 this.bind( 3710 t, 3711 "click", 3712 () => { 3713 ie(e.togglePlay()); 3714 }, 3715 "play" 3716 ); 3717 }), 3718 this.bind( 3719 t.buttons.restart, 3720 "click", 3721 e.restart, 3722 "restart" 3723 ), 3724 this.bind( 3725 t.buttons.rewind, 3726 "click", 3727 () => { 3728 (e.lastSeekTime = Date.now()), e.rewind(); 3729 }, 3730 "rewind" 3731 ), 3732 this.bind( 3733 t.buttons.fastForward, 3734 "click", 3735 () => { 3736 (e.lastSeekTime = Date.now()), e.forward(); 3737 }, 3738 "fastForward" 3739 ), 3740 this.bind( 3741 t.buttons.mute, 3742 "click", 3743 () => { 3744 e.muted = !e.muted; 3745 }, 3746 "mute" 3747 ), 3748 this.bind(t.buttons.captions, "click", () => 3749 e.toggleCaptions() 3750 ), 3751 this.bind( 3752 t.buttons.download, 3753 "click", 3754 () => { 3755 Z.call(e, e.media, "download"); 3756 }, 3757 "download" 3758 ), 3759 this.bind( 3760 t.buttons.fullscreen, 3761 "click", 3762 () => { 3763 e.fullscreen.toggle(); 3764 }, 3765 "fullscreen" 3766 ), 3767 this.bind( 3768 t.buttons.pip, 3769 "click", 3770 () => { 3771 e.pip = "toggle"; 3772 }, 3773 "pip" 3774 ), 3775 this.bind( 3776 t.buttons.airplay, 3777 "click", 3778 e.airplay, 3779 "airplay" 3780 ), 3781 this.bind( 3782 t.buttons.settings, 3783 "click", 3784 (t) => { 3785 t.stopPropagation(), 3786 t.preventDefault(), 3787 Pe.toggleMenu.call(e, t); 3788 }, 3789 null, 3790 !1 3791 ), 3792 this.bind( 3793 t.buttons.settings, 3794 "keyup", 3795 (t) => { 3796 [" ", "Enter"].includes(t.key) && 3797 ("Enter" !== t.key 3798 ? (t.preventDefault(), 3799 t.stopPropagation(), 3800 Pe.toggleMenu.call(e, t)) 3801 : Pe.focusFirstMenuItem.call( 3802 e, 3803 null, 3804 !0 3805 )); 3806 }, 3807 null, 3808 !1 3809 ), 3810 this.bind(t.settings.menu, "keydown", (t) => { 3811 "Escape" === t.key && Pe.toggleMenu.call(e, t); 3812 }), 3813 this.bind( 3814 t.inputs.seek, 3815 "mousedown mousemove", 3816 (e) => { 3817 const i = 3818 t.progress.getBoundingClientRect(), 3819 s = 3820 (100 / i.width) * 3821 (e.pageX - i.left); 3822 e.currentTarget.setAttribute( 3823 "seek-value", 3824 s 3825 ); 3826 } 3827 ), 3828 this.bind( 3829 t.inputs.seek, 3830 "mousedown mouseup keydown keyup touchstart touchend", 3831 (t) => { 3832 const i = t.currentTarget, 3833 s = "play-on-seeked"; 3834 if ( 3835 S.keyboardEvent(t) && 3836 !["ArrowLeft", "ArrowRight"].includes( 3837 t.key 3838 ) 3839 ) 3840 return; 3841 e.lastSeekTime = Date.now(); 3842 const n = i.hasAttribute(s), 3843 a = [ 3844 "mouseup", 3845 "touchend", 3846 "keyup", 3847 ].includes(t.type); 3848 n && a 3849 ? (i.removeAttribute(s), ie(e.play())) 3850 : !a && 3851 e.playing && 3852 (i.setAttribute(s, ""), e.pause()); 3853 } 3854 ), 3855 M.isIos) 3856 ) { 3857 const t = U.call(e, 'input[type="range"]'); 3858 Array.from(t).forEach((e) => 3859 this.bind(e, i, (e) => P(e.target)) 3860 ); 3861 } 3862 this.bind( 3863 t.inputs.seek, 3864 i, 3865 (t) => { 3866 const i = t.currentTarget; 3867 let s = i.getAttribute("seek-value"); 3868 S.empty(s) && (s = i.value), 3869 i.removeAttribute("seek-value"), 3870 (e.currentTime = (s / i.max) * e.duration); 3871 }, 3872 "seek" 3873 ), 3874 this.bind( 3875 t.progress, 3876 "mouseenter mouseleave mousemove", 3877 (t) => Pe.updateSeekTooltip.call(e, t) 3878 ), 3879 this.bind( 3880 t.progress, 3881 "mousemove touchmove", 3882 (t) => { 3883 const { previewThumbnails: i } = e; 3884 i && i.loaded && i.startMove(t); 3885 } 3886 ), 3887 this.bind( 3888 t.progress, 3889 "mouseleave touchend click", 3890 () => { 3891 const { previewThumbnails: t } = e; 3892 t && t.loaded && t.endMove(!1, !0); 3893 } 3894 ), 3895 this.bind( 3896 t.progress, 3897 "mousedown touchstart", 3898 (t) => { 3899 const { previewThumbnails: i } = e; 3900 i && i.loaded && i.startScrubbing(t); 3901 } 3902 ), 3903 this.bind(t.progress, "mouseup touchend", (t) => { 3904 const { previewThumbnails: i } = e; 3905 i && i.loaded && i.endScrubbing(t); 3906 }), 3907 M.isWebKit && 3908 Array.from( 3909 U.call(e, 'input[type="range"]') 3910 ).forEach((t) => { 3911 this.bind(t, "input", (t) => 3912 Pe.updateRangeFill.call(e, t.target) 3913 ); 3914 }), 3915 e.config.toggleInvert &&
3916 !S.element(t.display.duration) && 3917 this.bind( 3918 t.display.currentTime, 3919 "click", 3920 () => { 3921 0 !== e.currentTime && 3922 ((e.config.invertTime = 3923 !e.config.invertTime), 3924 Pe.timeUpdate.call(e)); 3925 } 3926 ), 3927 this.bind( 3928 t.inputs.volume, 3929 i, 3930 (t) => { 3931 e.volume = t.target.value; 3932 }, 3933 "volume" 3934 ), 3935 this.bind( 3936 t.controls, 3937 "mouseenter mouseleave", 3938 (i) => { 3939 t.controls.hover = 3940 !e.touch && "mouseenter" === i.type; 3941 } 3942 ), 3943 t.fullscreen && 3944 Array.from(t.fullscreen.children) 3945 .filter((e) => !e.contains(t.container)) 3946 .forEach((i) => { 3947 this.bind( 3948 i, 3949 "mouseenter mouseleave", 3950 (i) => { 3951 t.controls && 3952 (t.controls.hover = 3953 !e.touch && 3954 "mouseenter" === 3955 i.type); 3956 } 3957 ); 3958 }), 3959 this.bind( 3960 t.controls, 3961 "mousedown mouseup touchstart touchend touchcancel", 3962 (e) => { 3963 t.controls.pressed = [ 3964 "mousedown", 3965 "touchstart", 3966 ].includes(e.type); 3967 } 3968 ), 3969 this.bind(t.controls, "focusin", () => { 3970 const { config: i, timers: s } = e; 3971 R(t.controls, i.classNames.noTransition, !0), 3972 Fe.toggleControls.call(e, !0), 3973 setTimeout(() => { 3974 R( 3975 t.controls, 3976 i.classNames.noTransition, 3977 !1 3978 ); 3979 }, 0); 3980 const n = this.touch ? 3e3 : 4e3; 3981 clearTimeout(s.controls), 3982 (s.controls = setTimeout( 3983 () => Fe.toggleControls.call(e, !1), 3984 n 3985 )); 3986 }), 3987 this.bind( 3988 t.inputs.volume, 3989 "wheel", 3990 (t) => { 3991 const i = 3992 t.webkitDirectionInvertedFromDevice, 3993 [s, n] = [t.deltaX, -t.deltaY].map( 3994 (e) => (i ? -e : e) 3995 ), 3996 a = Math.sign( 3997 Math.abs(s) > Math.abs(n) ? s : n 3998 ); 3999 e.increaseVolume(a / 50); 4000 const { volume: l } = e.media; 4001 ((1 === a && l < 1) || 4002 (-1 === a && l > 0)) && 4003 t.preventDefault(); 4004 }, 4005 "volume", 4006 !1 4007 ); 4008 }), 4009 (this.player = t), 4010 (this.lastKey = null), 4011 (this.focusTimer = null), 4012 (this.lastKeyDown = null),
4013 (this.handleKey = this.handleKey.bind(this)), 4014 (this.toggleMenu = this.toggleMenu.bind(this)), 4015 (this.firstTouch = this.firstTouch.bind(this)); 4016 } 4017 handleKey(e) { 4018 const { player: t } = this, 4019 { elements: i } = t, 4020 { 4021 key: s, 4022 type: n, 4023 altKey: a, 4024 ctrlKey: l, 4025 metaKey: r, 4026 shiftKey: o, 4027 } = e, 4028 c = "keydown" === n, 4029 u = c && s === this.lastKey; 4030 if (a || l || r || o) return; 4031 if (!s) return; 4032 if (c) { 4033 const n = document.activeElement; 4034 if (S.element(n)) { 4035 const { editable: s } = t.config.selectors, 4036 { seek: a } = i.inputs; 4037 if (n !== a && V(n, s)) return; 4038 if (" " === e.key && V(n, 'button, [role^="menuitem"]')) 4039 return; 4040 } 4041 switch ( 4042 ([ 4043 " ", 4044 "ArrowLeft", 4045 "ArrowUp", 4046 "ArrowRight", 4047 "ArrowDown", 4048 "0", 4049 "1", 4050 "2", 4051 "3", 4052 "4", 4053 "5", 4054 "6", 4055 "7", 4056 "8", 4057 "9", 4058 "c", 4059 "f", 4060 "k", 4061 "l", 4062 "m", 4063 ].includes(s) && 4064 (e.preventDefault(), e.stopPropagation()), 4065 s) 4066 ) { 4067 case "0": 4068 case "1": 4069 case "2": 4070 case "3": 4071 case "4": 4072 case "5": 4073 case "6": 4074 case "7": 4075 case "8": 4076 case "9": 4077 u || 4078 ((h = parseInt(s, 10)), 4079 (t.currentTime = (t.duration / 10) * h)); 4080 break; 4081 case " ": 4082 case "k": 4083 u || ie(t.togglePlay()); 4084 break; 4085 case "ArrowUp": 4086 t.increaseVolume(0.1); 4087 break; 4088 case "ArrowDown": 4089 t.decreaseVolume(0.1); 4090 break; 4091 case "m": 4092 u || (t.muted = !t.muted); 4093 break; 4094 case "ArrowRight": 4095 t.forward(); 4096 break; 4097 case "ArrowLeft": 4098 t.rewind(); 4099 break; 4100 case "f": 4101 t.fullscreen.toggle(); 4102 break; 4103 case "c": 4104 u || t.toggleCaptions(); 4105 break; 4106 case "l": 4107 t.loop = !t.loop; 4108 } 4109 "Escape" === s && 4110 !t.fullscreen.usingNative && 4111 t.fullscreen.active && 4112 t.fullscreen.toggle(), 4113 (this.lastKey = s); 4114 } else this.lastKey = null; 4115 var h; 4116 } 4117 toggleMenu(e) { 4118 Pe.toggleMenu.call(this.player, e); 4119 } 4120 } 4121 "undefined" != typeof globalThis 4122 ? globalThis 4123 : "undefined" != typeof window 4124 ? window 4125 : "undefined" != typeof global 4126 ? global 4127 : "undefined" != typeof self && self; 4128 var Ue = (function (e, t) { 4129 return e((t = { exports: {} }), t.exports), t.exports; 4130 })(function (e, t) { 4131 e.exports = (function () { 4132 var e = function () {}, 4133 t = {}, 4134 i = {}, 4135 s = {}; 4136 function n(e, t) { 4137 e = e.push ? e : [e]; 4138 var n, 4139 a, 4140 l, 4141 r = [], 4142 o = e.length, 4143 c = o; 4144 for ( 4145 n = function (e, i) { 4146 i.length && r.push(e), --c || t(r); 4147 }; 4148 o--; 4149 4150 ) 4151 (a = e[o]), 4152 (l = i[a]) ? n(a, l) : (s[a] = s[a] || []).push(n); 4153 } 4154 function a(e, t) { 4155 if (e) { 4156 var n = s[e]; 4157 if (((i[e] = t), n)) 4158 for (; n.length; ) n[0](e, t), n.splice(0, 1); 4159 } 4160 } 4161 function l(t, i) { 4162 t.call && (t = { success: t }), 4163 i.length ? (t.error || e)(i) : (t.success || e)(t); 4164 } 4165 function r(t, i, s, n) { 4166 var a, 4167 l, 4168 o = document, 4169 c = s.async, 4170 u = (s.numRetries || 0) + 1, 4171 h = s.before || e, 4172 d = t.replace(/[\?|#].*$/, ""), 4173 m = t.replace(/^(css|img)!/, ""); 4174 (n = n || 0), 4175 /(^css!|\.css$)/.test(d) 4176 ? (((l = o.createElement("link")).rel = 4177 "stylesheet"), 4178 (l.href = m), 4179 (a = "hideFocus" in l) && 4180 l.relList && 4181 ((a = 0), 4182 (l.rel = "preload"), 4183 (l.as = "style"))) 4184 : /(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d) 4185 ? ((l = o.createElement("img")).src = m) 4186 : (((l = o.createElement("script")).src = t), 4187 (l.async = void 0 === c || c)), 4188 (l.onload = 4189 l.onerror = 4190 l.onbeforeload = 4191 function (e) { 4192 var o = e.type[0]; 4193 if (a) 4194 try { 4195 l.sheet.cssText.length || (o = "e"); 4196 } catch (e) { 4197 18 != e.code && (o = "e"); 4198 } 4199 if ("e" == o) { 4200 if ((n += 1) < u) return r(t, i, s, n); 4201 } else if ( 4202 "preload" == l.rel && 4203 "style" == l.as 4204 ) 4205 return (l.rel = "stylesheet"); 4206 i(t, o, e.defaultPrevented); 4207 }), 4208 !1 !== h(t, l) && o.head.appendChild(l); 4209 } 4210 function o(e, t, i) { 4211 var s, 4212 n, 4213 a = (e = e.push ? e : [e]).length, 4214 l = a, 4215 o = []; 4216 for ( 4217 s = function (e, i, s) { 4218 if (("e" == i && o.push(e), "b" == i)) { 4219 if (!s) return; 4220 o.push(e); 4221 } 4222 --a || t(o); 4223 }, 4224 n = 0; 4225 n < l; 4226 n++ 4227 ) 4228 r(e[n], s, i); 4229 } 4230 function c(e, i, s) { 4231 var n, r; 4232 if ((i && i.trim && (n = i), (r = (n ? s : i) || {}), n)) { 4233 if (n in t) throw "LoadJS"; 4234 t[n] = !0; 4235 } 4236 function c(t, i) { 4237 o( 4238 e, 4239 function (e) { 4240 l(r, e), 4241 t && l({ success: t, error: i }, e), 4242 a(n, e); 4243 }, 4244 r 4245 ); 4246 } 4247 if (r.returnPromise) return new Promise(c); 4248 c(); 4249 } 4250 return ( 4251 (c.ready = function (e, t) { 4252 return ( 4253 n(e, function (e) { 4254 l(t, e); 4255 }), 4256 c 4257 ); 4258 }), 4259 (c.done = function (e) { 4260 a(e, []); 4261 }), 4262 (c.reset = function () { 4263 (t = {}), (i = {}), (s = {}); 4264 }), 4265 (c.isDefined = function (e) { 4266 return e in t; 4267 }), 4268 c 4269 ); 4270 })(); 4271 }); 4272 function Be(e) { 4273 return new Promise((t, i) => { 4274 Ue(e, { success: t, error: i }); 4275 }); 4276 } 4277 function We(e) { 4278 e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), 4279 this.media.paused === e && 4280 ((this.media.paused = !e), 4281 Z.call(this, this.media, e ? "play" : "pause")); 4282 } 4283 const ze = { 4284 setup() { 4285 const e = this; 4286 R(e.elements.wrapper, e.config.classNames.embed, !0), 4287 (e.options.speed = e.config.speed.options), 4288 ue.call(e), 4289 S.object(window.Vimeo) 4290 ? ze.ready.call(e) 4291 : Be(e.config.urls.vimeo.sdk) 4292 .then(() => { 4293 ze.ready.call(e); 4294 }) 4295 .catch((t) => { 4296 e.debug.warn( 4297 "Vimeo SDK (player.js) failed to load", 4298 t 4299 ); 4300 }); 4301 }, 4302 ready() { 4303 const e = this, 4304 t = e.config.vimeo, 4305 { premium: i, referrerPolicy: s, ...n } = t; 4306 let a = e.media.getAttribute("src"), 4307 l = ""; 4308 S.empty(a) 4309 ? ((a = e.media.getAttribute(e.config.attributes.embed.id)), 4310 (l = e.media.getAttribute( 4311 e.config.attributes.embed.hash 4312 ))) 4313 : (l = (function (e) { 4314 const t = e.match( 4315 /^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/ 4316 ); 4317 return t && 5 === t.length ? t[4] : null; 4318 })(a)); 4319 const r = l ? { h: l } : {}; 4320 i && Object.assign(n, { controls: !1, sidedock: !1 }); 4321 const o = Ne({ 4322 loop: e.config.loop.active, 4323 autoplay: e.autoplay, 4324 muted: e.muted, 4325 gesture: "media", 4326 playsinline: e.config.playsinline, 4327 ...r, 4328 ...n, 4329 }), 4330 c = 4331 ((u = a), 4332 S.empty(u) 4333 ? null 4334 : S.number(Number(u)) 4335 ? u 4336 : u.match(/^.*(vimeo.com\/|video\/)(\d+).*/) 4337 ? RegExp.$2 4338 : u); 4339 var u; 4340 const h = $("iframe"), 4341 d = me(e.config.urls.vimeo.iframe, c, o); 4342 if ( 4343 (h.setAttribute("src", d), 4344 h.setAttribute("allowfullscreen", ""), 4345 h.setAttribute( 4346 "allow", 4347 [ 4348 "autoplay", 4349 "fullscreen", 4350 "picture-in-picture", 4351 "encrypted-media", 4352 "accelerometer", 4353 "gyroscope", 4354 ].join("; ") 4355 ), 4356 S.empty(s) || h.setAttribute("referrerPolicy", s), 4357 i || !t.customControls) 4358 ) 4359 h.setAttribute("data-poster", e.poster), 4360 (e.media = q(h, e.media)); 4361 else { 4362 const t = $("div", { 4363 class: e.config.classNames.embedContainer, 4364 "data-poster": e.poster, 4365 }); 4366 t.appendChild(h), (e.media = q(t, e.media)); 4367 } 4368 t.customControls || 4369 Te(me(e.config.urls.vimeo.api, d)).then((t) => { 4370 !S.empty(t) && 4371 t.thumbnail_url && 4372 Fe.setPoster 4373 .call(e, t.thumbnail_url) 4374 .catch(() => {}); 4375 }), 4376 (e.embed = new window.Vimeo.Player(h, {
4377 autopause: e.config.autopause, 4378 muted: e.muted, 4379 })), 4380 (e.media.paused = !0), 4381 (e.media.currentTime = 0), 4382 e.supported.ui && e.embed.disableTextTrack(), 4383 (e.media.play = () => (We.call(e, !0), e.embed.play())), 4384 (e.media.pause = () => (We.call(e, !1), e.embed.pause())), 4385 (e.media.stop = () => { 4386 e.pause(), (e.currentTime = 0); 4387 }); 4388 let { currentTime: m } = e.media; 4389 Object.defineProperty(e.media, "currentTime", { 4390 get: () => m, 4391 set(t) { 4392 const { embed: i, media: s, paused: n, volume: a } = e, 4393 l = n && !i.hasPlayed; 4394 (s.seeking = !0), 4395 Z.call(e, s, "seeking"), 4396 Promise.resolve(l && i.setVolume(0)) 4397 .then(() => i.setCurrentTime(t)) 4398 .then(() => l && i.pause()) 4399 .then(() => l && i.setVolume(a)) 4400 .catch(() => {}); 4401 }, 4402 }); 4403 let p = e.config.speed.selected; 4404 Object.defineProperty(e.media, "playbackRate", { 4405 get: () => p, 4406 set(t) { 4407 e.embed 4408 .setPlaybackRate(t) 4409 .then(() => { 4410 (p = t), Z.call(e, e.media, "ratechange"); 4411 }) 4412 .catch(() => { 4413 e.options.speed = [1]; 4414 }); 4415 }, 4416 }); 4417 let { volume: g } = e.config; 4418 Object.defineProperty(e.media, "volume", { 4419 get: () => g, 4420 set(t) { 4421 e.embed.setVolume(t).then(() => { 4422 (g = t), Z.call(e, e.media, "volumechange"); 4423 }); 4424 }, 4425 }); 4426 let { muted: f } = e.config; 4427 Object.defineProperty(e.media, "muted", { 4428 get: () => f, 4429 set(t) { 4430 const i = !!S.boolean(t) && t; 4431 e.embed.setMuted(!!i || e.config.muted).then(() => { 4432 (f = i), Z.call(e, e.media, "volumechange"); 4433 }); 4434 }, 4435 }); 4436 let y, 4437 { loop: b } = e.config; 4438 Object.defineProperty(e.media, "loop", { 4439 get: () => b, 4440 set(t) { 4441 const i = S.boolean(t) ? t : e.config.loop.active; 4442 e.embed.setLoop(i).then(() => { 4443 b = i; 4444 }); 4445 }, 4446 }), 4447 e.embed 4448 .getVideoUrl() 4449 .then((t) => { 4450 (y = t), Pe.setDownloadUrl.call(e); 4451 }) 4452 .catch((e) => { 4453 this.debug.warn(e); 4454 }), 4455 Object.defineProperty(e.media, "currentSrc", { 4456 get: () => y, 4457 }), 4458 Object.defineProperty(e.media, "ended", { 4459 get: () => e.currentTime === e.duration, 4460 }), 4461 Promise.all([ 4462 e.embed.getVideoWidth(), 4463 e.embed.getVideoHeight(), 4464 ]).then((t) => { 4465 const [i, s] = t; 4466 (e.embed.ratio = he(i, s)), ue.call(this); 4467 }), 4468 e.embed.setAutopause(e.config.autopause).then((t) => { 4469 e.config.autopause = t; 4470 }), 4471 e.embed.getVideoTitle().then((t) => { 4472 (e.config.title = t), Fe.setTitle.call(this); 4473 }), 4474 e.embed.getCurrentTime().then((t) => { 4475 (m = t), Z.call(e, e.media, "timeupdate"); 4476 }), 4477 e.embed.getDuration().then((t) => { 4478 (e.media.duration = t), 4479 Z.call(e, e.media, "durationchange"); 4480 }), 4481 e.embed.getTextTracks().then((t) => { 4482 (e.media.textTracks = t), xe.setup.call(e); 4483 }), 4484 e.embed.on("cuechange", ({ cues: t = [] }) => { 4485 const i = t.map((e) => 4486 (function (e) { 4487 const t = document.createDocumentFragment(), 4488 i = document.createElement("div"); 4489 return ( 4490 t.appendChild(i), 4491 (i.innerHTML = e), 4492 t.firstChild.innerText 4493 ); 4494 })(e.text) 4495 ); 4496 xe.updateCues.call(e, i); 4497 }), 4498 e.embed.on("loaded", () => { 4499 if ( 4500 (e.embed.getPaused().then((t) => { 4501 We.call(e, !t), 4502 t || Z.call(e, e.media, "playing"); 4503 }), 4504 S.element(e.embed.element) && e.supported.ui) 4505 ) { 4506 e.embed.element.setAttribute("tabindex", -1); 4507 } 4508 }), 4509 e.embed.on("bufferstart", () => { 4510 Z.call(e, e.media, "waiting"); 4511 }), 4512 e.embed.on("bufferend", () => { 4513 Z.call(e, e.media, "playing"); 4514 }), 4515 e.embed.on("play", () => { 4516 We.call(e, !0), Z.call(e, e.media, "playing"); 4517 }), 4518 e.embed.on("pause", () => { 4519 We.call(e, !1); 4520 }), 4521 e.embed.on("timeupdate", (t) => { 4522 (e.media.seeking = !1), 4523 (m = t.seconds), 4524 Z.call(e, e.media, "timeupdate"); 4525 }), 4526 e.embed.on("progress", (t) => { 4527 (e.media.buffered = t.percent), 4528 Z.call(e, e.media, "progress"), 4529 1 === parseInt(t.percent, 10) && 4530 Z.call(e, e.media, "canplaythrough"), 4531 e.embed.getDuration().then((t) => { 4532 t !== e.media.duration && 4533 ((e.media.duration = t), 4534 Z.call(e, e.media, "durationchange")); 4535 }); 4536 }), 4537 e.embed.on("seeked", () => { 4538 (e.media.seeking = !1), Z.call(e, e.media, "seeked"); 4539 }), 4540 e.embed.on("ended", () => { 4541 (e.media.paused = !0), Z.call(e, e.media, "ended"); 4542 }), 4543 e.embed.on("error", (t) => { 4544 (e.media.error = t), Z.call(e, e.media, "error"); 4545 }), 4546 t.customControls && setTimeout(() => Fe.build.call(e), 0); 4547 }, 4548 }; 4549 function Ke(e) { 4550 e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), 4551 this.media.paused === e && 4552 ((this.media.paused = !e), 4553 Z.call(this, this.media, e ? "play" : "pause")); 4554 } 4555 function Ye(e) { 4556 return e.noCookie 4557 ? "https://www.youtube-nocookie.com" 4558 : "http:" === window.location.protocol 4559 ? "http://www.youtube.com" 4560 : void 0; 4561 } 4562 const Qe = { 4563 setup() { 4564 if ( 4565 (R( 4566 this.elements.wrapper, 4567 this.config.classNames.embed, 4568 !0 4569 ), 4570 S.object(window.YT) && S.function(window.YT.Player)) 4571 ) 4572 Qe.ready.call(this); 4573 else { 4574 const e = window.onYouTubeIframeAPIReady; 4575 (window.onYouTubeIframeAPIReady = () => { 4576 S.function(e) && e(), Qe.ready.call(this); 4577 }), 4578 Be(this.config.urls.youtube.sdk).catch((e) => { 4579 this.debug.warn( 4580 "YouTube API failed to load", 4581 e 4582 ); 4583 }); 4584 } 4585 }, 4586 getTitle(e) { 4587 Te(me(this.config.urls.youtube.api, e)) 4588 .then((e) => { 4589 if (S.object(e)) { 4590 const { title: t, height: i, width: s } = e; 4591 (this.config.title = t), 4592 Fe.setTitle.call(this), 4593 (this.embed.ratio = he(s, i)); 4594 } 4595 ue.call(this); 4596 }) 4597 .catch(() => { 4598 ue.call(this); 4599 }); 4600 }, 4601 ready() { 4602 const e = this, 4603 t = e.config.youtube, 4604 i = e.media && e.media.getAttribute("id"); 4605 if (!S.empty(i) && i.startsWith("youtube-")) return; 4606 let s = e.media.getAttribute("src"); 4607 S.empty(s) && 4608 (s = e.media.getAttribute( 4609 this.config.attributes.embed.id 4610 )); 4611 const n = 4612 ((a = s), 4613 S.empty(a) 4614 ? null 4615 : a.match( 4616 /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/ 4617 ) 4618 ? RegExp.$2 4619 : a); 4620 var a; 4621 const l = $("div", { 4622 id: `${e.provider}-${Math.floor(1e4 * Math.random())}`, 4623 "data-poster": t.customControls ? e.poster : void 0, 4624 }); 4625 if (((e.media = q(l, e.media)), t.customControls)) { 4626 const t = (e) => 4627 `https://i.ytimg.com/vi/${n}/${e}default.jpg`; 4628 Re(t("maxres"), 121) 4629 .catch(() => Re(t("sd"), 121)) 4630 .catch(() => Re(t("hq"))) 4631 .then((t) => Fe.setPoster.call(e, t.src)) 4632 .then((t) => { 4633 t.includes("maxres") || 4634 (e.elements.poster.style.backgroundSize = 4635 "cover"); 4636 }) 4637 .catch(() => {}); 4638 } 4639 e.embed = new window.YT.Player(e.media, { 4640 videoId: n, 4641 host: Ye(t), 4642 playerVars: x( 4643 {}, 4644 {
4645 autoplay: e.config.autoplay ? 1 : 0, 4646 hl: e.config.hl, 4647 controls: 4648 e.supported.ui && t.customControls ? 0 : 1, 4649 disablekb: 1, 4650 playsinline: 4651 e.config.playsinline && 4652 !e.config.fullscreen.iosNative 4653 ? 1 4654 : 0, 4655 cc_load_policy: e.captions.active ? 1 : 0, 4656 cc_lang_pref: e.config.captions.language, 4657 widget_referrer: window 4658 ? window.location.href 4659 : null, 4660 }, 4661 t 4662 ), 4663 events: { 4664 onError(t) { 4665 if (!e.media.error) { 4666 const i = t.data, 4667 s = 4668 { 4669 2: "The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.", 4670 5: "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.", 4671 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.", 4672 101: "The owner of the requested video does not allow it to be played in embedded players.", 4673 150: "The owner of the requested video does not allow it to be played in embedded players.", 4674 }[i] || "An unknown error occurred"; 4675 (e.media.error = { code: i, message: s }), 4676 Z.call(e, e.media, "error"); 4677 } 4678 }, 4679 onPlaybackRateChange(t) { 4680 const i = t.target; 4681 (e.media.playbackRate = i.getPlaybackRate()), 4682 Z.call(e, e.media, "ratechange"); 4683 }, 4684 onReady(i) { 4685 if (S.function(e.media.play)) return; 4686 const s = i.target; 4687 Qe.getTitle.call(e, n), 4688 (e.media.play = () => { 4689 Ke.call(e, !0), s.playVideo(); 4690 }), 4691 (e.media.pause = () => { 4692 Ke.call(e, !1), s.pauseVideo(); 4693 }), 4694 (e.media.stop = () => { 4695 s.stopVideo(); 4696 }), 4697 (e.media.duration = s.getDuration()), 4698 (e.media.paused = !0), 4699 (e.media.currentTime = 0), 4700 Object.defineProperty( 4701 e.media, 4702 "currentTime", 4703 { 4704 get: () => 4705 Number(s.getCurrentTime()), 4706 set(t) { 4707 e.paused && 4708 !e.embed.hasPlayed && 4709 e.embed.mute(), 4710 (e.media.seeking = !0), 4711 Z.call( 4712 e, 4713 e.media, 4714 "seeking" 4715 ), 4716 s.seekTo(t); 4717 }, 4718 } 4719 ), 4720 Object.defineProperty( 4721 e.media, 4722 "playbackRate", 4723 { 4724 get: () => s.getPlaybackRate(), 4725 set(e) { 4726 s.setPlaybackRate(e); 4727 }, 4728 } 4729 ); 4730 let { volume: a } = e.config; 4731 Object.defineProperty(e.media, "volume", { 4732 get: () => a, 4733 set(t) { 4734 (a = t), 4735 s.setVolume(100 * a), 4736 Z.call(e, e.media, "volumechange"); 4737 }, 4738 }); 4739 let { muted: l } = e.config; 4740 Object.defineProperty(e.media, "muted", { 4741 get: () => l, 4742 set(t) { 4743 const i = S.boolean(t) ? t : l; 4744 (l = i), 4745 s[i ? "mute" : "unMute"](), 4746 s.setVolume(100 * a), 4747 Z.call(e, e.media, "volumechange"); 4748 }, 4749 }), 4750 Object.defineProperty( 4751 e.media, 4752 "currentSrc", 4753 { get: () => s.getVideoUrl() } 4754 ), 4755 Object.defineProperty(e.media, "ended", { 4756 get: () => e.currentTime === e.duration, 4757 }); 4758 const r = s.getAvailablePlaybackRates(); 4759 (e.options.speed = r.filter((t) => 4760 e.config.speed.options.includes(t) 4761 )), 4762 e.supported.ui && 4763 t.customControls && 4764 e.media.setAttribute("tabindex", -1), 4765 Z.call(e, e.media, "timeupdate"), 4766 Z.call(e, e.media, "durationchange"), 4767 clearInterval(e.timers.buffering), 4768 (e.timers.buffering = setInterval(() => { 4769 (e.media.buffered = 4770 s.getVideoLoadedFraction()), 4771 (null === e.media.lastBuffered || 4772 e.media.lastBuffered < 4773 e.media.buffered) && 4774 Z.call(e, e.media, "progress"), 4775 (e.media.lastBuffered = 4776 e.media.buffered), 4777 1 === e.media.buffered && 4778 (clearInterval( 4779 e.timers.buffering 4780 ), 4781 Z.call( 4782 e, 4783 e.media, 4784 "canplaythrough" 4785 )); 4786 }, 200)), 4787 t.customControls && 4788 setTimeout(() => Fe.build.call(e), 50); 4789 }, 4790 onStateChange(i) { 4791 const s = i.target; 4792 clearInterval(e.timers.playing); 4793 switch ( 4794 (e.media.seeking && 4795 [1, 2].includes(i.data) && 4796 ((e.media.seeking = !1), 4797 Z.call(e, e.media, "seeked")), 4798 i.data) 4799 ) { 4800 case -1: 4801 Z.call(e, e.media, "timeupdate"), 4802 (e.media.buffered = 4803 s.getVideoLoadedFraction()), 4804 Z.call(e, e.media, "progress"); 4805 break; 4806 case 0: 4807 Ke.call(e, !1), 4808 e.media.loop 4809 ? (s.stopVideo(), s.playVideo()) 4810 : Z.call(e, e.media, "ended"); 4811 break; 4812 case 1: 4813 t.customControls &&
4814 !e.config.autoplay && 4815 e.media.paused && 4816 !e.embed.hasPlayed 4817 ? e.media.pause() 4818 : (Ke.call(e, !0), 4819 Z.call(e, e.media, "playing"), 4820 (e.timers.playing = setInterval( 4821 () => { 4822 Z.call( 4823 e, 4824 e.media, 4825 "timeupdate" 4826 ); 4827 }, 4828 50 4829 )), 4830 e.media.duration !== 4831 s.getDuration() && 4832 ((e.media.duration = 4833 s.getDuration()), 4834 Z.call( 4835 e, 4836 e.media, 4837 "durationchange" 4838 ))); 4839 break; 4840 case 2: 4841 e.muted || e.embed.unMute(), 4842 Ke.call(e, !1); 4843 break; 4844 case 3: 4845 Z.call(e, e.media, "waiting"); 4846 } 4847 Z.call( 4848 e, 4849 e.elements.container, 4850 "statechange", 4851 !1, 4852 { code: i.data } 4853 ); 4854 }, 4855 }, 4856 }); 4857 }, 4858 }, 4859 Xe = { 4860 setup() { 4861 this.media 4862 ? (R( 4863 this.elements.container, 4864 this.config.classNames.type.replace( 4865 "{0}", 4866 this.type 4867 ), 4868 !0 4869 ), 4870 R( 4871 this.elements.container, 4872 this.config.classNames.provider.replace( 4873 "{0}", 4874 this.provider 4875 ), 4876 !0 4877 ), 4878 this.isEmbed && 4879 R( 4880 this.elements.container, 4881 this.config.classNames.type.replace( 4882 "{0}", 4883 "video" 4884 ), 4885 !0 4886 ), 4887 this.isVideo && 4888 ((this.elements.wrapper = $("div", { 4889 class: this.config.classNames.video, 4890 })), 4891 L(this.media, this.elements.wrapper), 4892 (this.elements.poster = $("div", { 4893 class: this.config.classNames.poster, 4894 })), 4895 this.elements.wrapper.appendChild( 4896 this.elements.poster 4897 )), 4898 this.isHTML5 4899 ? de.setup.call(this) 4900 : this.isYouTube 4901 ? Qe.setup.call(this) 4902 : this.isVimeo && ze.setup.call(this)) 4903 : this.debug.warn("No media element found!"); 4904 }, 4905 }; 4906 class Je { 4907 constructor(t) { 4908 e(this, "load", () => { 4909 this.enabled && 4910 (S.object(window.google) && S.object(window.google.ima) 4911 ? this.ready() 4912 : Be(this.player.config.urls.googleIMA.sdk) 4913 .then(() => { 4914 this.ready(); 4915 }) 4916 .catch(() => { 4917 this.trigger( 4918 "error", 4919 new Error( 4920 "Google IMA SDK failed to load" 4921 ) 4922 ); 4923 })); 4924 }), 4925 e(this, "ready", () => { 4926 var e; 4927 this.enabled || 4928 ((e = this).manager && e.manager.destroy(), 4929 e.elements.displayContainer && 4930 e.elements.displayContainer.destroy(), 4931 e.elements.container.remove()), 4932 this.startSafetyTimer(12e3, "ready()"), 4933 this.managerPromise.then(() => { 4934 this.clearSafetyTimer("onAdsManagerLoaded()"); 4935 }), 4936 this.listeners(), 4937 this.setupIMA(); 4938 }), 4939 e(this, "setupIMA", () => { 4940 (this.elements.container = $("div", { 4941 class: this.player.config.classNames.ads, 4942 })), 4943 this.player.elements.container.appendChild( 4944 this.elements.container 4945 ), 4946 google.ima.settings.setVpaidMode( 4947 google.ima.ImaSdkSettings.VpaidMode.ENABLED 4948 ), 4949 google.ima.settings.setLocale( 4950 this.player.config.ads.language 4951 ), 4952 google.ima.settings.setDisableCustomPlaybackForIOS10Plus( 4953 this.player.config.playsinline 4954 ), 4955 (this.elements.displayContainer = 4956 new google.ima.AdDisplayContainer( 4957 this.elements.container, 4958 this.player.media 4959 )), 4960 (this.loader = new google.ima.AdsLoader( 4961 this.elements.displayContainer 4962 )), 4963 this.loader.addEventListener( 4964 google.ima.AdsManagerLoadedEvent.Type 4965 .ADS_MANAGER_LOADED, 4966 (e) => this.onAdsManagerLoaded(e), 4967 !1 4968 ), 4969 this.loader.addEventListener( 4970 google.ima.AdErrorEvent.Type.AD_ERROR, 4971 (e) => this.onAdError(e), 4972 !1 4973 ), 4974 this.requestAds(); 4975 }),
4976 e(this, "requestAds", () => { 4977 const { container: e } = this.player.elements; 4978 try { 4979 const t = new google.ima.AdsRequest(); 4980 (t.adTagUrl = this.tagUrl), 4981 (t.linearAdSlotWidth = e.offsetWidth), 4982 (t.linearAdSlotHeight = e.offsetHeight), 4983 (t.nonLinearAdSlotWidth = e.offsetWidth), 4984 (t.nonLinearAdSlotHeight = e.offsetHeight), 4985 (t.forceNonLinearFullSlot = !1), 4986 t.setAdWillPlayMuted(!this.player.muted), 4987 this.loader.requestAds(t); 4988 } catch (e) { 4989 this.onAdError(e); 4990 } 4991 }), 4992 e(this, "pollCountdown", (e = !1) => { 4993 if (!e) 4994 return ( 4995 clearInterval(this.countdownTimer), 4996 void this.elements.container.removeAttribute( 4997 "data-badge-text" 4998 ) 4999 ); 5000 this.countdownTimer = setInterval(() => { 5001 const e = Ee( 5002 Math.max(this.manager.getRemainingTime(), 0) 5003 ), 5004 t = `${ve.get( 5005 "advertisement", 5006 this.player.config 5007 )} - ${e}`; 5008 this.elements.container.setAttribute( 5009 "data-badge-text", 5010 t 5011 ); 5012 }, 100); 5013 }), 5014 e(this, "onAdsManagerLoaded", (e) => { 5015 if (!this.enabled) return; 5016 const t = new google.ima.AdsRenderingSettings(); 5017 (t.restoreCustomPlaybackStateOnAdBreakComplete = !0), 5018 (t.enablePreloading = !0), 5019 (this.manager = e.getAdsManager(this.player, t)), 5020 (this.cuePoints = this.manager.getCuePoints()), 5021 this.manager.addEventListener( 5022 google.ima.AdErrorEvent.Type.AD_ERROR, 5023 (e) => this.onAdError(e) 5024 ), 5025 Object.keys(google.ima.AdEvent.Type).forEach( 5026 (e) => { 5027 this.manager.addEventListener( 5028 google.ima.AdEvent.Type[e], 5029 (e) => this.onAdEvent(e) 5030 ); 5031 } 5032 ), 5033 this.trigger("loaded"); 5034 }), 5035 e(this, "addCuePoints", () => { 5036 S.empty(this.cuePoints) || 5037 this.cuePoints.forEach((e) => { 5038 if ( 5039 0 !== e && 5040 -1 !== e && 5041 e < this.player.duration 5042 ) { 5043 const t = this.player.elements.progress; 5044 if (S.element(t)) { 5045 const i = 5046 (100 / this.player.duration) * 5047 e, 5048 s = $("span", { 5049 class: this.player.config 5050 .classNames.cues, 5051 }); 5052 (s.style.left = `${i.toString()}%`), 5053 t.appendChild(s); 5054 } 5055 } 5056 }); 5057 }), 5058 e(this, "onAdEvent", (e) => { 5059 const { container: t } = this.player.elements, 5060 i = e.getAd(), 5061 s = e.getAdData(); 5062 switch ( 5063 (((e) => { 5064 Z.call( 5065 this.player, 5066 this.player.media, 5067 `ads${e.replace(/_/g, "").toLowerCase()}` 5068 ); 5069 })(e.type), 5070 e.type) 5071 ) { 5072 case google.ima.AdEvent.Type.LOADED: 5073 this.trigger("loaded"), 5074 this.pollCountdown(!0), 5075 i.isLinear() || 5076 ((i.width = t.offsetWidth), 5077 (i.height = t.offsetHeight)); 5078 break; 5079 case google.ima.AdEvent.Type.STARTED: 5080 this.manager.setVolume(this.player.volume); 5081 break; 5082 case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: 5083 this.player.ended 5084 ? this.loadAds() 5085 : this.loader.contentComplete(); 5086 break; 5087 case google.ima.AdEvent.Type 5088 .CONTENT_PAUSE_REQUESTED: 5089 this.pauseContent(); 5090 break; 5091 case google.ima.AdEvent.Type 5092 .CONTENT_RESUME_REQUESTED: 5093 this.pollCountdown(), this.resumeContent(); 5094 break; 5095 case google.ima.AdEvent.Type.LOG: 5096 s.adError && 5097 this.player.debug.warn( 5098 `Non-fatal ad error: ${s.adError.getMessage()}` 5099 ); 5100 } 5101 }), 5102 e(this, "onAdError", (e) => { 5103 this.cancel(), this.player.debug.warn("Ads error", e); 5104 }), 5105 e(this, "listeners", () => { 5106 const { container: e } = this.player.elements; 5107 let t; 5108 this.player.on("canplay", () => { 5109 this.addCuePoints(); 5110 }), 5111 this.player.on("ended", () => { 5112 this.loader.contentComplete(); 5113 }), 5114 this.player.on("timeupdate", () => { 5115 t = this.player.currentTime; 5116 }), 5117 this.player.on("seeked", () => { 5118 const e = this.player.currentTime; 5119 S.empty(this.cuePoints) ||
5120 this.cuePoints.forEach((i, s) => { 5121 t < i && 5122 i < e && 5123 (this.manager.discardAdBreak(), 5124 this.cuePoints.splice(s, 1)); 5125 }); 5126 }), 5127 window.addEventListener("resize", () => { 5128 this.manager && 5129 this.manager.resize( 5130 e.offsetWidth, 5131 e.offsetHeight, 5132 google.ima.ViewMode.NORMAL 5133 ); 5134 }); 5135 }), 5136 e(this, "play", () => { 5137 const { container: e } = this.player.elements; 5138 this.managerPromise || this.resumeContent(), 5139 this.managerPromise 5140 .then(() => { 5141 this.manager.setVolume(this.player.volume), 5142 this.elements.displayContainer.initialize(); 5143 try { 5144 this.initialized || 5145 (this.manager.init( 5146 e.offsetWidth, 5147 e.offsetHeight, 5148 google.ima.ViewMode.NORMAL 5149 ), 5150 this.manager.start()), 5151 (this.initialized = !0); 5152 } catch (e) { 5153 this.onAdError(e); 5154 } 5155 }) 5156 .catch(() => {}); 5157 }), 5158 e(this, "resumeContent", () => { 5159 (this.elements.container.style.zIndex = ""), 5160 (this.playing = !1), 5161 ie(this.player.media.play()); 5162 }), 5163 e(this, "pauseContent", () => { 5164 (this.elements.container.style.zIndex = 3), 5165 (this.playing = !0), 5166 this.player.media.pause(); 5167 }), 5168 e(this, "cancel", () => { 5169 this.initialized && this.resumeContent(), 5170 this.trigger("error"), 5171 this.loadAds(); 5172 }), 5173 e(this, "loadAds", () => { 5174 this.managerPromise 5175 .then(() => { 5176 this.manager && this.manager.destroy(), 5177 (this.managerPromise = new Promise((e) => { 5178 this.on("loaded", e), 5179 this.player.debug.log(this.manager); 5180 })), 5181 (this.initialized = !1), 5182 this.requestAds(); 5183 }) 5184 .catch(() => {}); 5185 }), 5186 e(this, "trigger", (e, ...t) => { 5187 const i = this.events[e]; 5188 S.array(i) && 5189 i.forEach((e) => { 5190 S.function(e) && e.apply(this, t); 5191 }); 5192 }), 5193 e( 5194 this, 5195 "on", 5196 (e, t) => ( 5197 S.array(this.events[e]) || (this.events[e] = []), 5198 this.events[e].push(t), 5199 this 5200 ) 5201 ), 5202 e(this, "startSafetyTimer", (e, t) => { 5203 this.player.debug.log( 5204 `Safety timer invoked from: ${t}` 5205 ), 5206 (this.safetyTimer = setTimeout(() => { 5207 this.cancel(), 5208 this.clearSafetyTimer("startSafetyTimer()"); 5209 }, e)); 5210 }), 5211 e(this, "clearSafetyTimer", (e) => { 5212 S.nullOrUndefined(this.safetyTimer) || 5213 (this.player.debug.log( 5214 `Safety timer cleared from: ${e}` 5215 ), 5216 clearTimeout(this.safetyTimer), 5217 (this.safetyTimer = null)); 5218 }), 5219 (this.player = t), 5220 (this.config = t.config.ads), 5221 (this.playing = !1), 5222 (this.initialized = !1), 5223 (this.elements = { 5224 container: null, 5225 displayContainer: null, 5226 }), 5227 (this.manager = null), 5228 (this.loader = null), 5229 (this.cuePoints = null), 5230 (this.events = {}), 5231 (this.safetyTimer = null), 5232 (this.countdownTimer = null), 5233 (this.managerPromise = new Promise((e, t) => { 5234 this.on("loaded", e), this.on("error", t); 5235 })), 5236 this.load(); 5237 } 5238 get enabled() { 5239 const { config: e } = this; 5240 return ( 5241 this.player.isHTML5 && 5242 this.player.isVideo && 5243 e.enabled && 5244 (!S.empty(e.publisherId) || S.url(e.tagUrl)) 5245 ); 5246 } 5247 get tagUrl() { 5248 const { config: e } = this; 5249 if (S.url(e.tagUrl)) return e.tagUrl; 5250 return `https://go.aniview.com/api/adserver6/vast/?${Ne({ 5251 AV_PUBLISHERID: "58c25bb0073ef448b1087ad6", 5252 AV_CHANNELID: "5a0458dc28a06145e4519d21", 5253 AV_URL: window.location.hostname, 5254 cb: Date.now(), 5255 AV_WIDTH: 640, 5256 AV_HEIGHT: 480, 5257 AV_CDIM2: e.publisherId, 5258 })}`; 5259 } 5260 } 5261 function Ge(e = 0, t = 0, i = 255) { 5262 return Math.min(Math.max(e, t), i); 5263 } 5264 const Ze = (e) => { 5265 const t = []; 5266 return (
5267 e.split(/\r\n\r\n|\n\n|\r\r/).forEach((e) => { 5268 const i = {}; 5269 e.split(/\r\n|\n|\r/).forEach((e) => { 5270 if (S.number(i.startTime)) { 5271 if (!S.empty(e.trim()) && S.empty(i.text)) { 5272 const t = e.trim().split("#xywh="); 5273 ([i.text] = t), 5274 t[1] && 5275 ([i.x, i.y, i.w, i.h] = 5276 t[1].split(",")); 5277 } 5278 } else { 5279 const t = e.match( 5280 /([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})/ 5281 ); 5282 t && 5283 ((i.startTime = 5284 60 * Number(t[1] || 0) * 60 + 5285 60 * Number(t[2]) + 5286 Number(t[3]) + 5287 Number(`0.${t[4]}`)), 5288 (i.endTime = 5289 60 * Number(t[6] || 0) * 60 + 5290 60 * Number(t[7]) + 5291 Number(t[8]) + 5292 Number(`0.${t[9]}`))); 5293 } 5294 }), 5295 i.text && t.push(i); 5296 }), 5297 t 5298 ); 5299 }, 5300 et = (e, t) => { 5301 const i = {}; 5302 return ( 5303 e > t.width / t.height 5304 ? ((i.width = t.width), (i.height = (1 / e) * t.width)) 5305 : ((i.height = t.height), (i.width = e * t.height)), 5306 i 5307 ); 5308 }; 5309 class tt { 5310 constructor(t) { 5311 e(this, "load", () => { 5312 this.player.elements.display.seekTooltip && 5313 (this.player.elements.display.seekTooltip.hidden = 5314 this.enabled), 5315 this.enabled && 5316 this.getThumbnails().then(() => { 5317 this.enabled && 5318 (this.render(), 5319 this.determineContainerAutoSizing(), 5320 this.listeners(), 5321 (this.loaded = !0)); 5322 }); 5323 }), 5324 e( 5325 this, 5326 "getThumbnails", 5327 () => 5328 new Promise((e) => { 5329 const { src: t } = 5330 this.player.config.previewThumbnails; 5331 if (S.empty(t)) 5332 throw new Error( 5333 "Missing previewThumbnails.src config attribute" 5334 ); 5335 const i = () => { 5336 this.thumbnails.sort( 5337 (e, t) => e.height - t.height 5338 ), 5339 this.player.debug.log( 5340 "Preview thumbnails", 5341 this.thumbnails 5342 ), 5343 e(); 5344 }; 5345 if (S.function(t)) 5346 t((e) => { 5347 (this.thumbnails = e), i(); 5348 }); 5349 else { 5350 const e = (S.string(t) ? [t] : t).map((e) => 5351 this.getThumbnail(e) 5352 ); 5353 Promise.all(e).then(i); 5354 } 5355 }) 5356 ), 5357 e( 5358 this, 5359 "getThumbnail", 5360 (e) => 5361 new Promise((t) => { 5362 Te(e).then((i) => { 5363 const s = { 5364 frames: Ze(i), 5365 height: null, 5366 urlPrefix: "", 5367 }; 5368 s.frames[0].text.startsWith("/") || 5369 s.frames[0].text.startsWith( 5370 "http://" 5371 ) || 5372 s.frames[0].text.startsWith( 5373 "https://" 5374 ) || 5375 (s.urlPrefix = e.substring( 5376 0, 5377 e.lastIndexOf("/") + 1 5378 )); 5379 const n = new Image(); 5380 (n.onload = () => { 5381 (s.height = n.naturalHeight), 5382 (s.width = n.naturalWidth), 5383 this.thumbnails.push(s), 5384 t(); 5385 }), 5386 (n.src = 5387 s.urlPrefix + s.frames[0].text); 5388 }); 5389 }) 5390 ), 5391 e(this, "startMove", (e) => { 5392 if ( 5393 this.loaded && 5394 S.event(e) && 5395 ["touchmove", "mousemove"].includes(e.type) && 5396 this.player.media.duration 5397 ) { 5398 if ("touchmove" === e.type) 5399 this.seekTime = 5400 this.player.media.duration * 5401 (this.player.elements.inputs.seek.value / 5402 100); 5403 else { 5404 var t, i; 5405 const s = 5406 this.player.elements.progress.getBoundingClientRect(), 5407 n = (100 / s.width) * (e.pageX - s.left); 5408 (this.seekTime = 5409 this.player.media.duration * (n / 100)), 5410 this.seekTime < 0 && (this.seekTime = 0), 5411 this.seekTime > 5412 this.player.media.duration - 1 && 5413 (this.seekTime = 5414 this.player.media.duration - 1), 5415 (this.mousePosX = e.pageX), 5416 (this.elements.thumb.time.innerText = Ee( 5417 this.seekTime 5418 )); 5419 const a = 5420 null === (t = this.player.config.markers) || 5421 void 0 === t || 5422 null === (i = t.points) || 5423 void 0 === i 5424 ? void 0 5425 : i.find( 5426 ({ time: e }) => 5427 e === 5428 Math.round(this.seekTime) 5429 ); 5430 a && 5431 this.elements.thumb.time.insertAdjacentHTML( 5432 "afterbegin", 5433 `${a.label}<br>` 5434 ); 5435 } 5436 this.showImageAtCurrentTime(); 5437 } 5438 }), 5439 e(this, "endMove", () => { 5440 this.toggleThumbContainer(!1, !0); 5441 }), 5442 e(this, "startScrubbing", (e) => { 5443 (S.nullOrUndefined(e.button) || 5444 !1 === e.button || 5445 0 === e.button) && 5446 ((this.mouseDown = !0), 5447 this.player.media.duration && 5448 (this.toggleScrubbingContainer(!0), 5449 this.toggleThumbContainer(!1, !0), 5450 this.showImageAtCurrentTime())); 5451 }), 5452 e(this, "endScrubbing", () => { 5453 (this.mouseDown = !1), 5454 Math.ceil(this.lastTime) === 5455 Math.ceil(this.player.media.currentTime) 5456 ? this.toggleScrubbingContainer(!1) 5457 : G.call( 5458 this.player, 5459 this.player.media, 5460 "timeupdate", 5461 () => { 5462 this.mouseDown || 5463 this.toggleScrubbingContainer( 5464 !1 5465 ); 5466 } 5467 ); 5468 }), 5469 e(this, "listeners", () => { 5470 this.player.on("play", () => { 5471 this.toggleThumbContainer(!1, !0); 5472 }), 5473 this.player.on("seeked", () => { 5474 this.toggleThumbContainer(!1); 5475 }), 5476 this.player.on("timeupdate", () => { 5477 this.lastTime = this.player.media.currentTime; 5478 }); 5479 }), 5480 e(this, "render", () => { 5481 (this.elements.thumb.container = $("div", { 5482 class: this.player.config.classNames 5483 .previewThumbnails.thumbContainer, 5484 })), 5485 (this.elements.thumb.imageContainer = $("div", { 5486 class: this.player.config.classNames 5487 .previewThumbnails.imageContainer, 5488 })), 5489 this.elements.thumb.container.appendChild( 5490 this.elements.thumb.imageContainer 5491 ); 5492 const e = $("div", { 5493 class: this.player.config.classNames 5494 .previewThumbnails.timeContainer, 5495 }); 5496 (this.elements.thumb.time = $("span", {}, "00:00")), 5497 e.appendChild(this.elements.thumb.time), 5498 this.elements.thumb.imageContainer.appendChild(e),
5499 S.element(this.player.elements.progress) && 5500 this.player.elements.progress.appendChild( 5501 this.elements.thumb.container 5502 ), 5503 (this.elements.scrubbing.container = $("div", { 5504 class: this.player.config.classNames 5505 .previewThumbnails.scrubbingContainer, 5506 })), 5507 this.player.elements.wrapper.appendChild( 5508 this.elements.scrubbing.container 5509 ); 5510 }), 5511 e(this, "destroy", () => { 5512 this.elements.thumb.container && 5513 this.elements.thumb.container.remove(), 5514 this.elements.scrubbing.container && 5515 this.elements.scrubbing.container.remove(); 5516 }), 5517 e(this, "showImageAtCurrentTime", () => { 5518 this.mouseDown 5519 ? this.setScrubbingContainerSize() 5520 : this.setThumbContainerSizeAndPos(); 5521 const e = this.thumbnails[0].frames.findIndex( 5522 (e) => 5523 this.seekTime >= e.startTime && 5524 this.seekTime <= e.endTime 5525 ), 5526 t = e >= 0; 5527 let i = 0; 5528 this.mouseDown || this.toggleThumbContainer(t), 5529 t && 5530 (this.thumbnails.forEach((t, s) => { 5531 this.loadedImages.includes( 5532 t.frames[e].text 5533 ) && (i = s); 5534 }), 5535 e !== this.showingThumb && 5536 ((this.showingThumb = e), 5537 this.loadImage(i))); 5538 }), 5539 e(this, "loadImage", (e = 0) => { 5540 const t = this.showingThumb, 5541 i = this.thumbnails[e], 5542 { urlPrefix: s } = i, 5543 n = i.frames[t], 5544 a = i.frames[t].text, 5545 l = s + a; 5546 if ( 5547 this.currentImageElement && 5548 this.currentImageElement.dataset.filename === a 5549 ) 5550 this.showImage( 5551 this.currentImageElement, 5552 n, 5553 e, 5554 t, 5555 a, 5556 !1 5557 ), 5558 (this.currentImageElement.dataset.index = t), 5559 this.removeOldImages(this.currentImageElement); 5560 else { 5561 this.loadingImage && 5562 this.usingSprites && 5563 (this.loadingImage.onload = null); 5564 const i = new Image(); 5565 (i.src = l), 5566 (i.dataset.index = t), 5567 (i.dataset.filename = a), 5568 (this.showingThumbFilename = a), 5569 this.player.debug.log(`Loading image: ${l}`), 5570 (i.onload = () => 5571 this.showImage(i, n, e, t, a, !0)), 5572 (this.loadingImage = i), 5573 this.removeOldImages(i); 5574 } 5575 }), 5576 e(this, "showImage", (e, t, i, s, n, a = !0) => { 5577 this.player.debug.log( 5578 `Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}` 5579 ), 5580 this.setImageSizeAndOffset(e, t), 5581 a && 5582 (this.currentImageContainer.appendChild(e), 5583 (this.currentImageElement = e), 5584 this.loadedImages.includes(n) || 5585 this.loadedImages.push(n)), 5586 this.preloadNearby(s, !0) 5587 .then(this.preloadNearby(s, !1)) 5588 .then(this.getHigherQuality(i, e, t, n)); 5589 }), 5590 e(this, "removeOldImages", (e) => { 5591 Array.from(this.currentImageContainer.children).forEach( 5592 (t) => { 5593 if ("img" !== t.tagName.toLowerCase()) return; 5594 const i = this.usingSprites ? 500 : 1e3; 5595 if ( 5596 t.dataset.index !== e.dataset.index && 5597 !t.dataset.deleting 5598 ) { 5599 t.dataset.deleting = !0; 5600 const { currentImageContainer: e } = this; 5601 setTimeout(() => { 5602 e.removeChild(t), 5603 this.player.debug.log( 5604 `Removing thumb: ${t.dataset.filename}` 5605 ); 5606 }, i); 5607 } 5608 } 5609 ); 5610 }), 5611 e( 5612 this, 5613 "preloadNearby", 5614 (e, t = !0) => 5615 new Promise((i) => { 5616 setTimeout(() => { 5617 const s = this.thumbnails[0].frames[e].text; 5618 if (this.showingThumbFilename === s) { 5619 let n; 5620 n = t 5621 ? this.thumbnails[0].frames.slice(e) 5622 : this.thumbnails[0].frames 5623 .slice(0, e) 5624 .reverse(); 5625 let a = !1;
5626 n.forEach((e) => { 5627 const t = e.text; 5628 if ( 5629 t !== s && 5630 !this.loadedImages.includes(t) 5631 ) { 5632 (a = !0), 5633 this.player.debug.log( 5634 `Preloading thumb filename: ${t}` 5635 ); 5636 const { urlPrefix: e } = 5637 this.thumbnails[0], 5638 s = e + t, 5639 n = new Image(); 5640 (n.src = s), 5641 (n.onload = () => { 5642 this.player.debug.log( 5643 `Preloaded thumb filename: ${t}` 5644 ), 5645 this.loadedImages.includes( 5646 t 5647 ) || 5648 this.loadedImages.push( 5649 t 5650 ), 5651 i(); 5652 }); 5653 } 5654 }), 5655 a || i(); 5656 } 5657 }, 300); 5658 }) 5659 ), 5660 e(this, "getHigherQuality", (e, t, i, s) => { 5661 if (e < this.thumbnails.length - 1) { 5662 let n = t.naturalHeight; 5663 this.usingSprites && (n = i.h), 5664 n < this.thumbContainerHeight && 5665 setTimeout(() => { 5666 this.showingThumbFilename === s && 5667 (this.player.debug.log( 5668 `Showing higher quality thumb for: ${s}` 5669 ), 5670 this.loadImage(e + 1)); 5671 }, 300); 5672 } 5673 }), 5674 e(this, "toggleThumbContainer", (e = !1, t = !1) => { 5675 const i = 5676 this.player.config.classNames.previewThumbnails 5677 .thumbContainerShown; 5678 this.elements.thumb.container.classList.toggle(i, e), 5679 !e && 5680 t && 5681 ((this.showingThumb = null), 5682 (this.showingThumbFilename = null)); 5683 }), 5684 e(this, "toggleScrubbingContainer", (e = !1) => { 5685 const t = 5686 this.player.config.classNames.previewThumbnails 5687 .scrubbingContainerShown; 5688 this.elements.scrubbing.container.classList.toggle( 5689 t, 5690 e 5691 ), 5692 e || 5693 ((this.showingThumb = null), 5694 (this.showingThumbFilename = null)); 5695 }), 5696 e(this, "determineContainerAutoSizing", () => { 5697 (this.elements.thumb.imageContainer.clientHeight > 20 || 5698 this.elements.thumb.imageContainer.clientWidth > 5699 20) && 5700 (this.sizeSpecifiedInCSS = !0); 5701 }), 5702 e(this, "setThumbContainerSizeAndPos", () => { 5703 const { imageContainer: e } = this.elements.thumb; 5704 if (this.sizeSpecifiedInCSS) { 5705 if (e.clientHeight > 20 && e.clientWidth < 20) { 5706 const t = Math.floor( 5707 e.clientHeight * this.thumbAspectRatio 5708 ); 5709 e.style.width = `${t}px`; 5710 } else if ( 5711 e.clientHeight < 20 && 5712 e.clientWidth > 20 5713 ) { 5714 const t = Math.floor( 5715 e.clientWidth / this.thumbAspectRatio 5716 ); 5717 e.style.height = `${t}px`; 5718 } 5719 } else { 5720 const t = Math.floor( 5721 this.thumbContainerHeight * 5722 this.thumbAspectRatio 5723 ); 5724 (e.style.height = `${this.thumbContainerHeight}px`), 5725 (e.style.width = `${t}px`); 5726 } 5727 this.setThumbContainerPos(); 5728 }), 5729 e(this, "setThumbContainerPos", () => { 5730 const e = 5731 this.player.elements.progress.getBoundingClientRect(), 5732 t = 5733 this.player.elements.container.getBoundingClientRect(), 5734 { container: i } = this.elements.thumb, 5735 s = t.left - e.left + 10, 5736 n = t.right - e.left - i.clientWidth - 10, 5737 a = this.mousePosX - e.left - i.clientWidth / 2, 5738 l = Ge(a, s, n); 5739 (i.style.left = `${l}px`), 5740 i.style.setProperty( 5741 "--preview-arrow-offset", 5742 a - l + "px" 5743 ); 5744 }), 5745 e(this, "setScrubbingContainerSize", () => { 5746 const { width: e, height: t } = et( 5747 this.thumbAspectRatio, 5748 { 5749 width: this.player.media.clientWidth, 5750 height: this.player.media.clientHeight, 5751 } 5752 ); 5753 (this.elements.scrubbing.container.style.width = `${e}px`), 5754 (this.elements.scrubbing.container.style.height = `${t}px`); 5755 }), 5756 e(this, "setImageSizeAndOffset", (e, t) => { 5757 if (!this.usingSprites) return; 5758 const i = this.thumbContainerHeight / t.h; 5759 (e.style.height = e.naturalHeight * i + "px"),
5760 (e.style.width = e.naturalWidth * i + "px"), 5761 (e.style.left = `-${t.x * i}px`), 5762 (e.style.top = `-${t.y * i}px`); 5763 }), 5764 (this.player = t), 5765 (this.thumbnails = []), 5766 (this.loaded = !1), 5767 (this.lastMouseMoveTime = Date.now()), 5768 (this.mouseDown = !1), 5769 (this.loadedImages = []), 5770 (this.elements = { thumb: {}, scrubbing: {} }), 5771 this.load(); 5772 } 5773 get enabled() { 5774 return ( 5775 this.player.isHTML5 && 5776 this.player.isVideo && 5777 this.player.config.previewThumbnails.enabled 5778 ); 5779 } 5780 get currentImageContainer() { 5781 return this.mouseDown 5782 ? this.elements.scrubbing.container 5783 : this.elements.thumb.imageContainer; 5784 } 5785 get usingSprites() { 5786 return Object.keys(this.thumbnails[0].frames[0]).includes("w"); 5787 } 5788 get thumbAspectRatio() { 5789 return this.usingSprites 5790 ? this.thumbnails[0].frames[0].w / 5791 this.thumbnails[0].frames[0].h 5792 : this.thumbnails[0].width / this.thumbnails[0].height; 5793 } 5794 get thumbContainerHeight() { 5795 if (this.mouseDown) { 5796 const { height: e } = et(this.thumbAspectRatio, { 5797 width: this.player.media.clientWidth, 5798 height: this.player.media.clientHeight, 5799 }); 5800 return e; 5801 } 5802 return this.sizeSpecifiedInCSS 5803 ? this.elements.thumb.imageContainer.clientHeight 5804 : Math.floor( 5805 this.player.media.clientWidth / 5806 this.thumbAspectRatio / 5807 4 5808 ); 5809 } 5810 get currentImageElement() { 5811 return this.mouseDown 5812 ? this.currentScrubbingImageElement 5813 : this.currentThumbnailImageElement; 5814 } 5815 set currentImageElement(e) { 5816 this.mouseDown 5817 ? (this.currentScrubbingImageElement = e) 5818 : (this.currentThumbnailImageElement = e); 5819 } 5820 } 5821 const it = { 5822 insertElements(e, t) { 5823 S.string(t) 5824 ? _(e, this.media, { src: t }) 5825 : S.array(t) && 5826 t.forEach((t) => { 5827 _(e, this.media, t); 5828 }); 5829 }, 5830 change(e) { 5831 N(e, "sources.length") 5832 ? (de.cancelRequests.call(this), 5833 this.destroy.call( 5834 this, 5835 () => { 5836 (this.options.quality = []), 5837 O(this.media), 5838 (this.media = null), 5839 S.element(this.elements.container) && 5840 this.elements.container.removeAttribute( 5841 "class" 5842 ); 5843 const { sources: t, type: i } = e, 5844 [{ provider: s = _e.html5, src: n }] = t, 5845 a = "html5" === s ? i : "div", 5846 l = "html5" === s ? {} : { src: n }; 5847 Object.assign(this, { 5848 provider: s, 5849 type: i, 5850 supported: K.check( 5851 i, 5852 s, 5853 this.config.playsinline 5854 ), 5855 media: $(a, l), 5856 }), 5857 this.elements.container.appendChild( 5858 this.media 5859 ), 5860 S.boolean(e.autoplay) && 5861 (this.config.autoplay = e.autoplay), 5862 this.isHTML5 && 5863 (this.config.crossorigin && 5864 this.media.setAttribute( 5865 "crossorigin", 5866 "" 5867 ), 5868 this.config.autoplay && 5869 this.media.setAttribute( 5870 "autoplay", 5871 "" 5872 ), 5873 S.empty(e.poster) || 5874 (this.poster = e.poster), 5875 this.config.loop.active && 5876 this.media.setAttribute("loop", ""), 5877 this.config.muted && 5878 this.media.setAttribute( 5879 "muted", 5880 "" 5881 ), 5882 this.config.playsinline && 5883 this.media.setAttribute( 5884 "playsinline", 5885 "" 5886 )), 5887 Fe.addStyleHook.call(this), 5888 this.isHTML5 && 5889 it.insertElements.call( 5890 this, 5891 "source", 5892 t 5893 ), 5894 (this.config.title = e.title), 5895 Xe.setup.call(this), 5896 this.isHTML5 && 5897 Object.keys(e).includes("tracks") && 5898 it.insertElements.call( 5899 this, 5900 "track", 5901 e.tracks 5902 ), 5903 (this.isHTML5 || 5904 (this.isEmbed && !this.supported.ui)) && 5905 Fe.build.call(this), 5906 this.isHTML5 && this.media.load(), 5907 S.empty(e.previewThumbnails) || 5908 (Object.assign( 5909 this.config.previewThumbnails, 5910 e.previewThumbnails 5911 ), 5912 this.previewThumbnails && 5913 this.previewThumbnails.loaded && 5914 (this.previewThumbnails.destroy(), 5915 (this.previewThumbnails = null)), 5916 this.config.previewThumbnails.enabled && 5917 (this.previewThumbnails = new tt( 5918 this 5919 ))), 5920 this.fullscreen.update(); 5921 }, 5922 !0 5923 )) 5924 : this.debug.warn("Invalid source format"); 5925 }, 5926 }; 5927 class st { 5928 constructor(t, i) { 5929 if ( 5930 (e(this, "play", () => 5931 S.function(this.media.play) 5932 ? (this.ads && 5933 this.ads.enabled && 5934 this.ads.managerPromise 5935 .then(() => this.ads.play()) 5936 .catch(() => ie(this.media.play())), 5937 this.media.play()) 5938 : null 5939 ), 5940 e(this, "pause", () => 5941 this.playing && S.function(this.media.pause) 5942 ? this.media.pause() 5943 : null 5944 ), 5945 e(this, "togglePlay", (e) => 5946 (S.boolean(e) ? e : !this.playing) 5947 ? this.play() 5948 : this.pause() 5949 ), 5950 e(this, "stop", () => { 5951 this.isHTML5 5952 ? (this.pause(), this.restart()) 5953 : S.function(this.media.stop) && this.media.stop(); 5954 }), 5955 e(this, "restart", () => { 5956 this.currentTime = 0; 5957 }), 5958 e(this, "rewind", (e) => { 5959 this.currentTime -= S.number(e) 5960 ? e 5961 : this.config.seekTime; 5962 }), 5963 e(this, "forward", (e) => { 5964 this.currentTime += S.number(e) 5965 ? e 5966 : this.config.seekTime; 5967 }), 5968 e(this, "increaseVolume", (e) => { 5969 const t = this.media.muted ? 0 : this.volume; 5970 this.volume = t + (S.number(e) ? e : 0); 5971 }), 5972 e(this, "decreaseVolume", (e) => { 5973 this.increaseVolume(-e); 5974 }), 5975 e(this, "airplay", () => { 5976 K.airplay && 5977 this.media.webkitShowPlaybackTargetPicker(); 5978 }), 5979 e(this, "toggleControls", (e) => { 5980 if (this.supported.ui && !this.isAudio) { 5981 const t = F( 5982 this.elements.container, 5983 this.config.classNames.hideControls 5984 ), 5985 i = void 0 === e ? void 0 : !e, 5986 s = R( 5987 this.elements.container, 5988 this.config.classNames.hideControls, 5989 i 5990 ); 5991 if ( 5992 (s && 5993 S.array(this.config.controls) && 5994 this.config.controls.includes("settings") && 5995 !S.empty(this.config.settings) && 5996 Pe.toggleMenu.call(this, !1), 5997 s !== t) 5998 ) { 5999 const e = s 6000 ? "controlshidden" 6001 : "controlsshown"; 6002 Z.call(this, this.media, e); 6003 } 6004 return !s; 6005 } 6006 return !1; 6007 }), 6008 e(this, "on", (e, t) => { 6009 X.call(this, this.elements.container, e, t); 6010 }), 6011 e(this, "once", (e, t) => { 6012 G.call(this, this.elements.container, e, t); 6013 }), 6014 e(this, "off", (e, t) => { 6015 J(this.elements.container, e, t); 6016 }), 6017 e(this, "destroy", (e, t = !1) => { 6018 if (!this.ready) return; 6019 const i = () => { 6020 (document.body.style.overflow = ""), 6021 (this.embed = null),
6022 t 6023 ? (Object.keys(this.elements).length && 6024 (O(this.elements.buttons.play), 6025 O(this.elements.captions), 6026 O(this.elements.controls), 6027 O(this.elements.wrapper), 6028 (this.elements.buttons.play = null), 6029 (this.elements.captions = null), 6030 (this.elements.controls = null), 6031 (this.elements.wrapper = null)), 6032 S.function(e) && e()) 6033 : (ee.call(this), 6034 de.cancelRequests.call(this), 6035 q( 6036 this.elements.original, 6037 this.elements.container 6038 ), 6039 Z.call( 6040 this, 6041 this.elements.original, 6042 "destroyed", 6043 !0 6044 ), 6045 S.function(e) && 6046 e.call(this.elements.original), 6047 (this.ready = !1), 6048 setTimeout(() => { 6049 (this.elements = null), 6050 (this.media = null); 6051 }, 200)); 6052 }; 6053 this.stop(), 6054 clearTimeout(this.timers.loading), 6055 clearTimeout(this.timers.controls), 6056 clearTimeout(this.timers.resized), 6057 this.isHTML5 6058 ? (Fe.toggleNativeControls.call(this, !0), i()) 6059 : this.isYouTube 6060 ? (clearInterval(this.timers.buffering), 6061 clearInterval(this.timers.playing), 6062 null !== this.embed && 6063 S.function(this.embed.destroy) && 6064 this.embed.destroy(), 6065 i()) 6066 : this.isVimeo && 6067 (null !== this.embed && 6068 this.embed.unload().then(i), 6069 setTimeout(i, 200)); 6070 }), 6071 e(this, "supports", (e) => K.mime.call(this, e)), 6072 (this.timers = {}), 6073 (this.ready = !1), 6074 (this.loading = !1), 6075 (this.failed = !1), 6076 (this.touch = K.touch), 6077 (this.media = t), 6078 S.string(this.media) && 6079 (this.media = document.querySelectorAll(this.media)), 6080 ((window.jQuery && this.media instanceof jQuery) || 6081 S.nodeList(this.media) || 6082 S.array(this.media)) && 6083 (this.media = this.media[0]), 6084 (this.config = x( 6085 {}, 6086 Le, 6087 st.defaults, 6088 i || {}, 6089 (() => { 6090 try { 6091 return JSON.parse( 6092 this.media.getAttribute("data-plyr-config") 6093 ); 6094 } catch (e) { 6095 return {}; 6096 } 6097 })() 6098 )), 6099 (this.elements = { 6100 container: null, 6101 fullscreen: null, 6102 captions: null, 6103 buttons: {}, 6104 display: {}, 6105 progress: {}, 6106 inputs: {}, 6107 settings: { 6108 popup: null, 6109 menu: null, 6110 panels: {}, 6111 buttons: {}, 6112 }, 6113 }), 6114 (this.captions = { 6115 active: null, 6116 currentTrack: -1, 6117 meta: new WeakMap(), 6118 }), 6119 (this.fullscreen = { active: !1 }), 6120 (this.options = { speed: [], quality: [] }), 6121 (this.debug = new De(this.config.debug)), 6122 this.debug.log("Config", this.config), 6123 this.debug.log("Support", K), 6124 S.nullOrUndefined(this.media) || !S.element(this.media)) 6125 ) 6126 return void this.debug.error( 6127 "Setup failed: no suitable element passed" 6128 ); 6129 if (this.media.plyr) 6130 return void this.debug.warn("Target already setup"); 6131 if (!this.config.enabled) 6132 return void this.debug.error( 6133 "Setup failed: disabled by config" 6134 ); 6135 if (!K.check().api) 6136 return void this.debug.error("Setup failed: no support"); 6137 const s = this.media.cloneNode(!0); 6138 (s.autoplay = !1), (this.elements.original = s); 6139 const n = this.media.tagName.toLowerCase(); 6140 let a = null, 6141 l = null; 6142 switch (n) { 6143 case "div": 6144 if ( 6145 ((a = this.media.querySelector("iframe")), 6146 S.element(a)) 6147 ) { 6148 if ( 6149 ((l = Me(a.getAttribute("src"))), 6150 (this.provider = (function (e) { 6151 return /^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test( 6152 e 6153 ) 6154 ? _e.youtube 6155 : /^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test( 6156 e 6157 ) 6158 ? _e.vimeo 6159 : null; 6160 })(l.toString())), 6161 (this.elements.container = this.media), 6162 (this.media = a), 6163 (this.elements.container.className = ""), 6164 l.search.length) 6165 ) { 6166 const e = ["1", "true"]; 6167 e.includes(l.searchParams.get("autoplay")) &&
6168 (this.config.autoplay = !0), 6169 e.includes(l.searchParams.get("loop")) && 6170 (this.config.loop.active = !0), 6171 this.isYouTube 6172 ? ((this.config.playsinline = 6173 e.includes( 6174 l.searchParams.get( 6175 "playsinline" 6176 ) 6177 )), 6178 (this.config.youtube.hl = 6179 l.searchParams.get("hl"))) 6180 : (this.config.playsinline = !0); 6181 } 6182 } else (this.provider = this.media.getAttribute(this.config.attributes.embed.provider)), this.media.removeAttribute(this.config.attributes.embed.provider); 6183 if ( 6184 S.empty(this.provider) || 6185 !Object.values(_e).includes(this.provider) 6186 ) 6187 return void this.debug.error( 6188 "Setup failed: Invalid provider" 6189 ); 6190 this.type = je; 6191 break; 6192 case "video": 6193 case "audio": 6194 (this.type = n), 6195 (this.provider = _e.html5), 6196 this.media.hasAttribute("crossorigin") && 6197 (this.config.crossorigin = !0), 6198 this.media.hasAttribute("autoplay") && 6199 (this.config.autoplay = !0), 6200 (this.media.hasAttribute("playsinline") || 6201 this.media.hasAttribute( 6202 "webkit-playsinline" 6203 )) && 6204 (this.config.playsinline = !0), 6205 this.media.hasAttribute("muted") && 6206 (this.config.muted = !0), 6207 this.media.hasAttribute("loop") && 6208 (this.config.loop.active = !0); 6209 break; 6210 default: 6211 return void this.debug.error( 6212 "Setup failed: unsupported type" 6213 ); 6214 } 6215 (this.supported = K.check(this.type, this.provider)), 6216 this.supported.api 6217 ? ((this.eventListeners = []), 6218 (this.listeners = new Ve(this)), 6219 (this.storage = new we(this)), 6220 (this.media.plyr = this), 6221 S.element(this.elements.container) || 6222 ((this.elements.container = $("div")), 6223 L(this.media, this.elements.container)), 6224 Fe.migrateStyles.call(this), 6225 Fe.addStyleHook.call(this), 6226 Xe.setup.call(this), 6227 this.config.debug && 6228 X.call( 6229 this, 6230 this.elements.container, 6231 this.config.events.join(" "), 6232 (e) => { 6233 this.debug.log(`event: ${e.type}`); 6234 } 6235 ), 6236 (this.fullscreen = new He(this)), 6237 (this.isHTML5 || 6238 (this.isEmbed && !this.supported.ui)) && 6239 Fe.build.call(this), 6240 this.listeners.container(), 6241 this.listeners.global(), 6242 this.config.ads.enabled && (this.ads = new Je(this)), 6243 this.isHTML5 && 6244 this.config.autoplay && 6245 this.once("canplay", () => ie(this.play())), 6246 (this.lastSeekTime = 0), 6247 this.config.previewThumbnails.enabled && 6248 (this.previewThumbnails = new tt(this))) 6249 : this.debug.error("Setup failed: no support"); 6250 } 6251 get isHTML5() { 6252 return this.provider === _e.html5; 6253 } 6254 get isEmbed() { 6255 return this.isYouTube || this.isVimeo; 6256 } 6257 get isYouTube() { 6258 return this.provider === _e.youtube; 6259 } 6260 get isVimeo() { 6261 return this.provider === _e.vimeo; 6262 } 6263 get isVideo() { 6264 return this.type === je; 6265 } 6266 get isAudio() { 6267 return this.type === Oe; 6268 } 6269 get playing() { 6270 return Boolean(this.ready && !this.paused && !this.ended); 6271 } 6272 get paused() { 6273 return Boolean(this.media.paused); 6274 } 6275 get stopped() { 6276 return Boolean(this.paused && 0 === this.currentTime); 6277 } 6278 get ended() { 6279 return Boolean(this.media.ended); 6280 } 6281 set currentTime(e) { 6282 if (!this.duration) return; 6283 const t = S.number(e) && e > 0; 6284 (this.media.currentTime = t ? Math.min(e, this.duration) : 0), 6285 this.debug.log(`Seeking to ${this.currentTime} seconds`); 6286 } 6287 get currentTime() { 6288 return Number(this.media.currentTime); 6289 } 6290 get buffered() { 6291 const { buffered: e } = this.media; 6292 return S.number(e) 6293 ? e 6294 : e && e.length && this.duration > 0 6295 ? e.end(0) / this.duration 6296 : 0; 6297 } 6298 get seeking() { 6299 return Boolean(this.media.seeking); 6300 } 6301 get duration() { 6302 const e = parseFloat(this.config.duration), 6303 t = (this.media || {}).duration, 6304 i = S.number(t) && t !== 1 / 0 ? t : 0; 6305 return e || i; 6306 } 6307 set volume(e) { 6308 let t = e; 6309 S.string(t) && (t = Number(t)), 6310 S.number(t) || (t = this.storage.get("volume")), 6311 S.number(t) || ({ volume: t } = this.config), 6312 t > 1 && (t = 1), 6313 t < 0 && (t = 0), 6314 (this.config.volume = t), 6315 (this.media.volume = t), 6316 !S.empty(e) && this.muted && t > 0 && (this.muted = !1); 6317 } 6318 get volume() { 6319 return Number(this.media.volume); 6320 } 6321 set muted(e) { 6322 let t = e; 6323 S.boolean(t) || (t = this.storage.get("muted")), 6324 S.boolean(t) || (t = this.config.muted), 6325 (this.config.muted = t), 6326 (this.media.muted = t); 6327 } 6328 get muted() { 6329 return Boolean(this.media.muted); 6330 } 6331 get hasAudio() { 6332 return ( 6333 !this.isHTML5 || 6334 !!this.isAudio || 6335 Boolean(this.media.mozHasAudio) || 6336 Boolean(this.media.webkitAudioDecodedByteCount) || 6337 Boolean( 6338 this.media.audioTracks && this.media.audioTracks.length 6339 ) 6340 ); 6341 } 6342 set speed(e) { 6343 let t = null; 6344 S.number(e) && (t = e), 6345 S.number(t) || (t = this.storage.get("speed")), 6346 S.number(t) || (t = this.config.speed.selected); 6347 const { minimumSpeed: i, maximumSpeed: s } = this; 6348 (t = Ge(t, i, s)), 6349 (this.config.speed.selected = t), 6350 setTimeout(() => { 6351 this.media && (this.media.playbackRate = t); 6352 }, 0); 6353 } 6354 get speed() { 6355 return Number(this.media.playbackRate); 6356 } 6357 get minimumSpeed() { 6358 return this.isYouTube 6359 ? Math.min(...this.options.speed) 6360 : this.isVimeo 6361 ? 0.5 6362 : 0.0625; 6363 } 6364 get maximumSpeed() { 6365 return this.isYouTube 6366 ? Math.max(...this.options.speed) 6367 : this.isVimeo 6368 ? 2 6369 : 16; 6370 } 6371 set quality(e) { 6372 const t = this.config.quality, 6373 i = this.options.quality; 6374 if (!i.length) return; 6375 let s = [ 6376 !S.empty(e) && Number(e), 6377 this.storage.get("quality"), 6378 t.selected, 6379 t.default, 6380 ].find(S.number), 6381 n = !0; 6382 if (!i.includes(s)) { 6383 const e = ne(i, s); 6384 this.debug.warn( 6385 `Unsupported quality option: ${s}, using ${e} instead` 6386 ), 6387 (s = e), 6388 (n = !1); 6389 } 6390 (t.selected = s), 6391 (this.media.quality = s), 6392 n && this.storage.set({ quality: s }); 6393 }
6394 get quality() { 6395 return this.media.quality; 6396 } 6397 set loop(e) { 6398 const t = S.boolean(e) ? e : this.config.loop.active; 6399 (this.config.loop.active = t), (this.media.loop = t); 6400 } 6401 get loop() { 6402 return Boolean(this.media.loop); 6403 } 6404 set source(e) { 6405 it.change.call(this, e); 6406 } 6407 get source() { 6408 return this.media.currentSrc; 6409 } 6410 get download() { 6411 const { download: e } = this.config.urls; 6412 return S.url(e) ? e : this.source; 6413 } 6414 set download(e) { 6415 S.url(e) && 6416 ((this.config.urls.download = e), 6417 Pe.setDownloadUrl.call(this)); 6418 } 6419 set poster(e) { 6420 this.isVideo 6421 ? Fe.setPoster.call(this, e, !1).catch(() => {}) 6422 : this.debug.warn("Poster can only be set for video"); 6423 } 6424 get poster() { 6425 return this.isVideo 6426 ? this.media.getAttribute("poster") || 6427 this.media.getAttribute("data-poster") 6428 : null; 6429 } 6430 get ratio() { 6431 if (!this.isVideo) return null; 6432 const e = oe(ce.call(this)); 6433 return S.array(e) ? e.join(":") : e; 6434 } 6435 set ratio(e) { 6436 this.isVideo 6437 ? S.string(e) && re(e) 6438 ? ((this.config.ratio = oe(e)), ue.call(this)) 6439 : this.debug.error( 6440 `Invalid aspect ratio specified (${e})` 6441 ) 6442 : this.debug.warn("Aspect ratio can only be set for video"); 6443 } 6444 set autoplay(e) { 6445 this.config.autoplay = S.boolean(e) ? e : this.config.autoplay; 6446 } 6447 get autoplay() { 6448 return Boolean(this.config.autoplay); 6449 } 6450 toggleCaptions(e) { 6451 xe.toggle.call(this, e, !1); 6452 } 6453 set currentTrack(e) { 6454 xe.set.call(this, e, !1), xe.setup.call(this); 6455 } 6456 get currentTrack() { 6457 const { toggled: e, currentTrack: t } = this.captions; 6458 return e ? t : -1; 6459 } 6460 set language(e) { 6461 xe.setLanguage.call(this, e, !1); 6462 } 6463 get language() { 6464 return (xe.getCurrentTrack.call(this) || {}).language; 6465 } 6466 set pip(e) { 6467 if (!K.pip) return; 6468 const t = S.boolean(e) ? e : !this.pip; 6469 S.function(this.media.webkitSetPresentationMode) && 6470 this.media.webkitSetPresentationMode(t ? Ie : $e), 6471 S.function(this.media.requestPictureInPicture) && 6472 (!this.pip && t 6473 ? this.media.requestPictureInPicture() 6474 : this.pip && 6475 !t && 6476 document.exitPictureInPicture()); 6477 } 6478 get pip() { 6479 return K.pip 6480 ? S.empty(this.media.webkitPresentationMode) 6481 ? this.media === document.pictureInPictureElement 6482 : this.media.webkitPresentationMode === Ie 6483 : null; 6484 } 6485 setPreviewThumbnails(e) { 6486 this.previewThumbnails && 6487 this.previewThumbnails.loaded && 6488 (this.previewThumbnails.destroy(), 6489 (this.previewThumbnails = null)), 6490 Object.assign(this.config.previewThumbnails, e), 6491 this.config.previewThumbnails.enabled && 6492 (this.previewThumbnails = new tt(this)); 6493 } 6494 static supported(e, t) { 6495 return K.check(e, t); 6496 } 6497 static loadSprite(e, t) { 6498 return ke(e, t); 6499 } 6500 static setup(e, t = {}) { 6501 let i = null; 6502 return ( 6503 S.string(e) 6504 ? (i = Array.from(document.querySelectorAll(e))) 6505 : S.nodeList(e) 6506 ? (i = Array.from(e)) 6507 : S.array(e) && (i = e.filter(S.element)), 6508 S.empty(i) ? null : i.map((e) => new st(e, t)) 6509 ); 6510 } 6511 } 6512 var nt; 6513 return (st.defaults = ((nt = Le), JSON.parse(JSON.stringify(nt)))), st; 6514 }); 6515//# sourceMappingURL=plyr.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.