@oddin-gg/havik-player 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -241,35 +241,35 @@ function ce(e, t) {
241
241
  }
242
242
  //#endregion
243
243
  //#region src/core/fullscreen.ts
244
- function le(e) {
244
+ function S(e) {
245
245
  return e.ownerDocument ?? document;
246
246
  }
247
- function ue(e) {
247
+ function le(e) {
248
248
  return e.fullscreenElement ?? e.webkitFullscreenElement ?? null;
249
249
  }
250
- function S(e, t) {
251
- let n = ue(le(e));
250
+ function C(e, t) {
251
+ let n = le(S(e));
252
252
  return n != null && (n === e || t != null && n === t) || e.webkitDisplayingFullscreen === !0;
253
253
  }
254
- async function C(e, t) {
254
+ async function w(e, t) {
255
255
  let n = t ?? e;
256
256
  if (typeof n.requestFullscreen == "function") return await n.requestFullscreen(), !0;
257
257
  if (typeof n.webkitRequestFullscreen == "function") return n.webkitRequestFullscreen(), !0;
258
258
  let r = e;
259
259
  return r.webkitSupportsFullscreen && typeof r.webkitEnterFullscreen == "function" ? (r.webkitEnterFullscreen(), !0) : !1;
260
260
  }
261
- async function w(e, t) {
261
+ async function T(e, t) {
262
262
  let n = e;
263
263
  if (n.webkitDisplayingFullscreen) {
264
264
  n.webkitExitFullscreen?.();
265
265
  return;
266
266
  }
267
- let r = le(e), i = ue(r);
267
+ let r = S(e), i = le(r);
268
268
  i != null && (i === e || t != null && i === t) && (typeof r.exitFullscreen == "function" ? await r.exitFullscreen() : r.webkitExitFullscreen?.());
269
269
  }
270
270
  //#endregion
271
271
  //#region src/core/catalog.ts
272
- async function de(e) {
272
+ async function ue(e) {
273
273
  let t = new URLSearchParams();
274
274
  e.status && t.set("status", Array.isArray(e.status) ? e.status.join(",") : e.status), e.sport && t.set("sport", e.sport);
275
275
  let i = t.toString(), a = c(e.baseUrl, "/v1/catalog" + (i ? `?${i}` : "")), o = new Headers();
@@ -287,12 +287,12 @@ async function de(e) {
287
287
  };
288
288
  if (!s.ok) throw new n(r(s.status), s.status, `catalog request failed (HTTP ${s.status})`);
289
289
  return {
290
- tournaments: fe(await s.json()),
290
+ tournaments: de(await s.json()),
291
291
  etag: s.headers.get("etag") ?? void 0,
292
292
  notModified: !1
293
293
  };
294
294
  }
295
- function fe(e) {
295
+ function de(e) {
296
296
  return (e.tournaments ?? []).map((e) => {
297
297
  let t = e.urn ?? "", n = e.name ?? "", r = e.sport ?? "";
298
298
  return {
@@ -312,7 +312,7 @@ function fe(e) {
312
312
  };
313
313
  });
314
314
  }
315
- async function pe(e) {
315
+ async function fe(e) {
316
316
  let t = c(e.baseUrl, `/v1/tournaments/${encodeURIComponent(e.urn)}`), i = new Headers();
317
317
  e.etag && i.set("If-None-Match", e.etag);
318
318
  let a = await u(t, {
@@ -332,13 +332,13 @@ async function pe(e) {
332
332
  };
333
333
  if (!a.ok) throw new n(r(a.status), a.status, `tournament request failed (HTTP ${a.status})`);
334
334
  return {
335
- tournament: me(await a.json()),
335
+ tournament: pe(await a.json()),
336
336
  etag: a.headers.get("etag") ?? void 0,
337
337
  notModified: !1,
338
338
  notFound: !1
339
339
  };
340
340
  }
341
- function me(e) {
341
+ function pe(e) {
342
342
  let t = e.urn ?? "", n = e.name ?? "", r = e.sport ?? "";
343
343
  return {
344
344
  urn: t,
@@ -356,12 +356,12 @@ function me(e) {
356
356
  }))
357
357
  };
358
358
  }
359
- function he(e) {
359
+ function me(e) {
360
360
  return e.tournaments.flatMap((e) => e.matches);
361
361
  }
362
362
  //#endregion
363
363
  //#region src/core/poll.ts
364
- function ge(e) {
364
+ function he(e) {
365
365
  let t = Math.max(2e3, e.intervalMs ?? 1e4), i = new AbortController(), a, o, s, l = !1, d = () => {
366
366
  l || (a = setTimeout(f, t));
367
367
  }, f = async () => {
@@ -397,7 +397,7 @@ function ge(e) {
397
397
  }
398
398
  //#endregion
399
399
  //#region src/core/events.ts
400
- function T(e) {
400
+ function E(e) {
401
401
  let t = Math.max(250, e.minBackoffMs ?? 1e3), n = Math.max(t, e.maxBackoffMs ?? 15e3), r = new AbortController(), i = !1, a = (e) => new Promise((t) => {
402
402
  if (r.signal.aborted) return t();
403
403
  let n = setTimeout(t, e);
@@ -464,7 +464,7 @@ function T(e) {
464
464
  i || (i = !0, r.abort());
465
465
  } };
466
466
  }
467
- function E(e) {
467
+ function D(e) {
468
468
  try {
469
469
  let t = new URL(e);
470
470
  return t.hostname = `events.${t.hostname}`, t.pathname = "", t.search = "", t.origin;
@@ -474,27 +474,27 @@ function E(e) {
474
474
  }
475
475
  //#endregion
476
476
  //#region src/core/drm/deviceId.ts
477
- var D = "havik.player.deviceId", O;
478
- function k() {
479
- if (O) return O;
477
+ var O = "havik.player.deviceId", k;
478
+ function A() {
479
+ if (k) return k;
480
480
  try {
481
- let e = globalThis.localStorage?.getItem(D);
482
- if (e) return O = e, e;
481
+ let e = globalThis.localStorage?.getItem(O);
482
+ if (e) return k = e, e;
483
483
  } catch {}
484
- let e = ve();
485
- O = e;
484
+ let e = _e();
485
+ k = e;
486
486
  try {
487
- globalThis.localStorage?.setItem(D, e);
487
+ globalThis.localStorage?.setItem(O, e);
488
488
  } catch {}
489
489
  return e;
490
490
  }
491
- function _e() {
492
- O = void 0;
491
+ function ge() {
492
+ k = void 0;
493
493
  try {
494
- globalThis.localStorage?.removeItem(D);
494
+ globalThis.localStorage?.removeItem(O);
495
495
  } catch {}
496
496
  }
497
- function ve() {
497
+ function _e() {
498
498
  let e = globalThis.crypto;
499
499
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
500
500
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -506,21 +506,21 @@ function ve() {
506
506
  }
507
507
  //#endregion
508
508
  //#region src/core/drm/headers.ts
509
- function ye(e, t, n = {}) {
509
+ function ve(e, t, n = {}) {
510
510
  let r = {
511
511
  "x-api-key": t.apiKey,
512
512
  "X-Match-Urn": e.matchUrn,
513
- "X-Device-Id": n.deviceId ?? k(),
513
+ "X-Device-Id": n.deviceId ?? A(),
514
514
  "Content-Type": "application/octet-stream"
515
515
  };
516
516
  return n.userId && (r["X-User-Id"] = n.userId), r;
517
517
  }
518
518
  //#endregion
519
519
  //#region src/core/drm/cdm.ts
520
- var A = /* @__PURE__ */ new WeakMap();
521
- function be(e, t) {
522
- let n = A.get(e);
523
- n || (n = /* @__PURE__ */ new Map(), A.set(e, n));
520
+ var j = /* @__PURE__ */ new WeakMap();
521
+ function ye(e, t) {
522
+ let n = j.get(e);
523
+ n || (n = /* @__PURE__ */ new Map(), j.set(e, n));
524
524
  let r = n.get(t.keySystem);
525
525
  if (r) return r;
526
526
  let i = t.createMediaKeys().catch((e) => {
@@ -528,22 +528,22 @@ function be(e, t) {
528
528
  });
529
529
  return n.set(t.keySystem, i), i;
530
530
  }
531
- function j() {
531
+ function M() {
532
532
  return typeof navigator < "u" && typeof navigator.requestMediaKeySystemAccess == "function";
533
533
  }
534
- var M = ["SW_SECURE_DECODE", "SW_SECURE_CRYPTO"];
535
- function xe(e) {
534
+ var N = ["SW_SECURE_DECODE", "SW_SECURE_CRYPTO"];
535
+ function be(e) {
536
536
  return e.startsWith("com.widevine");
537
537
  }
538
- function N(e, t) {
539
- if (!xe(e)) return t;
538
+ function P(e, t) {
539
+ if (!be(e)) return t;
540
540
  let n = (e, t) => {
541
541
  let n = e.videoCapabilities;
542
542
  return !n?.length || !n.some((e) => e.robustness) ? !1 : n.every((e) => {
543
- let n = M.indexOf(e.robustness);
544
- return n === -1 || M.indexOf(t) > n;
543
+ let n = N.indexOf(e.robustness);
544
+ return n === -1 || N.indexOf(t) > n;
545
545
  });
546
- }, r = M.flatMap((e) => t.filter((t) => n(t, e)).map((t) => ({
546
+ }, r = N.flatMap((e) => t.filter((t) => n(t, e)).map((t) => ({
547
547
  ...t,
548
548
  videoCapabilities: t.videoCapabilities?.map((t) => ({
549
549
  ...t,
@@ -552,16 +552,16 @@ function N(e, t) {
552
552
  })));
553
553
  return [...t, ...r];
554
554
  }
555
- function Se(e) {
556
- return (t, n) => j() ? navigator.requestMediaKeySystemAccess(t, N(t, n)).then((t) => ({
555
+ function xe(e) {
556
+ return (t, n) => M() ? navigator.requestMediaKeySystemAccess(t, P(t, n)).then((t) => ({
557
557
  keySystem: t.keySystem,
558
558
  getConfiguration: () => t.getConfiguration(),
559
- createMediaKeys: () => be(e, t)
559
+ createMediaKeys: () => ye(e, t)
560
560
  })) : Promise.reject(/* @__PURE__ */ Error("navigator.requestMediaKeySystemAccess is unavailable — EME needs a secure context (https, or localhost)"));
561
561
  }
562
562
  //#endregion
563
563
  //#region src/core/drm/support.ts
564
- var Ce = 5e3, we = "video/mp4; codecs=\"avc1.42E01E\"", P = "audio/mp4; codecs=\"mp4a.40.2\"", Te = {
564
+ var Se = 5e3, Ce = "video/mp4; codecs=\"avc1.42E01E\"", we = "audio/mp4; codecs=\"mp4a.40.2\"", Te = {
565
565
  widevine: ["com.widevine.alpha"],
566
566
  fairplay: ["com.apple.fps"]
567
567
  };
@@ -573,24 +573,24 @@ function Ee(e) {
573
573
  "cenc"
574
574
  ],
575
575
  videoCapabilities: [{
576
- contentType: we,
576
+ contentType: Ce,
577
577
  robustness: "",
578
578
  encryptionScheme: "cbcs"
579
579
  }],
580
580
  audioCapabilities: [{
581
- contentType: P,
581
+ contentType: we,
582
582
  robustness: "",
583
583
  encryptionScheme: "cbcs"
584
584
  }]
585
- }] : N("com.widevine.alpha", [{
585
+ }] : P("com.widevine.alpha", [{
586
586
  initDataTypes: ["cenc"],
587
587
  videoCapabilities: [{
588
- contentType: we,
588
+ contentType: Ce,
589
589
  robustness: "SW_SECURE_DECODE",
590
590
  encryptionScheme: "cbcs"
591
591
  }],
592
592
  audioCapabilities: [{
593
- contentType: P,
593
+ contentType: we,
594
594
  robustness: "SW_SECURE_CRYPTO",
595
595
  encryptionScheme: "cbcs"
596
596
  }]
@@ -607,7 +607,7 @@ function F(e, t) {
607
607
  });
608
608
  }
609
609
  async function De(e = {}) {
610
- let t = e.systems ?? ["widevine", "fairplay"], n = e.timeoutMs ?? Ce, r = {};
610
+ let t = e.systems ?? ["widevine", "fairplay"], n = e.timeoutMs ?? Se, r = {};
611
611
  if (typeof window < "u" && window.isSecureContext === !1) return {
612
612
  verdict: "insecure-context",
613
613
  detail: r
@@ -672,7 +672,7 @@ var Ae = /\.(m3u8|ts|m4s|mp4|cmfv|cmfa)(\?|$)/i;
672
672
  function je(e) {
673
673
  if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return "";
674
674
  let t = "", n = -1, r = performance.getEntriesByType("resource");
675
- for (let i of r) if (!(i.startTime < e) && !(i.initiatorType !== "video" && i.initiatorType !== "audio" && !Ae.test(i.name)) && i.startTime >= n) {
675
+ for (let i of r) if (!(i.startTime < e) && (i.initiatorType === "video" || i.initiatorType === "audio" || Ae.test(i.name)) && i.startTime >= n) {
676
676
  let e = L(i.name);
677
677
  e && (t = e, n = i.startTime);
678
678
  }
@@ -776,7 +776,7 @@ var V = class {
776
776
  });
777
777
  this.onEncrypted = (n) => {
778
778
  let i = n;
779
- !i.initData || this.fairplayArmed || (this.fairplayArmed = !0, this.fairplayKeyIV = Ne(i.initData), (async () => {
779
+ i.initData && !this.fairplayArmed && (this.fairplayArmed = !0, this.fairplayKeyIV = Ne(i.initData), (async () => {
780
780
  try {
781
781
  let n = await (await navigator.requestMediaKeySystemAccess("com.apple.fps", [{
782
782
  initDataTypes: [i.initDataType],
@@ -1034,7 +1034,7 @@ var U = class {
1034
1034
  videoEncryptionScheme: "cbcs",
1035
1035
  audioEncryptionScheme: "cbcs"
1036
1036
  },
1037
- ...j() ? { requestMediaKeySystemAccessFunc: Se(t) } : {},
1037
+ ...M() ? { requestMediaKeySystemAccessFunc: xe(t) } : {},
1038
1038
  licenseXhrSetup: (e, t) => {
1039
1039
  e.open("POST", this.licenseUrl ?? t, !0), e.setRequestHeader("x-api-key", r.apiKey), e.setRequestHeader("X-Match-Urn", n.matchUrn), e.setRequestHeader("X-Device-Id", i), a && e.setRequestHeader("X-User-Id", a), this.licenseRequested = !0;
1040
1040
  let o = performance.now();
@@ -1435,6 +1435,8 @@ var lt = class {
1435
1435
  hiddenTotalMs = 0;
1436
1436
  lastHbPlayingMs = 0;
1437
1437
  lastHbHiddenMs = 0;
1438
+ lastHbRebufferMs = 0;
1439
+ lastHbRebufferCount = 0;
1438
1440
  rebufferCount = 0;
1439
1441
  rebufferTotalMs = 0;
1440
1442
  bufferingSinceMs = null;
@@ -1602,31 +1604,33 @@ var lt = class {
1602
1604
  this.playingSinceMs !== null && (n += t - this.playingSinceMs);
1603
1605
  let r = this.hiddenTotalMs;
1604
1606
  this.hiddenSinceMs !== null && (r += t - this.hiddenSinceMs);
1605
- let i = {}, a = e.bytesLoaded ?? 0;
1606
- a > this.lastBytes && (i.bytesDownloadedDelta = a - this.lastBytes), this.lastBytes = a;
1607
- let o = e.playlistBytesLoaded ?? 0;
1608
- o > this.lastPlaylistBytes && (i.playlistBytesDelta = o - this.lastPlaylistBytes), this.lastPlaylistBytes = o;
1609
- let s = e.droppedFrames ?? 0;
1610
- s > this.lastDropped && (i.droppedFramesDelta = s - this.lastDropped), this.lastDropped = s;
1611
- let c = e.renditionSwitches ?? 0;
1612
- c > this.lastSwitches && (i.renditionSwitchesDelta = c - this.lastSwitches), this.lastSwitches = c, n > this.lastHbPlayingMs && (i.playingMsDelta = Math.round(n - this.lastHbPlayingMs)), this.lastHbPlayingMs = n, r > this.lastHbHiddenMs && (i.hiddenMsDelta = Math.round(r - this.lastHbHiddenMs)), this.lastHbHiddenMs = r, typeof e.latencySeconds == "number" && (i.latencyMs = Math.round(e.latencySeconds * 1e3)), typeof e.targetLatencySeconds == "number" && (i.targetLatencyMs = Math.round(e.targetLatencySeconds * 1e3)), typeof e.bandwidthKbps == "number" && (i.bandwidthEstKbps = e.bandwidthKbps), typeof e.levelHeight == "number" && (i.renditionHeight = e.levelHeight), typeof e.renditionBitrateKbps == "number" && (i.renditionBitrateKbps = e.renditionBitrateKbps), e.atLiveEdge === !0 && (i.atLiveEdge = !0), typeof e.bufferedMs == "number" && e.bufferedMs > 0 && (i.bufferedMs = Math.round(e.bufferedMs)), i.playerState = q[e.state] ?? "PLAYER_STATE_UNSPECIFIED";
1613
- let l = this.mutedTotalMs;
1614
- this.mutedSinceMs !== null && (l += t - this.mutedSinceMs), l > this.lastHbMutedMs && (i.mutedMsDelta = Math.round(l - this.lastHbMutedMs)), this.lastHbMutedMs = l;
1615
- let u = e.upshifts ?? 0;
1616
- u > this.lastUpshifts && (i.upshiftsDelta = u - this.lastUpshifts), this.lastUpshifts = u;
1617
- let d = e.downshifts ?? 0;
1618
- d > this.lastDownshifts && (i.downshiftsDelta = d - this.lastDownshifts), this.lastDownshifts = d;
1619
- let f = e.decodedFrames ?? 0;
1620
- f > this.lastDecoded && (i.decodedFramesDelta = f - this.lastDecoded), this.lastDecoded = f;
1621
- let p = e.requestErrors ?? 0;
1622
- p > this.lastRequestErrors && (i.requestErrorsDelta = p - this.lastRequestErrors), this.lastRequestErrors = p;
1623
- let m = e.requestCount ?? 0, h = m - this.lastRequestCount;
1624
- if (this.lastRequestCount = m, h > 0) {
1625
- i.requestCountDelta = h;
1626
- let t = e.requestTimesMs ?? [], n = t.slice(Math.max(0, t.length - h)).sort((e, t) => e - t);
1627
- n.length > 0 && (i.requestTimeP50Ms = K(n, 50), i.requestTimeP95Ms = K(n, 95));
1607
+ let i = this.rebufferTotalMs;
1608
+ this.bufferingSinceMs !== null && (i += t - this.bufferingSinceMs);
1609
+ let a = {}, o = e.bytesLoaded ?? 0;
1610
+ o > this.lastBytes && (a.bytesDownloadedDelta = o - this.lastBytes), this.lastBytes = o;
1611
+ let s = e.playlistBytesLoaded ?? 0;
1612
+ s > this.lastPlaylistBytes && (a.playlistBytesDelta = s - this.lastPlaylistBytes), this.lastPlaylistBytes = s;
1613
+ let c = e.droppedFrames ?? 0;
1614
+ c > this.lastDropped && (a.droppedFramesDelta = c - this.lastDropped), this.lastDropped = c;
1615
+ let l = e.renditionSwitches ?? 0;
1616
+ l > this.lastSwitches && (a.renditionSwitchesDelta = l - this.lastSwitches), this.lastSwitches = l, n > this.lastHbPlayingMs && (a.playingMsDelta = Math.round(n - this.lastHbPlayingMs)), this.lastHbPlayingMs = n, r > this.lastHbHiddenMs && (a.hiddenMsDelta = Math.round(r - this.lastHbHiddenMs)), this.lastHbHiddenMs = r, i > this.lastHbRebufferMs && (a.rebufferMsDelta = Math.round(i - this.lastHbRebufferMs)), this.lastHbRebufferMs = i, this.rebufferCount > this.lastHbRebufferCount && (a.rebufferCountDelta = this.rebufferCount - this.lastHbRebufferCount), this.lastHbRebufferCount = this.rebufferCount, typeof e.latencySeconds == "number" && (a.latencyMs = Math.round(e.latencySeconds * 1e3)), typeof e.targetLatencySeconds == "number" && (a.targetLatencyMs = Math.round(e.targetLatencySeconds * 1e3)), typeof e.bandwidthKbps == "number" && (a.bandwidthEstKbps = e.bandwidthKbps), typeof e.levelHeight == "number" && (a.renditionHeight = e.levelHeight), typeof e.renditionBitrateKbps == "number" && (a.renditionBitrateKbps = e.renditionBitrateKbps), e.atLiveEdge === !0 && (a.atLiveEdge = !0), typeof e.bufferedMs == "number" && e.bufferedMs > 0 && (a.bufferedMs = Math.round(e.bufferedMs)), a.playerState = q[e.state] ?? "PLAYER_STATE_UNSPECIFIED";
1617
+ let u = this.mutedTotalMs;
1618
+ this.mutedSinceMs !== null && (u += t - this.mutedSinceMs), u > this.lastHbMutedMs && (a.mutedMsDelta = Math.round(u - this.lastHbMutedMs)), this.lastHbMutedMs = u;
1619
+ let d = e.upshifts ?? 0;
1620
+ d > this.lastUpshifts && (a.upshiftsDelta = d - this.lastUpshifts), this.lastUpshifts = d;
1621
+ let f = e.downshifts ?? 0;
1622
+ f > this.lastDownshifts && (a.downshiftsDelta = f - this.lastDownshifts), this.lastDownshifts = f;
1623
+ let p = e.decodedFrames ?? 0;
1624
+ p > this.lastDecoded && (a.decodedFramesDelta = p - this.lastDecoded), this.lastDecoded = p;
1625
+ let m = e.requestErrors ?? 0;
1626
+ m > this.lastRequestErrors && (a.requestErrorsDelta = m - this.lastRequestErrors), this.lastRequestErrors = m;
1627
+ let h = e.requestCount ?? 0, g = h - this.lastRequestCount;
1628
+ if (this.lastRequestCount = h, g > 0) {
1629
+ a.requestCountDelta = g;
1630
+ let t = e.requestTimesMs ?? [], n = t.slice(Math.max(0, t.length - g)).sort((e, t) => e - t);
1631
+ n.length > 0 && (a.requestTimeP50Ms = K(n, 50), a.requestTimeP95Ms = K(n, 95));
1628
1632
  }
1629
- typeof e.latencySeconds == "number" && typeof e.targetLatencySeconds == "number" && (i.driftMs = Math.round((e.latencySeconds - e.targetLatencySeconds) * 1e3)), typeof e.playbackRate == "number" && e.playbackRate > 0 && (i.playbackRate = e.playbackRate), e.qualityPinned === !0 && (i.qualityPinned = !0), e.cdnHost && (i.cdnHost = e.cdnHost), this.maybeEmitMediaInfo(e), this.enqueue({ heartbeat: i }), this.flush(), a > 0 && this.noteFirstBytes();
1633
+ typeof e.latencySeconds == "number" && typeof e.targetLatencySeconds == "number" && (a.driftMs = Math.round((e.latencySeconds - e.targetLatencySeconds) * 1e3)), typeof e.playbackRate == "number" && e.playbackRate > 0 && (a.playbackRate = e.playbackRate), e.qualityPinned === !0 && (a.qualityPinned = !0), e.cdnHost && (a.cdnHost = e.cdnHost), this.maybeEmitMediaInfo(e), this.enqueue({ heartbeat: a }), this.flush(), o > 0 && this.noteFirstBytes();
1630
1634
  }
1631
1635
  maybeEmitMediaInfo(e) {
1632
1636
  if (!(e.videoCodec ?? e.keySystem ?? e.ladderHeights)) return;
@@ -1760,7 +1764,7 @@ async function mt() {
1760
1764
  }
1761
1765
  //#endregion
1762
1766
  //#region src/core/version.ts
1763
- var ht = "2.3.1", J = {
1767
+ var ht = "2.4.0", J = {
1764
1768
  accent: "#E1B600",
1765
1769
  accentText: "#1B1C23",
1766
1770
  background: "#0e0f13",
@@ -2082,11 +2086,11 @@ var St = class {
2082
2086
  }
2083
2087
  async toggleFullscreen() {
2084
2088
  try {
2085
- S(this.video, this.root) ? await w(this.video, this.root) : await C(this.video, this.root);
2089
+ C(this.video, this.root) ? await T(this.video, this.root) : await w(this.video, this.root);
2086
2090
  } catch {}
2087
2091
  }
2088
2092
  syncFullscreen() {
2089
- let e = S(this.video, this.root);
2093
+ let e = C(this.video, this.root);
2090
2094
  this.setIcon(this.fsBtn, e ? "fullscreenExit" : "fullscreen"), this.fsBtn.setAttribute("aria-label", e ? "Exit fullscreen" : "Fullscreen");
2091
2095
  }
2092
2096
  poke() {
@@ -2253,7 +2257,7 @@ var Pt = class {
2253
2257
  };
2254
2258
  }
2255
2259
  beginArming(e, t, n = !1) {
2256
- let r = this.opts.liveStateEvents === !1 ? void 0 : this.opts.eventsBaseUrl ?? E(this.opts.baseUrl);
2260
+ let r = this.opts.liveStateEvents === !1 ? void 0 : this.opts.eventsBaseUrl ?? D(this.opts.baseUrl);
2257
2261
  r ? this.armWithSse(e, r, t, n) : this.beginArmingByPolling(e);
2258
2262
  }
2259
2263
  beginArmingByPolling(e) {
@@ -2313,7 +2317,7 @@ var Pt = class {
2313
2317
  !a && !p() && h();
2314
2318
  }, e);
2315
2319
  };
2316
- _(Dt), this.armingSub = T({
2320
+ _(Dt), this.armingSub = E({
2317
2321
  eventsBaseUrl: t,
2318
2322
  matchUrn: this.opts.matchUrn,
2319
2323
  credential: this.opts.credential,
@@ -2400,7 +2404,7 @@ var Pt = class {
2400
2404
  video: this.opts.video,
2401
2405
  descriptor: e,
2402
2406
  credential: t,
2403
- deviceId: k(),
2407
+ deviceId: A(),
2404
2408
  userId: this.opts.userId,
2405
2409
  lowLatency: this.opts.lowLatency === void 0 || this.opts.lowLatency === "auto" || this.opts.lowLatency,
2406
2410
  snapToLiveOnRefocus: this.opts.snapToLiveOnRefocus,
@@ -2441,11 +2445,11 @@ var Pt = class {
2441
2445
  }
2442
2446
  startLiveState(e) {
2443
2447
  if (this.opts.liveStateEvents === !1) return;
2444
- let t = this.opts.eventsBaseUrl ?? E(this.opts.baseUrl);
2448
+ let t = this.opts.eventsBaseUrl ?? D(this.opts.baseUrl);
2445
2449
  if (!t) return;
2446
2450
  this.closeLiveState();
2447
2451
  let r = 0, i = !1;
2448
- this.liveStateSub = T({
2452
+ this.liveStateSub = E({
2449
2453
  eventsBaseUrl: t,
2450
2454
  matchUrn: this.opts.matchUrn,
2451
2455
  credential: this.opts.credential,
@@ -2476,7 +2480,7 @@ var Pt = class {
2476
2480
  return this.opts.rejoinOnLive !== !1 && this.opts.liveStateEvents !== !1;
2477
2481
  }
2478
2482
  scheduleRejoin(e) {
2479
- !this.rejoinEnabled() || this.rejoinTimer || (this.rejoinTimer = setTimeout(() => {
2483
+ this.rejoinEnabled() && !this.rejoinTimer && (this.rejoinTimer = setTimeout(() => {
2480
2484
  this.rejoinTimer = null, !(this.destroyed || e !== this.loadGen || this._state !== "ended") && this.rejoin();
2481
2485
  }, Math.random() * kt));
2482
2486
  }
@@ -2545,14 +2549,14 @@ var Pt = class {
2545
2549
  scheduleLicenseRefresh() {
2546
2550
  this.stopRefresh();
2547
2551
  let e = this.opts.licenseRefreshMs ?? Mt;
2548
- !e || !this._descriptor?.drmEnabled || (this.refreshTimer = setInterval(() => void this.refreshLicense(), e));
2552
+ e && this._descriptor?.drmEnabled && (this.refreshTimer = setInterval(() => void this.refreshLicense(), e));
2549
2553
  }
2550
2554
  stopRefresh() {
2551
2555
  this.refreshTimer && clearInterval(this.refreshTimer), this.refreshTimer = void 0;
2552
2556
  }
2553
2557
  async refreshLicense() {
2554
2558
  let e = this.engine;
2555
- if (!(this.destroyed || !e)) try {
2559
+ if (!this.destroyed && e) try {
2556
2560
  let t = await y(this.resolveOptions());
2557
2561
  if (this.destroyed || this.engine !== e) return;
2558
2562
  let n = t.drm?.widevine?.licenseUrl, r = t.drm?.fairplay?.licenseUrl;
@@ -2625,10 +2629,10 @@ var Pt = class {
2625
2629
  e.pictureInPictureElement === this.opts.video && typeof e.exitPictureInPicture == "function" && await e.exitPictureInPicture();
2626
2630
  }
2627
2631
  async enterFullscreen() {
2628
- return !this.destroyed && C(this.opts.video, this.container ?? void 0);
2632
+ return !this.destroyed && w(this.opts.video, this.container ?? void 0);
2629
2633
  }
2630
2634
  async exitFullscreen() {
2631
- await w(this.opts.video, this.container ?? void 0);
2635
+ await T(this.opts.video, this.container ?? void 0);
2632
2636
  }
2633
2637
  retry() {
2634
2638
  return this.reload();
@@ -2906,7 +2910,7 @@ async function Rt() {
2906
2910
  case "oddin:destroy": c();
2907
2911
  }
2908
2912
  }, u = (e) => {
2909
- !r || e.origin !== r || $(e.data) && l(e.data);
2913
+ r && e.origin === r && $(e.data) && l(e.data);
2910
2914
  };
2911
2915
  r && window.addEventListener("message", u), window.addEventListener("pagehide", c, { once: !0 }), await s(e.matchUrn), i({
2912
2916
  type: "oddin:ready",
@@ -2925,6 +2929,6 @@ function Bt() {
2925
2929
  e.textContent = "html,body{margin:0;height:100%;background:#000;overflow:hidden}body{display:flex}", document.head.appendChild(e);
2926
2930
  }
2927
2931
  //#endregion
2928
- export { J as ODDIN_THEME, n as PlaybackError, X as applyTheme, Rt as bootEmbed, _e as clearDeviceId, Nt as createPlayer, E as deriveEventsBaseUrl, De as detectDrmSupport, C as enterVideoFullscreen, w as exitVideoFullscreen, de as fetchCatalog, pe as fetchTournament, he as flattenMatches, k as getDeviceId, ke as isLowLatencyManifest, $ as isOddinMessage, ye as licenseRequestHeaders, Ft as mountEmbed, v as pollToLive, b as resolveStream, T as subscribeLiveState, S as videoFullscreenActive, ge as watchStatus };
2932
+ export { J as ODDIN_THEME, n as PlaybackError, X as applyTheme, Rt as bootEmbed, ge as clearDeviceId, Nt as createPlayer, D as deriveEventsBaseUrl, De as detectDrmSupport, w as enterVideoFullscreen, T as exitVideoFullscreen, ue as fetchCatalog, fe as fetchTournament, me as flattenMatches, A as getDeviceId, ke as isLowLatencyManifest, $ as isOddinMessage, ve as licenseRequestHeaders, Ft as mountEmbed, v as pollToLive, b as resolveStream, E as subscribeLiveState, C as videoFullscreenActive, he as watchStatus };
2929
2933
 
2930
2934
  //# sourceMappingURL=index.js.map