@oddin-gg/havik-player 2.3.1 → 2.5.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/havik-player.global.js +11 -11
- package/dist/havik-player.global.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +117 -110
- package/dist/index.js.map +1 -1
- package/embed/index.html +1 -1
- package/examples/vanilla.html +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -142,7 +142,7 @@ function ae(e, t) {
|
|
|
142
142
|
t?.addEventListener("abort", a, { once: !0 });
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
async function
|
|
145
|
+
async function oe(e, t, r) {
|
|
146
146
|
let i = ee(t), a = Date.now(), s = i.timeoutMs == null ? Infinity : a + i.timeoutMs, c = 0, l;
|
|
147
147
|
for (;;) {
|
|
148
148
|
if (r?.aborted) throw new n("ABORTED", 0, "wait-for-live aborted");
|
|
@@ -168,21 +168,21 @@ async function v(e, t, r) {
|
|
|
168
168
|
}
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/core/resolve.ts
|
|
171
|
-
async function
|
|
171
|
+
async function v(e) {
|
|
172
172
|
if (!e.matchUrn || typeof e.matchUrn != "string") throw new n("INVALID_URN", 0, "resolveStream: a non-empty matchUrn is required");
|
|
173
173
|
let t = await u(c(e.baseUrl, `/v1/playback/${encodeURIComponent(e.matchUrn)}`), {
|
|
174
174
|
credential: e.credential,
|
|
175
175
|
signal: e.signal,
|
|
176
176
|
apiHeaders: e.apiHeaders
|
|
177
177
|
});
|
|
178
|
-
if (!t.ok) throw await
|
|
179
|
-
return
|
|
178
|
+
if (!t.ok) throw await se(t);
|
|
179
|
+
return le(await t.json(), e.matchUrn);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
let t = () =>
|
|
183
|
-
return e.waitForLive ?
|
|
181
|
+
function y(e) {
|
|
182
|
+
let t = () => v(e);
|
|
183
|
+
return e.waitForLive ? oe(t, e.waitForLive, e.signal) : t();
|
|
184
184
|
}
|
|
185
|
-
async function
|
|
185
|
+
async function se(e) {
|
|
186
186
|
let t = l(e.headers.get("retry-after")), i = e.headers.get("x-request-id") ?? e.headers.get("x-amzn-requestid") ?? void 0, a = e.statusText || `HTTP ${e.status}`, o, s;
|
|
187
187
|
try {
|
|
188
188
|
let t = await e.json();
|
|
@@ -198,7 +198,7 @@ async function oe(e) {
|
|
|
198
198
|
liveStartsAtMs: s
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var ce = /* @__PURE__ */ new Set([
|
|
202
202
|
"matchUrn",
|
|
203
203
|
"protocol",
|
|
204
204
|
"drmEnabled",
|
|
@@ -209,7 +209,7 @@ var se = /* @__PURE__ */ new Set([
|
|
|
209
209
|
"expiresAt",
|
|
210
210
|
"analytics"
|
|
211
211
|
]);
|
|
212
|
-
function
|
|
212
|
+
function b(e, t) {
|
|
213
213
|
let r;
|
|
214
214
|
try {
|
|
215
215
|
r = new URL(t);
|
|
@@ -219,57 +219,57 @@ function x(e, t) {
|
|
|
219
219
|
if (r.protocol !== "https:" && r.protocol !== "http:") throw new n("INTERNAL", 0, `playback ${e} has a disallowed scheme: ${r.protocol}`);
|
|
220
220
|
return t;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function le(e, t) {
|
|
223
223
|
if (!e.manifestUrl) throw new n("INTERNAL", 0, "playback response is missing manifestUrl");
|
|
224
224
|
let r = e.drmEnabled ?? !!e.drm, i = {
|
|
225
225
|
matchUrn: e.matchUrn ?? t,
|
|
226
226
|
protocol: "hls",
|
|
227
227
|
drmEnabled: r,
|
|
228
|
-
manifestUrl:
|
|
228
|
+
manifestUrl: b("manifestUrl", e.manifestUrl),
|
|
229
229
|
serverTime: e.serverTime ?? ""
|
|
230
230
|
};
|
|
231
231
|
if (e.liveStartsAt && (i.liveStartsAt = e.liveStartsAt), typeof e.analytics?.sid == "string" && e.analytics.sid && (i.analytics = { sid: e.analytics.sid }), r && e.drm) {
|
|
232
232
|
let t = {};
|
|
233
|
-
e.drm.widevine?.licenseUrl && (t.widevine = { licenseUrl:
|
|
234
|
-
licenseUrl:
|
|
235
|
-
certificateUrl:
|
|
233
|
+
e.drm.widevine?.licenseUrl && (t.widevine = { licenseUrl: b("widevine licenseUrl", e.drm.widevine.licenseUrl) }), e.drm.fairplay?.licenseUrl && e.drm.fairplay.certificateUrl && (t.fairplay = {
|
|
234
|
+
licenseUrl: b("fairplay licenseUrl", e.drm.fairplay.licenseUrl),
|
|
235
|
+
certificateUrl: b("fairplay certificateUrl", e.drm.fairplay.certificateUrl)
|
|
236
236
|
}), (t.widevine || t.fairplay) && (i.drm = t);
|
|
237
237
|
}
|
|
238
238
|
let a = {};
|
|
239
|
-
for (let [t, n] of Object.entries(e))
|
|
239
|
+
for (let [t, n] of Object.entries(e)) ce.has(t) || (a[t] = n);
|
|
240
240
|
return Object.keys(a).length > 0 && (i.extensions = a), i;
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/core/fullscreen.ts
|
|
244
|
-
function
|
|
244
|
+
function x(e) {
|
|
245
245
|
return e.ownerDocument ?? document;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function S(e) {
|
|
248
248
|
return e.fullscreenElement ?? e.webkitFullscreenElement ?? null;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
let n =
|
|
250
|
+
function C(e, t) {
|
|
251
|
+
let n = S(x(e));
|
|
252
252
|
return n != null && (n === e || t != null && n === t) || e.webkitDisplayingFullscreen === !0;
|
|
253
253
|
}
|
|
254
|
-
async function
|
|
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
|
|
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 =
|
|
267
|
+
let r = x(e), i = S(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
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
478
|
-
function
|
|
479
|
-
if (
|
|
477
|
+
var O = "havik.player.deviceId", k;
|
|
478
|
+
function A() {
|
|
479
|
+
if (k) return k;
|
|
480
480
|
try {
|
|
481
|
-
let e = globalThis.localStorage?.getItem(
|
|
482
|
-
if (e) return
|
|
481
|
+
let e = globalThis.localStorage?.getItem(O);
|
|
482
|
+
if (e) return k = e, e;
|
|
483
483
|
} catch {}
|
|
484
|
-
let e =
|
|
485
|
-
|
|
484
|
+
let e = _e();
|
|
485
|
+
k = e;
|
|
486
486
|
try {
|
|
487
|
-
globalThis.localStorage?.setItem(
|
|
487
|
+
globalThis.localStorage?.setItem(O, e);
|
|
488
488
|
} catch {}
|
|
489
489
|
return e;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
491
|
+
function ge() {
|
|
492
|
+
k = void 0;
|
|
493
493
|
try {
|
|
494
|
-
globalThis.localStorage?.removeItem(
|
|
494
|
+
globalThis.localStorage?.removeItem(O);
|
|
495
495
|
} catch {}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
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
|
|
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 ??
|
|
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
|
|
521
|
-
function
|
|
522
|
-
let n =
|
|
523
|
-
n || (n = /* @__PURE__ */ new Map(),
|
|
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
|
|
531
|
+
function M() {
|
|
532
532
|
return typeof navigator < "u" && typeof navigator.requestMediaKeySystemAccess == "function";
|
|
533
533
|
}
|
|
534
|
-
var
|
|
535
|
-
function
|
|
534
|
+
var N = ["SW_SECURE_DECODE", "SW_SECURE_CRYPTO"];
|
|
535
|
+
function be(e) {
|
|
536
536
|
return e.startsWith("com.widevine");
|
|
537
537
|
}
|
|
538
|
-
function
|
|
539
|
-
if (!
|
|
538
|
+
function xe(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 =
|
|
544
|
-
return n === -1 ||
|
|
543
|
+
let n = N.indexOf(e.robustness);
|
|
544
|
+
return n === -1 || N.indexOf(t) > n;
|
|
545
545
|
});
|
|
546
|
-
}, r =
|
|
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,
|
|
@@ -553,10 +553,10 @@ function N(e, t) {
|
|
|
553
553
|
return [...t, ...r];
|
|
554
554
|
}
|
|
555
555
|
function Se(e) {
|
|
556
|
-
return (t, n) =>
|
|
556
|
+
return (t, n) => M() ? navigator.requestMediaKeySystemAccess(t, xe(t, n)).then((t) => ({
|
|
557
557
|
keySystem: t.keySystem,
|
|
558
558
|
getConfiguration: () => t.getConfiguration(),
|
|
559
|
-
createMediaKeys: () =>
|
|
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
|
|
@@ -582,7 +582,7 @@ function Ee(e) {
|
|
|
582
582
|
robustness: "",
|
|
583
583
|
encryptionScheme: "cbcs"
|
|
584
584
|
}]
|
|
585
|
-
}] :
|
|
585
|
+
}] : xe("com.widevine.alpha", [{
|
|
586
586
|
initDataTypes: ["cenc"],
|
|
587
587
|
videoCapabilities: [{
|
|
588
588
|
contentType: we,
|
|
@@ -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) &&
|
|
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
|
-
|
|
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
|
-
...
|
|
1037
|
+
...M() ? { requestMediaKeySystemAccessFunc: Se(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,9 @@ var lt = class {
|
|
|
1435
1435
|
hiddenTotalMs = 0;
|
|
1436
1436
|
lastHbPlayingMs = 0;
|
|
1437
1437
|
lastHbHiddenMs = 0;
|
|
1438
|
+
lastHbRebufferMs = 0;
|
|
1439
|
+
lastHbRebufferCount = 0;
|
|
1440
|
+
lastHbActiveMs = 0;
|
|
1438
1441
|
rebufferCount = 0;
|
|
1439
1442
|
rebufferTotalMs = 0;
|
|
1440
1443
|
bufferingSinceMs = null;
|
|
@@ -1602,31 +1605,35 @@ var lt = class {
|
|
|
1602
1605
|
this.playingSinceMs !== null && (n += t - this.playingSinceMs);
|
|
1603
1606
|
let r = this.hiddenTotalMs;
|
|
1604
1607
|
this.hiddenSinceMs !== null && (r += t - this.hiddenSinceMs);
|
|
1605
|
-
let i =
|
|
1606
|
-
|
|
1607
|
-
let
|
|
1608
|
-
|
|
1609
|
-
let s = e.
|
|
1610
|
-
s > this.
|
|
1611
|
-
let c = e.
|
|
1612
|
-
c > this.
|
|
1613
|
-
let l =
|
|
1614
|
-
|
|
1615
|
-
let u = e.
|
|
1616
|
-
u > this.
|
|
1617
|
-
let d =
|
|
1618
|
-
d > this.
|
|
1619
|
-
let f = e.
|
|
1620
|
-
f > this.
|
|
1621
|
-
let p = e.
|
|
1622
|
-
p > this.
|
|
1623
|
-
let m = e.
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1608
|
+
let i = this.rebufferTotalMs;
|
|
1609
|
+
this.bufferingSinceMs !== null && (i += t - this.bufferingSinceMs);
|
|
1610
|
+
let a = this.activeTotalMs;
|
|
1611
|
+
this.activeSinceMs !== null && (a += t - this.activeSinceMs);
|
|
1612
|
+
let o = {}, s = e.bytesLoaded ?? 0;
|
|
1613
|
+
s > this.lastBytes && (o.bytesDownloadedDelta = s - this.lastBytes), this.lastBytes = s;
|
|
1614
|
+
let c = e.playlistBytesLoaded ?? 0;
|
|
1615
|
+
c > this.lastPlaylistBytes && (o.playlistBytesDelta = c - this.lastPlaylistBytes), this.lastPlaylistBytes = c;
|
|
1616
|
+
let l = e.droppedFrames ?? 0;
|
|
1617
|
+
l > this.lastDropped && (o.droppedFramesDelta = l - this.lastDropped), this.lastDropped = l;
|
|
1618
|
+
let u = e.renditionSwitches ?? 0;
|
|
1619
|
+
u > this.lastSwitches && (o.renditionSwitchesDelta = u - this.lastSwitches), this.lastSwitches = u, n > this.lastHbPlayingMs && (o.playingMsDelta = Math.round(n - this.lastHbPlayingMs)), this.lastHbPlayingMs = n, r > this.lastHbHiddenMs && (o.hiddenMsDelta = Math.round(r - this.lastHbHiddenMs)), this.lastHbHiddenMs = r, i > this.lastHbRebufferMs && (o.rebufferMsDelta = Math.round(i - this.lastHbRebufferMs)), this.lastHbRebufferMs = i, this.rebufferCount > this.lastHbRebufferCount && (o.rebufferCountDelta = this.rebufferCount - this.lastHbRebufferCount), this.lastHbRebufferCount = this.rebufferCount, a > this.lastHbActiveMs && (o.activeMsDelta = Math.round(a - this.lastHbActiveMs)), this.lastHbActiveMs = a, typeof e.latencySeconds == "number" && (o.latencyMs = Math.round(e.latencySeconds * 1e3)), typeof e.targetLatencySeconds == "number" && (o.targetLatencyMs = Math.round(e.targetLatencySeconds * 1e3)), typeof e.bandwidthKbps == "number" && (o.bandwidthEstKbps = e.bandwidthKbps), typeof e.levelHeight == "number" && (o.renditionHeight = e.levelHeight), typeof e.renditionBitrateKbps == "number" && (o.renditionBitrateKbps = e.renditionBitrateKbps), e.atLiveEdge === !0 && (o.atLiveEdge = !0), typeof e.bufferedMs == "number" && e.bufferedMs > 0 && (o.bufferedMs = Math.round(e.bufferedMs)), o.playerState = q[e.state] ?? "PLAYER_STATE_UNSPECIFIED";
|
|
1620
|
+
let d = this.mutedTotalMs;
|
|
1621
|
+
this.mutedSinceMs !== null && (d += t - this.mutedSinceMs), d > this.lastHbMutedMs && (o.mutedMsDelta = Math.round(d - this.lastHbMutedMs)), this.lastHbMutedMs = d;
|
|
1622
|
+
let f = e.upshifts ?? 0;
|
|
1623
|
+
f > this.lastUpshifts && (o.upshiftsDelta = f - this.lastUpshifts), this.lastUpshifts = f;
|
|
1624
|
+
let p = e.downshifts ?? 0;
|
|
1625
|
+
p > this.lastDownshifts && (o.downshiftsDelta = p - this.lastDownshifts), this.lastDownshifts = p;
|
|
1626
|
+
let m = e.decodedFrames ?? 0;
|
|
1627
|
+
m > this.lastDecoded && (o.decodedFramesDelta = m - this.lastDecoded), this.lastDecoded = m;
|
|
1628
|
+
let h = e.requestErrors ?? 0;
|
|
1629
|
+
h > this.lastRequestErrors && (o.requestErrorsDelta = h - this.lastRequestErrors), this.lastRequestErrors = h;
|
|
1630
|
+
let g = e.requestCount ?? 0, _ = g - this.lastRequestCount;
|
|
1631
|
+
if (this.lastRequestCount = g, _ > 0) {
|
|
1632
|
+
o.requestCountDelta = _;
|
|
1633
|
+
let t = e.requestTimesMs ?? [], n = t.slice(Math.max(0, t.length - _)).sort((e, t) => e - t);
|
|
1634
|
+
n.length > 0 && (o.requestTimeP50Ms = K(n, 50), o.requestTimeP95Ms = K(n, 95));
|
|
1628
1635
|
}
|
|
1629
|
-
typeof e.latencySeconds == "number" && typeof e.targetLatencySeconds == "number" && (
|
|
1636
|
+
typeof e.latencySeconds == "number" && typeof e.targetLatencySeconds == "number" && (o.driftMs = Math.round((e.latencySeconds - e.targetLatencySeconds) * 1e3)), typeof e.playbackRate == "number" && e.playbackRate > 0 && (o.playbackRate = e.playbackRate), e.qualityPinned === !0 && (o.qualityPinned = !0), e.cdnHost && (o.cdnHost = e.cdnHost), this.maybeEmitMediaInfo(e), this.enqueue({ heartbeat: o }), this.flush(), s > 0 && this.noteFirstBytes();
|
|
1630
1637
|
}
|
|
1631
1638
|
maybeEmitMediaInfo(e) {
|
|
1632
1639
|
if (!(e.videoCodec ?? e.keySystem ?? e.ladderHeights)) return;
|
|
@@ -1760,7 +1767,7 @@ async function mt() {
|
|
|
1760
1767
|
}
|
|
1761
1768
|
//#endregion
|
|
1762
1769
|
//#region src/core/version.ts
|
|
1763
|
-
var ht = "2.
|
|
1770
|
+
var ht = "2.5.0", J = {
|
|
1764
1771
|
accent: "#E1B600",
|
|
1765
1772
|
accentText: "#1B1C23",
|
|
1766
1773
|
background: "#0e0f13",
|
|
@@ -2082,11 +2089,11 @@ var St = class {
|
|
|
2082
2089
|
}
|
|
2083
2090
|
async toggleFullscreen() {
|
|
2084
2091
|
try {
|
|
2085
|
-
|
|
2092
|
+
C(this.video, this.root) ? await T(this.video, this.root) : await w(this.video, this.root);
|
|
2086
2093
|
} catch {}
|
|
2087
2094
|
}
|
|
2088
2095
|
syncFullscreen() {
|
|
2089
|
-
let e =
|
|
2096
|
+
let e = C(this.video, this.root);
|
|
2090
2097
|
this.setIcon(this.fsBtn, e ? "fullscreenExit" : "fullscreen"), this.fsBtn.setAttribute("aria-label", e ? "Exit fullscreen" : "Fullscreen");
|
|
2091
2098
|
}
|
|
2092
2099
|
poke() {
|
|
@@ -2230,7 +2237,7 @@ var Pt = class {
|
|
|
2230
2237
|
this.opts.muted && (this.opts.video.muted = !0), this.opts.poster && (this.opts.video.poster = this.opts.poster), this.mountControls(), this.attachPipListeners(), this.setState("loading");
|
|
2231
2238
|
let e = ++this.loadGen, t = this.resolveOptions();
|
|
2232
2239
|
try {
|
|
2233
|
-
let n = await
|
|
2240
|
+
let n = await v(t);
|
|
2234
2241
|
if (await this.onResolved(n, e), e === this.loadGen && this._state === "error" && this._lastError) {
|
|
2235
2242
|
let e = this._lastError;
|
|
2236
2243
|
throw this.destroy(), e;
|
|
@@ -2253,11 +2260,11 @@ var Pt = class {
|
|
|
2253
2260
|
};
|
|
2254
2261
|
}
|
|
2255
2262
|
beginArming(e, t, n = !1) {
|
|
2256
|
-
let r = this.opts.liveStateEvents === !1 ? void 0 : this.opts.eventsBaseUrl ??
|
|
2263
|
+
let r = this.opts.liveStateEvents === !1 ? void 0 : this.opts.eventsBaseUrl ?? D(this.opts.baseUrl);
|
|
2257
2264
|
r ? this.armWithSse(e, r, t, n) : this.beginArmingByPolling(e);
|
|
2258
2265
|
}
|
|
2259
2266
|
beginArmingByPolling(e) {
|
|
2260
|
-
|
|
2267
|
+
y({
|
|
2261
2268
|
...this.resolveOptions(),
|
|
2262
2269
|
signal: this.abort.signal,
|
|
2263
2270
|
waitForLive: this.buildWaitConfig(e)
|
|
@@ -2291,7 +2298,7 @@ var Pt = class {
|
|
|
2291
2298
|
}
|
|
2292
2299
|
}
|
|
2293
2300
|
}, h = () => {
|
|
2294
|
-
a || s || p() || (s = !0,
|
|
2301
|
+
a || s || p() || (s = !0, y({
|
|
2295
2302
|
...this.resolveOptions(),
|
|
2296
2303
|
signal: c.signal,
|
|
2297
2304
|
waitForLive: this.buildWaitConfig(e)
|
|
@@ -2299,7 +2306,7 @@ var Pt = class {
|
|
|
2299
2306
|
a || p() || c.signal.aborted || (a = !0, this.closeArming(), this.fail(e instanceof n ? e : new n("INTERNAL", 0, String(e))));
|
|
2300
2307
|
}));
|
|
2301
2308
|
}, g = () => {
|
|
2302
|
-
a || p() ||
|
|
2309
|
+
a || p() || v(this.resolveOptions()).then((e) => m(e)).catch((e) => {
|
|
2303
2310
|
if (!(a || p())) {
|
|
2304
2311
|
if (e instanceof n && o(e.code)) {
|
|
2305
2312
|
h();
|
|
@@ -2313,7 +2320,7 @@ var Pt = class {
|
|
|
2313
2320
|
!a && !p() && h();
|
|
2314
2321
|
}, e);
|
|
2315
2322
|
};
|
|
2316
|
-
_(Dt), this.armingSub =
|
|
2323
|
+
_(Dt), this.armingSub = E({
|
|
2317
2324
|
eventsBaseUrl: t,
|
|
2318
2325
|
matchUrn: this.opts.matchUrn,
|
|
2319
2326
|
credential: this.opts.credential,
|
|
@@ -2400,7 +2407,7 @@ var Pt = class {
|
|
|
2400
2407
|
video: this.opts.video,
|
|
2401
2408
|
descriptor: e,
|
|
2402
2409
|
credential: t,
|
|
2403
|
-
deviceId:
|
|
2410
|
+
deviceId: A(),
|
|
2404
2411
|
userId: this.opts.userId,
|
|
2405
2412
|
lowLatency: this.opts.lowLatency === void 0 || this.opts.lowLatency === "auto" || this.opts.lowLatency,
|
|
2406
2413
|
snapToLiveOnRefocus: this.opts.snapToLiveOnRefocus,
|
|
@@ -2441,11 +2448,11 @@ var Pt = class {
|
|
|
2441
2448
|
}
|
|
2442
2449
|
startLiveState(e) {
|
|
2443
2450
|
if (this.opts.liveStateEvents === !1) return;
|
|
2444
|
-
let t = this.opts.eventsBaseUrl ??
|
|
2451
|
+
let t = this.opts.eventsBaseUrl ?? D(this.opts.baseUrl);
|
|
2445
2452
|
if (!t) return;
|
|
2446
2453
|
this.closeLiveState();
|
|
2447
2454
|
let r = 0, i = !1;
|
|
2448
|
-
this.liveStateSub =
|
|
2455
|
+
this.liveStateSub = E({
|
|
2449
2456
|
eventsBaseUrl: t,
|
|
2450
2457
|
matchUrn: this.opts.matchUrn,
|
|
2451
2458
|
credential: this.opts.credential,
|
|
@@ -2476,7 +2483,7 @@ var Pt = class {
|
|
|
2476
2483
|
return this.opts.rejoinOnLive !== !1 && this.opts.liveStateEvents !== !1;
|
|
2477
2484
|
}
|
|
2478
2485
|
scheduleRejoin(e) {
|
|
2479
|
-
|
|
2486
|
+
this.rejoinEnabled() && !this.rejoinTimer && (this.rejoinTimer = setTimeout(() => {
|
|
2480
2487
|
this.rejoinTimer = null, !(this.destroyed || e !== this.loadGen || this._state !== "ended") && this.rejoin();
|
|
2481
2488
|
}, Math.random() * kt));
|
|
2482
2489
|
}
|
|
@@ -2545,15 +2552,15 @@ var Pt = class {
|
|
|
2545
2552
|
scheduleLicenseRefresh() {
|
|
2546
2553
|
this.stopRefresh();
|
|
2547
2554
|
let e = this.opts.licenseRefreshMs ?? Mt;
|
|
2548
|
-
|
|
2555
|
+
e && this._descriptor?.drmEnabled && (this.refreshTimer = setInterval(() => void this.refreshLicense(), e));
|
|
2549
2556
|
}
|
|
2550
2557
|
stopRefresh() {
|
|
2551
2558
|
this.refreshTimer && clearInterval(this.refreshTimer), this.refreshTimer = void 0;
|
|
2552
2559
|
}
|
|
2553
2560
|
async refreshLicense() {
|
|
2554
2561
|
let e = this.engine;
|
|
2555
|
-
if (!
|
|
2556
|
-
let t = await
|
|
2562
|
+
if (!this.destroyed && e) try {
|
|
2563
|
+
let t = await v(this.resolveOptions());
|
|
2557
2564
|
if (this.destroyed || this.engine !== e) return;
|
|
2558
2565
|
let n = t.drm?.widevine?.licenseUrl, r = t.drm?.fairplay?.licenseUrl;
|
|
2559
2566
|
(n || r) && (e.setLicenseUrls({
|
|
@@ -2625,10 +2632,10 @@ var Pt = class {
|
|
|
2625
2632
|
e.pictureInPictureElement === this.opts.video && typeof e.exitPictureInPicture == "function" && await e.exitPictureInPicture();
|
|
2626
2633
|
}
|
|
2627
2634
|
async enterFullscreen() {
|
|
2628
|
-
return !this.destroyed &&
|
|
2635
|
+
return !this.destroyed && w(this.opts.video, this.container ?? void 0);
|
|
2629
2636
|
}
|
|
2630
2637
|
async exitFullscreen() {
|
|
2631
|
-
await
|
|
2638
|
+
await T(this.opts.video, this.container ?? void 0);
|
|
2632
2639
|
}
|
|
2633
2640
|
retry() {
|
|
2634
2641
|
return this.reload();
|
|
@@ -2638,7 +2645,7 @@ var Pt = class {
|
|
|
2638
2645
|
let e = ++this.loadGen;
|
|
2639
2646
|
this.teardownPlayback();
|
|
2640
2647
|
try {
|
|
2641
|
-
let t = await
|
|
2648
|
+
let t = await y({
|
|
2642
2649
|
...this.resolveOptions(),
|
|
2643
2650
|
waitForLive: this.opts.waitForLive ? this.buildWaitConfig(e) : void 0
|
|
2644
2651
|
});
|
|
@@ -2906,7 +2913,7 @@ async function Rt() {
|
|
|
2906
2913
|
case "oddin:destroy": c();
|
|
2907
2914
|
}
|
|
2908
2915
|
}, u = (e) => {
|
|
2909
|
-
|
|
2916
|
+
r && e.origin === r && $(e.data) && l(e.data);
|
|
2910
2917
|
};
|
|
2911
2918
|
r && window.addEventListener("message", u), window.addEventListener("pagehide", c, { once: !0 }), await s(e.matchUrn), i({
|
|
2912
2919
|
type: "oddin:ready",
|
|
@@ -2925,6 +2932,6 @@ function Bt() {
|
|
|
2925
2932
|
e.textContent = "html,body{margin:0;height:100%;background:#000;overflow:hidden}body{display:flex}", document.head.appendChild(e);
|
|
2926
2933
|
}
|
|
2927
2934
|
//#endregion
|
|
2928
|
-
export { J as ODDIN_THEME, n as PlaybackError, X as applyTheme, Rt as bootEmbed,
|
|
2935
|
+
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, oe as pollToLive, y as resolveStream, E as subscribeLiveState, C as videoFullscreenActive, he as watchStatus };
|
|
2929
2936
|
|
|
2930
2937
|
//# sourceMappingURL=index.js.map
|