@vindral/web-sdk 4.8.0 → 4.8.1
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/{DN0QZ0Rd.js → ClhqVgMJ.js} +1 -1
- package/{Bf7Esc1M.js → DlCbtbuA.js} +497 -471
- package/api-client.d.ts +2 -2
- package/core.d.ts +6 -6
- package/core.js +1 -1
- package/legacy.d.ts +6 -6
- package/legacy.es.js +688 -660
- package/legacy.umd.js +16 -16
- package/package.json +1 -1
- package/player.d.ts +3 -3
- package/player.js +2 -2
- package/react.d.ts +3 -3
- package/vindral-player-component.js +2 -2
|
@@ -8410,72 +8410,86 @@ function Yv(e) {
|
|
|
8410
8410
|
s(Wv, this) !== void 0 && e - s(Wv, this) > Lv && (s(Gv, this) != null || a(Gv, this, e), a(Kv, this, e)), a(Wv, this, e);
|
|
8411
8411
|
}
|
|
8412
8412
|
//#endregion
|
|
8413
|
-
//#region ../../libs/web-sdk/src/adapters/
|
|
8414
|
-
var Xv =
|
|
8413
|
+
//#region ../../libs/web-sdk/src/adapters/EdgeClock.ts
|
|
8414
|
+
var Xv = /* @__PURE__ */ new WeakMap(), Zv = /* @__PURE__ */ new WeakMap(), Qv = /* @__PURE__ */ new WeakMap(), $v = /* @__PURE__ */ new WeakMap(), ey = class {
|
|
8415
|
+
constructor(e, t = () => performance.timeOrigin + performance.now()) {
|
|
8416
|
+
i(this, Xv, void 0), i(this, Zv, void 0), i(this, Qv, void 0), i(this, $v, 0), a(Xv, this, e), a(Zv, this, t);
|
|
8417
|
+
}
|
|
8418
|
+
sample(e, t) {
|
|
8419
|
+
var n;
|
|
8420
|
+
!Number.isFinite(e) || !Number.isFinite(t) || (a($v, this, (n = s(Xv, this).delayOf(e, t)) == null ? s($v, this) : n), a(Qv, this, {
|
|
8421
|
+
edgeTime: e + s($v, this),
|
|
8422
|
+
localTime: t
|
|
8423
|
+
}));
|
|
8424
|
+
}
|
|
8425
|
+
wallclock() {
|
|
8426
|
+
if (s(Qv, this)) return s(Qv, this).edgeTime + (s(Zv, this).call(this) - s(Qv, this).localTime);
|
|
8427
|
+
}
|
|
8428
|
+
}, ty = 3e5, ny = 3, ry = 1e4, iy = 1e3, ay = 250, oy = 200, sy = /* @__PURE__ */ new WeakMap(), cy = /* @__PURE__ */ new WeakMap(), ly = /* @__PURE__ */ new WeakMap(), uy = /* @__PURE__ */ new WeakMap(), dy = /* @__PURE__ */ new WeakMap(), fy = /* @__PURE__ */ new WeakMap(), py = /* @__PURE__ */ new WeakMap(), my = /* @__PURE__ */ new WeakMap(), hy = /* @__PURE__ */ new WeakSet(), gy = class {
|
|
8415
8429
|
constructor(e = () => performance.timeOrigin + performance.now()) {
|
|
8416
|
-
C(this,
|
|
8430
|
+
C(this, hy), i(this, sy, void 0), i(this, cy, []), i(this, ly, 0), i(this, uy, void 0), i(this, dy, void 0), i(this, fy, void 0), i(this, py, 0), i(this, my, []), a(sy, this, e);
|
|
8417
8431
|
}
|
|
8418
8432
|
sample(e, t) {
|
|
8419
8433
|
var n;
|
|
8420
8434
|
if (!Number.isFinite(e) || !Number.isFinite(t)) return;
|
|
8421
8435
|
let r = t - e;
|
|
8422
|
-
if (s(
|
|
8436
|
+
if (s(uy, this) !== void 0) {
|
|
8423
8437
|
var i, c;
|
|
8424
|
-
let t = e - s(
|
|
8425
|
-
t <
|
|
8438
|
+
let t = e - s(uy, this), n = s(my, this).length >= 2 && r < o(hy, this, _y).call(this) - iy && t > ((i = xy(s(my, this))) == null ? 0 : i) + iy, l = xy(s(my, this)), u = l === void 0 ? 0 : l - t;
|
|
8439
|
+
t < -iy || u > iy && r - ((c = s(fy, this)) == null ? r : c) > u - ay || n ? (a(cy, this, []), a(ly, this, 0), a(my, this, [])) : t >= oy && a(my, this, [...s(my, this).slice(-4), t]);
|
|
8426
8440
|
}
|
|
8427
|
-
a(
|
|
8441
|
+
a(uy, this, e), a(dy, this, t), a(fy, this, r), a(ly, this, (n = s(ly, this), n++, n)), a(cy, this, s(cy, this).filter((e) => e.arrivedAt > t - ty)), s(cy, this).push({
|
|
8428
8442
|
arrivedAt: t,
|
|
8429
8443
|
delay: r
|
|
8430
|
-
}), a(
|
|
8444
|
+
}), a(py, this, r - o(hy, this, _y).call(this));
|
|
8431
8445
|
}
|
|
8432
8446
|
sentSince(e) {
|
|
8433
|
-
return s(
|
|
8447
|
+
return s(uy, this) === void 0 || s(cy, this).length === 0 ? !1 : s(uy, this) + o(hy, this, _y).call(this) >= e;
|
|
8434
8448
|
}
|
|
8435
|
-
level(e = s(
|
|
8436
|
-
if (s(
|
|
8437
|
-
let t = o(
|
|
8438
|
-
if (!(t <= 0 && e - s(
|
|
8449
|
+
level(e = s(sy, this).call(this)) {
|
|
8450
|
+
if (s(ly, this) < ny || s(dy, this) === void 0) return;
|
|
8451
|
+
let t = o(hy, this, vy).call(this, e);
|
|
8452
|
+
if (!(t <= 0 && e - s(dy, this) > ry)) return Math.max(s(py, this), t);
|
|
8439
8453
|
}
|
|
8440
8454
|
delayOf(e, t) {
|
|
8441
|
-
if (!(this.level(t) === void 0 || !Number.isFinite(e))) return Math.max(0, t - e - o(
|
|
8455
|
+
if (!(this.level(t) === void 0 || !Number.isFinite(e))) return Math.max(0, t - e - o(hy, this, _y).call(this));
|
|
8442
8456
|
}
|
|
8443
|
-
peak(e, t = s(
|
|
8457
|
+
peak(e, t = s(sy, this).call(this)) {
|
|
8444
8458
|
var n;
|
|
8445
8459
|
return (n = this.summary(e, t)) == null ? void 0 : n.max;
|
|
8446
8460
|
}
|
|
8447
|
-
summary(e, t = s(
|
|
8461
|
+
summary(e, t = s(sy, this).call(this)) {
|
|
8448
8462
|
let n = this.level(t);
|
|
8449
8463
|
if (n === void 0) return;
|
|
8450
|
-
let r = o(
|
|
8451
|
-
return yt([...s(
|
|
8464
|
+
let r = o(hy, this, _y).call(this);
|
|
8465
|
+
return yt([...s(cy, this).filter((n) => n.arrivedAt >= t - e).map((e) => e.delay - r), n]);
|
|
8452
8466
|
}
|
|
8453
8467
|
};
|
|
8454
|
-
function
|
|
8455
|
-
return s(
|
|
8468
|
+
function _y() {
|
|
8469
|
+
return s(cy, this).reduce((e, t) => Math.min(e, t.delay), Infinity);
|
|
8456
8470
|
}
|
|
8457
|
-
function
|
|
8458
|
-
let t =
|
|
8459
|
-
return t === void 0 || s(
|
|
8471
|
+
function vy(e) {
|
|
8472
|
+
let t = xy(s(my, this));
|
|
8473
|
+
return t === void 0 || s(dy, this) === void 0 ? 0 : e - (s(dy, this) - s(py, this) + t);
|
|
8460
8474
|
}
|
|
8461
|
-
var
|
|
8462
|
-
let n = t.summary(
|
|
8475
|
+
var yy = 3e3, by = (e, t) => {
|
|
8476
|
+
let n = t.summary(yy);
|
|
8463
8477
|
n !== void 0 && e.debug("Link queue", {
|
|
8464
8478
|
levelMs: Math.round(n.last),
|
|
8465
8479
|
peak3sMs: Math.round(n.max)
|
|
8466
8480
|
});
|
|
8467
|
-
},
|
|
8481
|
+
}, xy = (e) => {
|
|
8468
8482
|
if (e.length === 0) return;
|
|
8469
8483
|
let t = [...e].sort((e, t) => e - t);
|
|
8470
8484
|
return t[Math.floor(t.length / 2)];
|
|
8471
8485
|
};
|
|
8472
8486
|
//#endregion
|
|
8473
8487
|
//#region ../../libs/web-sdk/src/adapters/MoqConnectionAdapter.ts
|
|
8474
|
-
function
|
|
8488
|
+
function Sy(e, t, n) {
|
|
8475
8489
|
let r = new URL("/voq/subscribe", e);
|
|
8476
8490
|
return r.searchParams.set("sessionId", t.sessionId), r.searchParams.set("clientId", t.clientId), r.searchParams.set("channelId", t.channelId), n && r.searchParams.set("authToken", n), r;
|
|
8477
8491
|
}
|
|
8478
|
-
function
|
|
8492
|
+
function Cy(e, t) {
|
|
8479
8493
|
let n = [];
|
|
8480
8494
|
for (let r of e == null ? [] : e) try {
|
|
8481
8495
|
n.push({
|
|
@@ -8490,78 +8504,78 @@ function vy(e, t) {
|
|
|
8490
8504
|
}
|
|
8491
8505
|
return n.length > 0 ? n : void 0;
|
|
8492
8506
|
}
|
|
8493
|
-
function
|
|
8507
|
+
function wy(e, t, n) {
|
|
8494
8508
|
return n !== void 0 && e.get("webtransportEnabled") && !e.get("unstableWebtransportEnabled") && !!self.WebTransport && t.protocol.startsWith("https") && Fe();
|
|
8495
8509
|
}
|
|
8496
|
-
var
|
|
8510
|
+
var Ty = 1e4, X = /* @__PURE__ */ new WeakMap(), Ey = /* @__PURE__ */ new WeakMap(), Dy = /* @__PURE__ */ new WeakMap(), Oy = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakMap(), ky = /* @__PURE__ */ new WeakMap(), Ay = /* @__PURE__ */ new WeakMap(), jy = /* @__PURE__ */ new WeakMap(), My = /* @__PURE__ */ new WeakMap(), Ny = /* @__PURE__ */ new WeakMap(), Py = /* @__PURE__ */ new WeakMap(), Fy = /* @__PURE__ */ new WeakMap(), Iy = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakSet(), Ly = /* @__PURE__ */ new WeakMap(), Ry = /* @__PURE__ */ new WeakMap(), zy = /* @__PURE__ */ new WeakMap(), By = /* @__PURE__ */ new WeakMap(), Vy = /* @__PURE__ */ new WeakMap(), Hy = /* @__PURE__ */ new WeakMap(), Uy = class r {
|
|
8497
8511
|
get estimatedBandwidth() {
|
|
8498
|
-
return s(
|
|
8512
|
+
return s(My, this);
|
|
8499
8513
|
}
|
|
8500
8514
|
unload() {
|
|
8501
|
-
s(X, this).off("send signal", s(
|
|
8515
|
+
s(X, this).off("send signal", s(Ry, this)), s(X, this).off("disconnect", this.disconnect), s(X, this).off("text track", s(Ly, this)), this.disconnect();
|
|
8502
8516
|
}
|
|
8503
8517
|
suspend() {}
|
|
8504
8518
|
unsuspend() {}
|
|
8505
8519
|
getStatistics() {
|
|
8506
|
-
let e = s(
|
|
8520
|
+
let e = s(Dy, this).transportType() === "webtransport" ? "moq" : "moq_ws";
|
|
8507
8521
|
return {
|
|
8508
|
-
edgeUrl: Pv(s(
|
|
8522
|
+
edgeUrl: Pv(s(Dy, this).url()),
|
|
8509
8523
|
connectionProtocol: e,
|
|
8510
|
-
transportSelectionReason: s(
|
|
8524
|
+
transportSelectionReason: s(Ny, this)
|
|
8511
8525
|
};
|
|
8512
8526
|
}
|
|
8513
|
-
constructor(t, r, c, l, u, d, f, p, h) {
|
|
8514
|
-
C(this, Q), i(this, X, void 0), i(this,
|
|
8527
|
+
constructor(t, r, c, l, u, d, f, p, h, g) {
|
|
8528
|
+
C(this, Q), i(this, X, void 0), i(this, Ey, void 0), i(this, Dy, void 0), i(this, Oy, "disconnected"), i(this, Z, void 0), i(this, ky, /* @__PURE__ */ new Map()), i(this, Ay, void 0), i(this, jy, void 0), i(this, My, void 0), i(this, Ny, void 0), i(this, Py, /* @__PURE__ */ new Map()), e(this, "linkQueue", void 0), i(this, Fy, void 0), i(this, Iy, void 0), e(this, "closedForBacklog", !1), i(this, Ly, (e) => {
|
|
8515
8529
|
if (!e) {
|
|
8516
8530
|
s(Z, this).setSubtitleTrack(void 0).catch(n);
|
|
8517
8531
|
return;
|
|
8518
8532
|
}
|
|
8519
|
-
let t = s(
|
|
8533
|
+
let t = s(ky, this).get(Dh(s(Z, this).namespace())), r = t == null ? void 0 : t.getTextTrack(e);
|
|
8520
8534
|
r && s(Z, this).setSubtitleTrack(r).catch(n);
|
|
8521
|
-
}), i(this,
|
|
8535
|
+
}), i(this, Ry, (e) => {
|
|
8522
8536
|
switch (e.type) {
|
|
8523
8537
|
case "subscribe":
|
|
8524
8538
|
{
|
|
8525
|
-
if (s(
|
|
8526
|
-
let t = s(
|
|
8539
|
+
if (s(zy, this)) return;
|
|
8540
|
+
let t = s(Vy, this);
|
|
8527
8541
|
if (t) {
|
|
8528
8542
|
if (Av(t, e.subscription)) {
|
|
8529
|
-
a(
|
|
8543
|
+
a(By, this, void 0);
|
|
8530
8544
|
return;
|
|
8531
8545
|
}
|
|
8532
|
-
s(
|
|
8546
|
+
s(Ey, this).info("Queueing - we are already switching"), a(By, this, e.subscription);
|
|
8533
8547
|
return;
|
|
8534
8548
|
}
|
|
8535
|
-
o(Q, this,
|
|
8549
|
+
o(Q, this, Ky).call(this, e.subscription);
|
|
8536
8550
|
}
|
|
8537
8551
|
break;
|
|
8538
8552
|
case "telemetry":
|
|
8539
|
-
m(new URL("/api/telemetry", s(
|
|
8553
|
+
m(new URL("/api/telemetry", s(Dy, this).url().replace("wss://", "https://")), {
|
|
8540
8554
|
body: e.body,
|
|
8541
8555
|
headers: { "Content-Type": "text/plain" }
|
|
8542
8556
|
}).catch(n);
|
|
8543
8557
|
break;
|
|
8544
8558
|
case "refresh auth":
|
|
8545
|
-
s(
|
|
8559
|
+
s(Dy, this).updateAuthToken(e.token);
|
|
8546
8560
|
break;
|
|
8547
8561
|
}
|
|
8548
|
-
}), i(this,
|
|
8562
|
+
}), i(this, zy, !1), i(this, By, void 0), i(this, Vy, void 0), e(this, "disconnect", (e = "Disconnect Requested") => {
|
|
8549
8563
|
var t;
|
|
8550
|
-
s(
|
|
8551
|
-
}), i(this,
|
|
8552
|
-
o(Q, this,
|
|
8553
|
-
}), a(X, this, t), a(
|
|
8564
|
+
s(Ey, this).info("Disconnecting", e), (t = s(Iy, this)) == null || t.stop(), o(Q, this, Gy).call(this), s(Dy, this).close(), s(Z, this).close().catch(n), a(Py, this, /* @__PURE__ */ new Map()), o(Q, this, Yy).call(this, "disconnected");
|
|
8565
|
+
}), i(this, Hy, (e) => {
|
|
8566
|
+
o(Q, this, Gy).call(this), this.closedForBacklog = !0, s(Ey, this).info("Link queue over the breaker, reconnecting", { levelMs: Math.round(e) }), s(Dy, this).close(), s(X, this).emit("ping timeout");
|
|
8567
|
+
}), a(X, this, t), a(Ey, this, r), a(Dy, this, c), a(Z, this, l), a(ky, this, u), a(Ay, this, d), a(jy, this, f), a(Ny, this, p), this.linkQueue = h, a(Fy, this, g), s(X, this).on("send signal", s(Ry, this)), s(X, this).on("disconnect", this.disconnect), s(X, this).on("text track", s(Ly, this)), o(Q, this, Wy).call(this).catch(n), o(Q, this, Xy).call(this).catch(n), h && (a(Iy, this, new Jv(h, () => s(Oy, this) === "connected", s(Hy, this))), s(Iy, this).start());
|
|
8554
8568
|
}
|
|
8555
8569
|
static start(e, n, i, a, o) {
|
|
8556
8570
|
return t(function* () {
|
|
8557
8571
|
var t, c, l, u, f;
|
|
8558
|
-
let p = new Map(a.connectInfo.channels.map((e) => [Dh(e.catalog.namespace), new
|
|
8572
|
+
let p = new Map(a.connectInfo.channels.map((e) => [Dh(e.catalog.namespace), new rb(new Wt(e.catalog))])), m = yield a.onConnectInfo(a.connectInfo), h = a.options.get("authenticationToken"), g, _, v;
|
|
8559
8573
|
switch (typeof a.edgeUrl) {
|
|
8560
8574
|
case "string":
|
|
8561
|
-
g =
|
|
8575
|
+
g = Sy(a.edgeUrl, m, h);
|
|
8562
8576
|
break;
|
|
8563
8577
|
default:
|
|
8564
|
-
g =
|
|
8578
|
+
g = Sy(a.edgeUrl.moqUrl || a.edgeUrl.moqWsUrl, m, h), _ = Sy(a.edgeUrl.moqWsUrl, m, h), v = Cy(a.edgeUrl.serverCertificateHashes, n);
|
|
8565
8579
|
break;
|
|
8566
8580
|
}
|
|
8567
8581
|
let y = (t = a.connectInfo.channels.find((e) => e.channelId === m.channelId)) == null ? void 0 : t.catalog;
|
|
@@ -8569,7 +8583,7 @@ var by = 1e4, X = /* @__PURE__ */ new WeakMap(), xy = /* @__PURE__ */ new WeakMa
|
|
|
8569
8583
|
edgeUrl: g,
|
|
8570
8584
|
edgeWsUrl: _
|
|
8571
8585
|
}), d(y, "no catalog found");
|
|
8572
|
-
let b = (c = p.get(Dh(y.namespace))) == null ? void 0 : c.getVideoTrack(m.video), ee = (l = p.get(Dh(y.namespace))) == null ? void 0 : l.getAudioTrack(m.audio), te =
|
|
8586
|
+
let b = (c = p.get(Dh(y.namespace))) == null ? void 0 : c.getVideoTrack(m.video), ee = (l = p.get(Dh(y.namespace))) == null ? void 0 : l.getAudioTrack(m.audio), te = wy(a.options, g, _), x;
|
|
8573
8587
|
try {
|
|
8574
8588
|
x = yield yh({
|
|
8575
8589
|
url: g,
|
|
@@ -8588,58 +8602,59 @@ var by = 1e4, X = /* @__PURE__ */ new WeakMap(), xy = /* @__PURE__ */ new WeakMa
|
|
|
8588
8602
|
(u = a.onTransportConnected) == null || u.call(a);
|
|
8589
8603
|
let re = S.closed().then((e) => {
|
|
8590
8604
|
throw e instanceof Error ? e : Error(e ? `Session closed before player started: ${String(e)}` : "Session closed before player started");
|
|
8591
|
-
}), C = S.transportType() === "websocket" ? new
|
|
8605
|
+
}), C = S.transportType() === "websocket" ? new gy() : void 0, ie = C == null ? new gy() : C, w = new ey(ie), ae, oe;
|
|
8592
8606
|
try {
|
|
8593
|
-
|
|
8607
|
+
oe = yield Promise.race([
|
|
8594
8608
|
bv.start(S.subscriber, {
|
|
8595
8609
|
namespace: y.namespace,
|
|
8596
8610
|
catalog: y,
|
|
8597
8611
|
videoTrack: b == null ? void 0 : b.track,
|
|
8598
8612
|
audioTrack: ee == null ? void 0 : ee.track,
|
|
8599
8613
|
burstMs: m.burstMs || 0,
|
|
8600
|
-
onStats:
|
|
8601
|
-
|
|
8602
|
-
|
|
8614
|
+
onStats: (e, t) => {
|
|
8615
|
+
let r = performance.timeOrigin + t;
|
|
8616
|
+
ie.sample(e.ntpTimestamp, r), w.sample(e.ntpTimestamp, r), C && (by(n, C), ae == null || ae());
|
|
8617
|
+
}
|
|
8603
8618
|
}),
|
|
8604
|
-
ln(
|
|
8619
|
+
ln(Ty, /* @__PURE__ */ Error("Timeout waiting for player to start")),
|
|
8605
8620
|
re
|
|
8606
8621
|
]);
|
|
8607
8622
|
} catch (e) {
|
|
8608
8623
|
throw S.close(), e;
|
|
8609
8624
|
}
|
|
8610
|
-
let
|
|
8611
|
-
p.set(Dh(y.namespace),
|
|
8625
|
+
let se = new rb(oe.catalog());
|
|
8626
|
+
p.set(Dh(y.namespace), se), e.emit("received signal", {
|
|
8612
8627
|
type: "client ip",
|
|
8613
|
-
ip:
|
|
8614
|
-
}),
|
|
8628
|
+
ip: oe.connectionInfo().ip
|
|
8629
|
+
}), oe.drm().then((t) => {
|
|
8615
8630
|
t && e.emit("received drm data", t.value);
|
|
8616
8631
|
}).catch((e) => {
|
|
8617
8632
|
n.error("Error getting DRM data", e);
|
|
8618
8633
|
});
|
|
8619
|
-
let
|
|
8620
|
-
return
|
|
8634
|
+
let ce = new r(e, n, S, oe, p, i, o, ne, C, w);
|
|
8635
|
+
return ae = (f = s(Iy, ce)) == null ? void 0 : f.check, m.textTrack && s(Ly, ce).call(ce, m.textTrack), ce;
|
|
8621
8636
|
})();
|
|
8622
8637
|
}
|
|
8623
8638
|
getState() {
|
|
8624
|
-
return s(
|
|
8639
|
+
return s(Oy, this);
|
|
8625
8640
|
}
|
|
8626
8641
|
close() {
|
|
8627
8642
|
var e;
|
|
8628
|
-
(e = s(
|
|
8643
|
+
(e = s(Iy, this)) == null || e.stop(), o(Q, this, Gy).call(this), s(Dy, this).close();
|
|
8629
8644
|
}
|
|
8630
8645
|
closed() {
|
|
8631
|
-
return Promise.race([s(
|
|
8646
|
+
return Promise.race([s(Dy, this).closed(), s(Z, this).closed()]);
|
|
8632
8647
|
}
|
|
8633
8648
|
};
|
|
8634
|
-
function
|
|
8649
|
+
function Wy() {
|
|
8635
8650
|
var e = this;
|
|
8636
8651
|
return t(function* () {
|
|
8637
|
-
s(
|
|
8652
|
+
s(Dy, e).transportType() === "websocket" && (yield cn(5e3));
|
|
8638
8653
|
var t = !1, n = !1, r;
|
|
8639
8654
|
try {
|
|
8640
8655
|
for (var i = H(s(Z, e).stats()), o; t = !(o = yield i.next()).done; t = !1) {
|
|
8641
8656
|
let { rtt: t, estimatedBandwidth: n } = o.value;
|
|
8642
|
-
a(
|
|
8657
|
+
a(My, e, n), s(jy, e).push(t), s(X, e).emit("rtt", gt(s(jy, e).items()));
|
|
8643
8658
|
}
|
|
8644
8659
|
} catch (e) {
|
|
8645
8660
|
n = !0, r = e;
|
|
@@ -8652,45 +8667,45 @@ function Ry() {
|
|
|
8652
8667
|
}
|
|
8653
8668
|
})();
|
|
8654
8669
|
}
|
|
8655
|
-
function
|
|
8656
|
-
a(
|
|
8670
|
+
function Gy() {
|
|
8671
|
+
a(zy, this, !0), a(By, this, void 0);
|
|
8657
8672
|
}
|
|
8658
|
-
function
|
|
8659
|
-
a(
|
|
8660
|
-
if (s(
|
|
8661
|
-
s(
|
|
8662
|
-
let n = s(
|
|
8663
|
-
a(
|
|
8673
|
+
function Ky(e) {
|
|
8674
|
+
a(Vy, this, e), o(Q, this, Jy).call(this, e).catch((t) => {
|
|
8675
|
+
if (s(zy, this)) return;
|
|
8676
|
+
s(Ey, this).error("error handling subscription", t);
|
|
8677
|
+
let n = s(By, this);
|
|
8678
|
+
a(By, this, void 0), s(X, this).emit("received signal", {
|
|
8664
8679
|
type: "subscription changed",
|
|
8665
8680
|
subscription: n == null ? e : n,
|
|
8666
8681
|
reset: !0
|
|
8667
8682
|
});
|
|
8668
8683
|
}).finally(() => {
|
|
8669
|
-
a(
|
|
8670
|
-
let e = s(
|
|
8671
|
-
a(
|
|
8684
|
+
a(Vy, this, void 0);
|
|
8685
|
+
let e = s(By, this);
|
|
8686
|
+
a(By, this, void 0), e && !s(zy, this) && o(Q, this, Ky).call(this, e);
|
|
8672
8687
|
});
|
|
8673
8688
|
}
|
|
8674
|
-
function
|
|
8689
|
+
function qy(e) {
|
|
8675
8690
|
var n = this;
|
|
8676
8691
|
return t(function* () {
|
|
8677
8692
|
var t;
|
|
8678
|
-
let r = yield s(
|
|
8693
|
+
let r = yield s(Ay, n).connect({ channelId: e });
|
|
8679
8694
|
if (!c(r)) throw Error("no moq connect info found");
|
|
8680
8695
|
let i = (t = r.channels.find((t) => t.channelId === e)) == null ? void 0 : t.catalog;
|
|
8681
8696
|
if (!i) throw Error("no catalog found");
|
|
8682
8697
|
return i;
|
|
8683
8698
|
})();
|
|
8684
8699
|
}
|
|
8685
|
-
function
|
|
8700
|
+
function Jy(e) {
|
|
8686
8701
|
var n = this;
|
|
8687
8702
|
return t(function* () {
|
|
8688
8703
|
var t, r;
|
|
8689
|
-
s(
|
|
8690
|
-
let i = s(Z, n), a = s(
|
|
8691
|
-
if (a || (a = new
|
|
8704
|
+
s(Ey, n).info("handle subscription", e);
|
|
8705
|
+
let i = s(Z, n), a = s(ky, n).get(e.channelId);
|
|
8706
|
+
if (a || (a = new rb(new Wt(yield o(Q, n, qy).call(n, e.channelId))), s(ky, n).set(e.channelId, a)), i.namespace().join("/") !== a.namespace().join("/")) {
|
|
8692
8707
|
var c;
|
|
8693
|
-
s(
|
|
8708
|
+
s(Ey, n).info("changing channel", e.channelId);
|
|
8694
8709
|
let t = a.getVideoTrack(e.video), r = a.getAudioTrack(e.audio);
|
|
8695
8710
|
if (yield i.zap({
|
|
8696
8711
|
namespace: a.namespace(),
|
|
@@ -8700,8 +8715,8 @@ function Hy(e) {
|
|
|
8700
8715
|
}, 500), i.drm().then((e) => {
|
|
8701
8716
|
e && s(X, n).emit("received drm data", e.value);
|
|
8702
8717
|
}).catch((e) => {
|
|
8703
|
-
s(
|
|
8704
|
-
}), s(
|
|
8718
|
+
s(Ey, n).error("Error getting DRM data", e);
|
|
8719
|
+
}), s(Ey, n).info("switched channel", e.channelId), (c = s(ky, n).get(Dh(i.namespace()))) == null || c.updateCatalog(i.catalog()), s(zy, n)) return;
|
|
8705
8720
|
s(X, n).emit("received signal", {
|
|
8706
8721
|
type: "subscription changed",
|
|
8707
8722
|
subscription: e
|
|
@@ -8709,32 +8724,32 @@ function Hy(e) {
|
|
|
8709
8724
|
return;
|
|
8710
8725
|
}
|
|
8711
8726
|
let l = a.getVideoTrack(e.video), u = a.getAudioTrack(e.audio);
|
|
8712
|
-
yield Promise.all([l && l.track.name !== ((t = s(Z, n).videoTrack()) == null ? void 0 : t.name) ? s(Z, n).setVideoTrack(l.track) : void 0, u && u.track.name !== ((r = s(Z, n).audioTrack()) == null ? void 0 : r.name) ? s(Z, n).setAudioTrack(u.track) : void 0]), !s(
|
|
8727
|
+
yield Promise.all([l && l.track.name !== ((t = s(Z, n).videoTrack()) == null ? void 0 : t.name) ? s(Z, n).setVideoTrack(l.track) : void 0, u && u.track.name !== ((r = s(Z, n).audioTrack()) == null ? void 0 : r.name) ? s(Z, n).setAudioTrack(u.track) : void 0]), !s(zy, n) && s(X, n).emit("received signal", {
|
|
8713
8728
|
type: "subscription changed",
|
|
8714
8729
|
subscription: e
|
|
8715
8730
|
});
|
|
8716
8731
|
})();
|
|
8717
8732
|
}
|
|
8718
|
-
function
|
|
8719
|
-
a(
|
|
8733
|
+
function Yy(e) {
|
|
8734
|
+
a(Oy, this, e), s(X, this).emit("connection state", e);
|
|
8720
8735
|
}
|
|
8721
|
-
function
|
|
8736
|
+
function Xy() {
|
|
8722
8737
|
var e = this;
|
|
8723
8738
|
return t(function* () {
|
|
8724
8739
|
try {
|
|
8725
|
-
o(Q, e,
|
|
8726
|
-
o(Q, e,
|
|
8727
|
-
o(Q, e,
|
|
8728
|
-
o(Q, e,
|
|
8729
|
-
]), yield s(Z, e).closed(), s(
|
|
8740
|
+
o(Q, e, Yy).call(e, "connecting"), s(Ey, e).info("Connecting..."), o(Q, e, Yy).call(e, "connected"), yield Promise.all([
|
|
8741
|
+
o(Q, e, Qy).call(e, s(Z, e).referenceClock(), s(Z, e).audio),
|
|
8742
|
+
o(Q, e, Qy).call(e, s(Z, e).referenceClock(), s(Z, e).video),
|
|
8743
|
+
o(Q, e, Zy).call(e, s(Z, e).subtitles)
|
|
8744
|
+
]), yield s(Z, e).closed(), s(Dy, e).close(), s(Ey, e).info("Session closed");
|
|
8730
8745
|
} catch (t) {
|
|
8731
|
-
s(
|
|
8746
|
+
s(Ey, e).warn("Session error", t), s(Dy, e).close();
|
|
8732
8747
|
} finally {
|
|
8733
|
-
o(Q, e,
|
|
8748
|
+
o(Q, e, Yy).call(e, "disconnected");
|
|
8734
8749
|
}
|
|
8735
8750
|
})();
|
|
8736
8751
|
}
|
|
8737
|
-
function
|
|
8752
|
+
function Zy(e) {
|
|
8738
8753
|
var n = this;
|
|
8739
8754
|
return t(function* () {
|
|
8740
8755
|
var t = !1, r = !1, i;
|
|
@@ -8754,7 +8769,7 @@ function Gy(e) {
|
|
|
8754
8769
|
}
|
|
8755
8770
|
})();
|
|
8756
8771
|
}
|
|
8757
|
-
function
|
|
8772
|
+
function Qy(e, n) {
|
|
8758
8773
|
var r = this;
|
|
8759
8774
|
return t(function* () {
|
|
8760
8775
|
let t = "", i = "", a, o = s(Z, r).videoTrack() === void 0;
|
|
@@ -8767,25 +8782,26 @@ function Ky(e, n) {
|
|
|
8767
8782
|
let c = Dh(n.track.namespace), l = n.track.trackObject.language, u = p((m = n.track.trackObject.codec) == null ? "" : m), d = n.track.trackObject.codec, f = u ? fn({
|
|
8768
8783
|
codec: u,
|
|
8769
8784
|
codecString: d
|
|
8770
|
-
}) : void 0,
|
|
8785
|
+
}) : void 0, te = !!n.track.trackObject["com.vindral.drm"];
|
|
8771
8786
|
var h = !1, g = !1, _;
|
|
8772
8787
|
try {
|
|
8773
8788
|
for (var v = H(n), y; h = !(y = yield v.next()).done; h = !1) {
|
|
8774
8789
|
let [p, m] = y.value;
|
|
8775
8790
|
{
|
|
8776
8791
|
var b;
|
|
8777
|
-
(b = s(
|
|
8792
|
+
(b = s(Iy, r)) == null || b.alive();
|
|
8778
8793
|
let h = {
|
|
8779
8794
|
channelId: t !== "" && (o || m.mediaType() === "video") && t !== c ? c : void 0,
|
|
8780
8795
|
language: m.mediaType() === "audio" && i !== l ? l : void 0,
|
|
8781
|
-
drmTransition: a !== void 0 && a !==
|
|
8796
|
+
drmTransition: a !== void 0 && a !== te
|
|
8782
8797
|
};
|
|
8783
|
-
t = c, i = l, a =
|
|
8784
|
-
let g = m.producerReferenceTime(), _ = s(
|
|
8798
|
+
t = c, i = l, a = te;
|
|
8799
|
+
let g = m.producerReferenceTime(), _ = s(Py, r).get(n.track.namespace), v = performance.now();
|
|
8785
8800
|
if (g && (_ === void 0 || v - _ > 1e3)) {
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
s(
|
|
8801
|
+
var ee;
|
|
8802
|
+
s(Py, r).set(n.track.namespace, v);
|
|
8803
|
+
let t = ((ee = s(Fy, r).wallclock()) == null ? e.wallclock() : ee) - g.getTime();
|
|
8804
|
+
s(Ey, r).debug("timing-info", {
|
|
8789
8805
|
mediaType: m.mediaType(),
|
|
8790
8806
|
referenceClock: e,
|
|
8791
8807
|
delta: t,
|
|
@@ -8809,7 +8825,7 @@ function Ky(e, n) {
|
|
|
8809
8825
|
codec: u,
|
|
8810
8826
|
codecString: d,
|
|
8811
8827
|
switchInfo: h,
|
|
8812
|
-
renditionId:
|
|
8828
|
+
renditionId: $y(n.track.trackObject.name)
|
|
8813
8829
|
});
|
|
8814
8830
|
}
|
|
8815
8831
|
}
|
|
@@ -8835,48 +8851,48 @@ function Ky(e, n) {
|
|
|
8835
8851
|
}
|
|
8836
8852
|
})();
|
|
8837
8853
|
}
|
|
8838
|
-
function
|
|
8854
|
+
function $y(e) {
|
|
8839
8855
|
return e.split("").reduce((e, t) => e = t.charCodeAt(0) + (e << 6) + (e << 16) - e, 0);
|
|
8840
8856
|
}
|
|
8841
|
-
var
|
|
8857
|
+
var eb = /* @__PURE__ */ new WeakMap(), tb = /* @__PURE__ */ new WeakMap(), nb = /* @__PURE__ */ new WeakSet(), rb = class {
|
|
8842
8858
|
constructor(e) {
|
|
8843
|
-
C(this,
|
|
8859
|
+
C(this, nb), i(this, eb, void 0), i(this, tb, void 0), a(eb, this, e), a(tb, this, o(nb, this, ib).call(this));
|
|
8844
8860
|
}
|
|
8845
8861
|
catalog() {
|
|
8846
|
-
return s(
|
|
8862
|
+
return s(eb, this).current();
|
|
8847
8863
|
}
|
|
8848
8864
|
namespace() {
|
|
8849
|
-
return s(
|
|
8865
|
+
return s(eb, this).current().namespace;
|
|
8850
8866
|
}
|
|
8851
8867
|
updateCatalog(e) {
|
|
8852
|
-
a(
|
|
8868
|
+
a(eb, this, e);
|
|
8853
8869
|
}
|
|
8854
8870
|
getTextTrack(e) {
|
|
8855
|
-
return s(
|
|
8871
|
+
return s(eb, this).current().tracks.find((t) => t.label === e);
|
|
8856
8872
|
}
|
|
8857
8873
|
getAudioTrack(e) {
|
|
8858
8874
|
if (!e.codec) return;
|
|
8859
|
-
let t = s(
|
|
8875
|
+
let t = s(tb, this).filter((t) => !(!dn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec || e.language && t.language !== e.language));
|
|
8860
8876
|
return t[t.length - 1];
|
|
8861
8877
|
}
|
|
8862
8878
|
getVideoTrack(e) {
|
|
8863
8879
|
if (!e.codec) return;
|
|
8864
|
-
let t = s(
|
|
8880
|
+
let t = s(tb, this).filter((t) => !(!un(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec));
|
|
8865
8881
|
return t[t.length - 1];
|
|
8866
8882
|
}
|
|
8867
8883
|
renditions() {
|
|
8868
|
-
return s(
|
|
8884
|
+
return s(tb, this);
|
|
8869
8885
|
}
|
|
8870
8886
|
};
|
|
8871
|
-
function
|
|
8872
|
-
let [e, t] = s(
|
|
8887
|
+
function ib() {
|
|
8888
|
+
let [e, t] = s(eb, this).value();
|
|
8873
8889
|
return u(e);
|
|
8874
8890
|
}
|
|
8875
8891
|
//#endregion
|
|
8876
8892
|
//#region ../../libs/web-sdk/src/transports/WebSocket.ts
|
|
8877
|
-
var
|
|
8893
|
+
var ab = /* @__PURE__ */ function(e) {
|
|
8878
8894
|
return e[e.AuthenticationFailed = 4e3] = "AuthenticationFailed", e[e.AuthenticationRefreshFailed = 4001] = "AuthenticationRefreshFailed", e[e.AuthenticationExpired = 4002] = "AuthenticationExpired", e[e.ChannelNotFound = 4003] = "ChannelNotFound", e[e.Inactivity = 4010] = "Inactivity", e;
|
|
8879
|
-
}({}),
|
|
8895
|
+
}({}), ob = class extends ne {
|
|
8880
8896
|
constructor(r, i) {
|
|
8881
8897
|
var a;
|
|
8882
8898
|
super(), a = this, e(this, "options", void 0), e(this, "websocket", void 0), e(this, "logger", void 0), e(this, "reconnectState", { reconnectRetries: 0 }), e(this, "isSuspended", !1), e(this, "_connectionAttemptCount", 0), e(this, "connectStartTime", 0), e(this, "_connectTime", void 0), e(this, "connectTimeout", void 0), e(this, "shouldContinueConnecting", !1), e(this, "_isConnectInProgress", !1), e(this, "readyState", () => {
|
|
@@ -8914,19 +8930,19 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
8914
8930
|
})), this.close("websocket was closed");
|
|
8915
8931
|
let n;
|
|
8916
8932
|
switch (e.code) {
|
|
8917
|
-
case
|
|
8933
|
+
case ab.AuthenticationFailed:
|
|
8918
8934
|
n = Kn(Gn());
|
|
8919
8935
|
break;
|
|
8920
|
-
case
|
|
8936
|
+
case ab.AuthenticationRefreshFailed:
|
|
8921
8937
|
n = Kn(Gn());
|
|
8922
8938
|
break;
|
|
8923
|
-
case
|
|
8939
|
+
case ab.AuthenticationExpired:
|
|
8924
8940
|
n = qn(Gn());
|
|
8925
8941
|
break;
|
|
8926
|
-
case
|
|
8942
|
+
case ab.ChannelNotFound:
|
|
8927
8943
|
n = Yn("internal", Gn());
|
|
8928
8944
|
break;
|
|
8929
|
-
case
|
|
8945
|
+
case ab.Inactivity:
|
|
8930
8946
|
n = Jn("internal", Gn());
|
|
8931
8947
|
break;
|
|
8932
8948
|
default: t && (n = Qn(/* @__PURE__ */ Error("WebSocket closed before open")));
|
|
@@ -8977,13 +8993,13 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
8977
8993
|
get connectTime() {
|
|
8978
8994
|
return this._connectTime;
|
|
8979
8995
|
}
|
|
8980
|
-
},
|
|
8981
|
-
let t = e ||
|
|
8982
|
-
return
|
|
8983
|
-
},
|
|
8996
|
+
}, sb, cb = 65536 * 8, lb = .9, ub = 40, db = (e) => {
|
|
8997
|
+
let t = e || ub;
|
|
8998
|
+
return cb * lb * 1e3 / t;
|
|
8999
|
+
}, fb = class r {
|
|
8984
9000
|
constructor(i, a, o, s) {
|
|
8985
9001
|
var c = this;
|
|
8986
|
-
e(this, "emitter", void 0), e(this, "transport", void 0), e(this, "logger", void 0), e(this, "config", void 0), e(this, "rtts", void 0), e(this, "lastPingSentTime", performance.now()), e(this, "isPingInFlight", !1), e(this, "connectCount", 0), e(this, "missedPings", 0), e(this, "closedForBacklog", !1), e(this, "isContextSwitchInProgress", !1), e(this, "signalBuffer", []), e(this, "dataBuffer", []), e(this, "disconnected", new w()), e(this, "linkQueue", new
|
|
9002
|
+
e(this, "emitter", void 0), e(this, "transport", void 0), e(this, "logger", void 0), e(this, "config", void 0), e(this, "rtts", void 0), e(this, "lastPingSentTime", performance.now()), e(this, "isPingInFlight", !1), e(this, "lastSignalSentTime", performance.now()), e(this, "connectCount", 0), e(this, "missedPings", 0), e(this, "closedForBacklog", !1), e(this, "isContextSwitchInProgress", !1), e(this, "signalBuffer", []), e(this, "dataBuffer", []), e(this, "disconnected", new w()), e(this, "linkQueue", new gy()), e(this, "clockCorrection", 0), e(this, "backlogBreaker", new Jv(this.linkQueue, () => this.getState() === "connected", (e) => {
|
|
8987
9003
|
this.logger.info("Link queue over the breaker, reconnecting", { levelMs: Math.round(e) }), this.closeForBacklog("link queue over the breaker");
|
|
8988
9004
|
})), e(this, "unload", () => {
|
|
8989
9005
|
this.logger.debug("Unloading module..."), this.close("Unloading"), this.emitter.off("send signal", this.sendSignal), this.emitter.off("disconnect", this.close), this.emitter.off("reconnect", this.reconnect), this.logger.debug("Unloaded module");
|
|
@@ -9002,7 +9018,7 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9002
9018
|
this.logger.debug("transport is closed");
|
|
9003
9019
|
return;
|
|
9004
9020
|
}
|
|
9005
|
-
this.transport.send(JSON.stringify(e));
|
|
9021
|
+
this.transport.send(JSON.stringify(e)), this.lastSignalSentTime = performance.now();
|
|
9006
9022
|
}), e(this, "getStatistics", () => ({
|
|
9007
9023
|
edgeUrl: Pv(this.config.edgeUrl),
|
|
9008
9024
|
connectionProtocol: "vindral_ws",
|
|
@@ -9059,7 +9075,10 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9059
9075
|
if (!hn(t)) return;
|
|
9060
9076
|
switch (t.type) {
|
|
9061
9077
|
case "pong":
|
|
9062
|
-
|
|
9078
|
+
if (this.lastPingSentTime) {
|
|
9079
|
+
let e = performance.now() - this.lastPingSentTime;
|
|
9080
|
+
this.isPingInFlight = !1, e < r.PING_INTERVAL && (this.rtts.push(e), this.emitter.emit("rtt", gt(this.rtts.items())));
|
|
9081
|
+
}
|
|
9063
9082
|
break;
|
|
9064
9083
|
case "context switch":
|
|
9065
9084
|
this.logger.info("Starting context switch"), this.emitter.emit("context switch started"), this.isContextSwitchInProgress = !0;
|
|
@@ -9070,7 +9089,7 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9070
9089
|
}
|
|
9071
9090
|
}
|
|
9072
9091
|
}), e(this, "connectWebSocketTransport", () => {
|
|
9073
|
-
let e = new
|
|
9092
|
+
let e = new ob({
|
|
9074
9093
|
reconnectDelay: 1e3,
|
|
9075
9094
|
onMessage: this.onMessage,
|
|
9076
9095
|
reconnectHandler: this.config.reconnectHandler,
|
|
@@ -9094,7 +9113,7 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9094
9113
|
}), e(this, "closeUnlessConnecting", (e) => this.transport.isConnectInProgress ? (this.logger.debug("Stopping reconnect, already mid-connection"), !1) : (this.close(e), !0)), e(this, "sampleLinkQueue", (e) => {
|
|
9095
9114
|
if (this.isContextSwitchInProgress || !e.includes("\"timing info\"")) return !1;
|
|
9096
9115
|
let t = JSON.parse(e);
|
|
9097
|
-
return !hn(t) || t.type !== "timing info" ? !1 : (this.linkQueue.sample(t.timingInfo.wallclockTime, performance.timeOrigin + performance.now()),
|
|
9116
|
+
return !hn(t) || t.type !== "timing info" ? !1 : (this.linkQueue.sample(t.timingInfo.wallclockTime, performance.timeOrigin + performance.now()), by(this.logger, this.linkQueue), !0);
|
|
9098
9117
|
}), e(this, "correctTimingInfo", (e) => {
|
|
9099
9118
|
var t;
|
|
9100
9119
|
if (!e.includes("\"timing info\"")) return e;
|
|
@@ -9108,8 +9127,15 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9108
9127
|
this.missedPings = 0, this.isPingInFlight = !1;
|
|
9109
9128
|
}), e(this, "pingCooldownExpired", () => performance.now() - this.lastPingSentTime > r.PING_INTERVAL), e(this, "sendPing", () => {
|
|
9110
9129
|
if (this.isPingInFlight) {
|
|
9111
|
-
this.missedPings++, this.
|
|
9112
|
-
|
|
9130
|
+
if (this.missedPings++, this.linkQueue.level() === void 0) {
|
|
9131
|
+
this.missedPings > r.MAX_MISSED_PINGS && this.closeForBacklog("missed pings");
|
|
9132
|
+
return;
|
|
9133
|
+
}
|
|
9134
|
+
let e = performance.now();
|
|
9135
|
+
if (e - this.lastPingSentTime < r.PING_TIMEOUT) {
|
|
9136
|
+
e - this.lastSignalSentTime > r.PING_INTERVAL && this.sendSignal({ type: "keepalive" });
|
|
9137
|
+
return;
|
|
9138
|
+
}
|
|
9113
9139
|
}
|
|
9114
9140
|
this.isPingInFlight = !0, this.lastPingSentTime = performance.now(), this.missedPings = 0, this.sendSignal({ type: "ping" });
|
|
9115
9141
|
}), this.logger = a, this.emitter = i, this.config = o, this.rtts = s, this.emitter.on("send signal", this.sendSignal), this.emitter.on("disconnect", this.close), this.emitter.on("reconnect", this.reconnect), this.disconnected.promise.catch(n), this.transport = this.connectWebSocketTransport();
|
|
@@ -9118,8 +9144,8 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9118
9144
|
return this.disconnected.promise;
|
|
9119
9145
|
}
|
|
9120
9146
|
};
|
|
9121
|
-
|
|
9122
|
-
let o = new
|
|
9147
|
+
sb = fb, e(fb, "PING_INTERVAL", 5e3), e(fb, "PING_TIMEOUT", 15e3), e(fb, "MAX_MISSED_PINGS", 4), e(fb, "TLS_ROUNDTRIPS", 3), e(fb, "start", (e, t, n, r) => new Promise((i, a) => {
|
|
9148
|
+
let o = new sb(e, t, n, r);
|
|
9123
9149
|
o.transport.once("error", (e) => a(e)), o.transport.once("open", () => {
|
|
9124
9150
|
var e;
|
|
9125
9151
|
(e = n.onTransportConnected) == null || e.call(n), i(o);
|
|
@@ -9127,58 +9153,58 @@ tb = ob, e(ob, "PING_INTERVAL", 5e3), e(ob, "MAX_MISSED_PINGS", 4), e(ob, "TLS_R
|
|
|
9127
9153
|
}));
|
|
9128
9154
|
//#endregion
|
|
9129
9155
|
//#region ../../libs/web-sdk/src/EdgeSelector.ts
|
|
9130
|
-
var
|
|
9156
|
+
var pb = (e) => {
|
|
9131
9157
|
var t;
|
|
9132
9158
|
return typeof e == "string" ? e : `${e.moqWsUrl}|${(t = e.moqUrl) == null ? "" : t}`;
|
|
9133
|
-
},
|
|
9159
|
+
}, mb = (e) => typeof e == "string" ? e : e.moqUrl || e.moqWsUrl, hb = /* @__PURE__ */ new WeakMap(), gb = /* @__PURE__ */ new WeakMap(), _b = /* @__PURE__ */ new WeakMap(), vb = /* @__PURE__ */ new WeakMap(), yb = class {
|
|
9134
9160
|
constructor(e) {
|
|
9135
|
-
i(this,
|
|
9161
|
+
i(this, hb, void 0), i(this, gb, []), i(this, _b, /* @__PURE__ */ new Set()), i(this, vb, void 0), a(hb, this, e);
|
|
9136
9162
|
}
|
|
9137
9163
|
select(e) {
|
|
9138
|
-
if (s(
|
|
9164
|
+
if (s(hb, this).edgeUrl) return s(hb, this).edgeUrl;
|
|
9139
9165
|
if (e.length > 0) {
|
|
9140
|
-
a(
|
|
9141
|
-
let t = new Set(s(
|
|
9142
|
-
for (let e of s(
|
|
9166
|
+
a(gb, this, [...e]);
|
|
9167
|
+
let t = new Set(s(gb, this).map((e) => pb(e)));
|
|
9168
|
+
for (let e of s(_b, this)) t.has(e) || s(_b, this).delete(e);
|
|
9143
9169
|
}
|
|
9144
|
-
if (s(
|
|
9145
|
-
let t = s(
|
|
9146
|
-
t.length === 0 && (s(
|
|
9170
|
+
if (s(gb, this).length === 0) return;
|
|
9171
|
+
let t = s(gb, this).filter((e) => !s(_b, this).has(pb(e)));
|
|
9172
|
+
t.length === 0 && (s(_b, this).clear(), t = s(gb, this));
|
|
9147
9173
|
let n = t[0];
|
|
9148
|
-
if (n) return s(
|
|
9174
|
+
if (n) return s(_b, this).add(pb(n)), a(vb, this, n), n;
|
|
9149
9175
|
}
|
|
9150
9176
|
shiftedEdge() {
|
|
9151
|
-
return s(
|
|
9177
|
+
return s(vb, this);
|
|
9152
9178
|
}
|
|
9153
9179
|
hasRemainingEdges() {
|
|
9154
|
-
return s(
|
|
9180
|
+
return s(gb, this).some((e) => !s(_b, this).has(pb(e)));
|
|
9155
9181
|
}
|
|
9156
9182
|
reset() {
|
|
9157
|
-
a(
|
|
9183
|
+
a(vb, this, void 0), a(gb, this, []), s(_b, this).clear();
|
|
9158
9184
|
}
|
|
9159
|
-
},
|
|
9185
|
+
}, bb, xb = (e) => {
|
|
9160
9186
|
if (e instanceof A && (e.code() === "channel_not_live" || e.code() === "channel_not_found")) return !0;
|
|
9161
9187
|
let t = e instanceof A ? e.source() : e;
|
|
9162
9188
|
if (!(t instanceof Error) || !f(t)) return !1;
|
|
9163
9189
|
let { status: n } = t;
|
|
9164
9190
|
return n >= 400 && n < 500 && n !== 408 && n !== 429;
|
|
9165
|
-
},
|
|
9191
|
+
}, Sb = 3e4, Cb = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), wb = /* @__PURE__ */ new WeakMap(), Tb = /* @__PURE__ */ new WeakMap(), Eb = /* @__PURE__ */ new WeakMap(), Db = /* @__PURE__ */ new WeakMap(), Ob = /* @__PURE__ */ new WeakMap(), kb = /* @__PURE__ */ new WeakMap(), Ab = /* @__PURE__ */ new WeakMap(), jb = /* @__PURE__ */ new WeakMap(), Mb = /* @__PURE__ */ new WeakMap(), Nb = /* @__PURE__ */ new WeakMap(), Pb = /* @__PURE__ */ new WeakMap(), Fb = /* @__PURE__ */ new WeakMap(), Ib = /* @__PURE__ */ new WeakMap(), Lb = /* @__PURE__ */ new WeakMap(), Rb = /* @__PURE__ */ new WeakMap(), zb = /* @__PURE__ */ new WeakMap(), Bb = /* @__PURE__ */ new WeakMap(), Vb = /* @__PURE__ */ new WeakMap(), Hb = /* @__PURE__ */ new WeakMap(), Ub = /* @__PURE__ */ new WeakMap(), Wb = /* @__PURE__ */ new WeakSet(), Gb = /* @__PURE__ */ new WeakMap(), Kb = /* @__PURE__ */ new WeakMap(), qb = /* @__PURE__ */ new WeakMap(), Jb = /* @__PURE__ */ new WeakMap(), Yb = /* @__PURE__ */ new WeakMap(), Xb = /* @__PURE__ */ new WeakMap(), Zb = /* @__PURE__ */ new WeakMap(), Qb = class n {
|
|
9166
9192
|
constructor(c, l, u) {
|
|
9167
9193
|
var d = this;
|
|
9168
|
-
C(this,
|
|
9194
|
+
C(this, Wb), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "config", void 0), e(this, "apiClient", void 0), e(this, "connectionImpl", void 0), i(this, Cb, new r(10)), i(this, $, !0), i(this, wb, void 0), i(this, Tb, 0), i(this, Eb, 0), i(this, Db, void 0), i(this, Ob, 0), i(this, kb, 0), i(this, Ab, 0), i(this, jb, void 0), i(this, Mb, void 0), i(this, Nb, void 0), i(this, Pb, void 0), i(this, Fb, void 0), i(this, Ib, void 0), i(this, Lb, void 0), i(this, Rb, []), i(this, zb, void 0), e(this, "unload", () => {
|
|
9169
9195
|
var e;
|
|
9170
|
-
this.logger.debug("Unloading module..."), this.emitter.off("page active", s(
|
|
9196
|
+
this.logger.debug("Unloading module..."), this.emitter.off("page active", s(Jb, this)), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), a(Lb, this, void 0), this.logger.debug("Unloaded module");
|
|
9171
9197
|
}), e(this, "suspend", () => {
|
|
9172
9198
|
var e, t;
|
|
9173
|
-
a($, this, !1), (e = s(
|
|
9199
|
+
a($, this, !1), (e = s(Db, this)) == null || e.abort(), (t = this.connectionImpl) == null || t.suspend();
|
|
9174
9200
|
}), e(this, "unsuspend", () => {
|
|
9175
9201
|
var e;
|
|
9176
9202
|
a($, this, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
|
|
9177
9203
|
}), e(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected"), e(this, "getStatistics", () => {
|
|
9178
9204
|
var e;
|
|
9179
|
-
let t = s(
|
|
9205
|
+
let t = s(Ob, this) > 0 ? s(kb, this) / s(Ob, this) : 0;
|
|
9180
9206
|
if (!this.connectionImpl) {
|
|
9181
|
-
let e = s(
|
|
9207
|
+
let e = s(Bb, this).call(this);
|
|
9182
9208
|
return {
|
|
9183
9209
|
rtt: {
|
|
9184
9210
|
min: 0,
|
|
@@ -9187,17 +9213,17 @@ var sb = (e) => {
|
|
|
9187
9213
|
last: 0
|
|
9188
9214
|
},
|
|
9189
9215
|
estimatedBandwidth: 0,
|
|
9190
|
-
connectCount: s(
|
|
9191
|
-
backlogReconnectCount: s(
|
|
9192
|
-
connectionAttemptCount: s(
|
|
9216
|
+
connectCount: s(kb, this),
|
|
9217
|
+
backlogReconnectCount: s(Ab, this),
|
|
9218
|
+
connectionAttemptCount: s(Ob, this),
|
|
9193
9219
|
connectionSuccessRatio: t,
|
|
9194
|
-
timeToConnected: s(
|
|
9220
|
+
timeToConnected: s(Pb, this),
|
|
9195
9221
|
edgeUrl: e == null ? void 0 : e.edgeUrl,
|
|
9196
9222
|
connectionProtocol: e == null ? void 0 : e.connectionProtocol,
|
|
9197
9223
|
transportSelectionReason: e == null ? void 0 : e.transportSelectionReason
|
|
9198
9224
|
};
|
|
9199
9225
|
}
|
|
9200
|
-
let n = this.connectionImpl.getStatistics(), r = (e = this.linkQueue) == null ? void 0 : e.summary(
|
|
9226
|
+
let n = this.connectionImpl.getStatistics(), r = (e = this.linkQueue) == null ? void 0 : e.summary(Sb);
|
|
9201
9227
|
return x(x({}, n), {}, {
|
|
9202
9228
|
linkQueue: r && {
|
|
9203
9229
|
last: Math.round(r.last),
|
|
@@ -9205,30 +9231,30 @@ var sb = (e) => {
|
|
|
9205
9231
|
max: Math.round(r.max),
|
|
9206
9232
|
min: Math.round(r.min)
|
|
9207
9233
|
},
|
|
9208
|
-
rtt: yt(s(
|
|
9234
|
+
rtt: yt(s(Cb, this).items()),
|
|
9209
9235
|
estimatedBandwidth: this.estimatedBandwidth,
|
|
9210
|
-
connectCount: s(
|
|
9211
|
-
backlogReconnectCount: s(
|
|
9212
|
-
connectionAttemptCount: s(
|
|
9236
|
+
connectCount: s(kb, this),
|
|
9237
|
+
backlogReconnectCount: s(Ab, this),
|
|
9238
|
+
connectionAttemptCount: s(Ob, this),
|
|
9213
9239
|
connectionSuccessRatio: t,
|
|
9214
|
-
timeToConnected: s(
|
|
9240
|
+
timeToConnected: s(Pb, this)
|
|
9215
9241
|
});
|
|
9216
|
-
}), i(this,
|
|
9217
|
-
if (a($, this, !0), s(
|
|
9242
|
+
}), i(this, Bb, () => s($, this) && s(Ib, this) ? s(Ib, this) : s(Fb, this)), e(this, "connect", () => {
|
|
9243
|
+
if (a($, this, !0), s(wb, this)) {
|
|
9218
9244
|
var e;
|
|
9219
|
-
(e = s(
|
|
9245
|
+
(e = s(Db, this)) == null || e.abort();
|
|
9220
9246
|
return;
|
|
9221
9247
|
}
|
|
9222
9248
|
let t = performance.now();
|
|
9223
|
-
s(
|
|
9224
|
-
}), i(this,
|
|
9225
|
-
s(
|
|
9249
|
+
s(Pb, this) === void 0 && a(jb, this, t), s(Mb, this) === void 0 && a(Mb, this, t), a(wb, this, o(Wb, this, $b).call(this));
|
|
9250
|
+
}), i(this, Vb, () => {
|
|
9251
|
+
s(Pb, this) !== void 0 || s(jb, this) === void 0 || !s($, this) || (a(Pb, this, performance.now() - s(jb, this)), a(jb, this, void 0));
|
|
9226
9252
|
}), e(this, "disconnect", (e = "Disconnect Requested") => {
|
|
9227
9253
|
var t, n;
|
|
9228
|
-
a($, this, !1), (t = s(
|
|
9254
|
+
a($, this, !1), (t = s(Db, this)) == null || t.abort(), s(Kb, this).call(this), (n = this.connectionImpl) == null || n.close(e);
|
|
9229
9255
|
}), e(this, "reconnect", (e) => {
|
|
9230
9256
|
this.disconnect(e), this.connect();
|
|
9231
|
-
}), i(this,
|
|
9257
|
+
}), i(this, Hb, t(function* () {
|
|
9232
9258
|
try {
|
|
9233
9259
|
return yield d.apiClient.connect(d.config.options.getOptions());
|
|
9234
9260
|
} catch (e) {
|
|
@@ -9239,7 +9265,7 @@ var sb = (e) => {
|
|
|
9239
9265
|
}
|
|
9240
9266
|
throw d.emitter.emit("error", Qn(e instanceof Error ? e : void 0)), e;
|
|
9241
9267
|
}
|
|
9242
|
-
})), i(this,
|
|
9268
|
+
})), i(this, Ub, t(function* () {
|
|
9243
9269
|
let e = performance.now(), t = () => performance.now() - e, r = globalThis.AbortController ? new AbortController() : void 0, i = setTimeout(() => r == null ? void 0 : r.abort(), n.PING_TIMEOUT);
|
|
9244
9270
|
try {
|
|
9245
9271
|
return yield fetch(new URL("/api/v4/connect/ping", d.config.options.get("url")).toString(), {
|
|
@@ -9251,147 +9277,147 @@ var sb = (e) => {
|
|
|
9251
9277
|
} finally {
|
|
9252
9278
|
clearTimeout(i);
|
|
9253
9279
|
}
|
|
9254
|
-
})), i(this,
|
|
9255
|
-
s(
|
|
9280
|
+
})), i(this, Gb, () => {
|
|
9281
|
+
s(Kb, this).call(this), a(zb, this, setTimeout(() => {
|
|
9256
9282
|
var e;
|
|
9257
|
-
!s(
|
|
9283
|
+
!s(Lb, this) || ((e = this.connectionImpl) == null ? void 0 : e.getState()) !== "connected" || (this.logger.debug("Connection remained stable for long enough, clearing cached fallback edges"), s(Lb, this).reset(), a(zb, this, void 0));
|
|
9258
9284
|
}, n.EDGE_SELECTOR_RESET_TIMEOUT));
|
|
9259
|
-
}), i(this,
|
|
9260
|
-
s(
|
|
9261
|
-
}), i(this,
|
|
9285
|
+
}), i(this, Kb, () => {
|
|
9286
|
+
s(zb, this) !== void 0 && (clearTimeout(s(zb, this)), a(zb, this, void 0));
|
|
9287
|
+
}), i(this, qb, function() {
|
|
9262
9288
|
var e = t(function* (e) {
|
|
9263
|
-
a(
|
|
9289
|
+
a(Db, d, globalThis.AbortController ? new AbortController() : void 0);
|
|
9264
9290
|
try {
|
|
9265
|
-
let c = yield d.config.reconnectHandler({ reconnectRetries: s(
|
|
9291
|
+
let c = yield d.config.reconnectHandler({ reconnectRetries: s(Tb, d) });
|
|
9266
9292
|
if (!s($, d)) return !1;
|
|
9267
9293
|
if (!c) return a($, d, !1), d.emitter.emit("error", $n()), !1;
|
|
9268
9294
|
if (!d.config.documentState.isVisible) {
|
|
9269
9295
|
var t, r, i, o;
|
|
9270
|
-
if ((t = s(
|
|
9271
|
-
let e = n.HIDDEN_BACKOFF_BASE_MS * 2 ** (a(
|
|
9272
|
-
return d.logger.info("Page hidden, backing off before retrying", { delay: c }), yield cn(c, (o = s(
|
|
9296
|
+
if ((t = s(Db, d)) != null && t.signal.aborted) return s($, d);
|
|
9297
|
+
let e = n.HIDDEN_BACKOFF_BASE_MS * 2 ** (a(Eb, d, (r = s(Eb, d), i = r++, r)), i), c = Math.min(n.HIDDEN_BACKOFF_MAX_MS, e);
|
|
9298
|
+
return d.logger.info("Page hidden, backing off before retrying", { delay: c }), yield cn(c, (o = s(Db, d)) == null ? void 0 : o.signal).catch(() => void 0), s($, d);
|
|
9273
9299
|
}
|
|
9274
|
-
return a(
|
|
9300
|
+
return a(Eb, d, 0), s(Xb, d).call(d) ? (d.logger.info("Reconnect burst detected, applying backoff before retrying"), yield cn(n.RECONNECT_BACKOFF_MS)) : d.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), s($, d);
|
|
9275
9301
|
} finally {
|
|
9276
|
-
a(
|
|
9302
|
+
a(Db, d, void 0);
|
|
9277
9303
|
}
|
|
9278
9304
|
});
|
|
9279
9305
|
return function(t) {
|
|
9280
9306
|
return e.apply(this, arguments);
|
|
9281
9307
|
};
|
|
9282
|
-
}()), i(this,
|
|
9308
|
+
}()), i(this, Jb, (e) => {
|
|
9283
9309
|
if (e) {
|
|
9284
9310
|
var t;
|
|
9285
|
-
(t = s(
|
|
9311
|
+
(t = s(Db, this)) == null || t.abort();
|
|
9286
9312
|
}
|
|
9287
|
-
}), i(this,
|
|
9288
|
-
s(
|
|
9289
|
-
}), i(this,
|
|
9290
|
-
for (; s(
|
|
9291
|
-
let t = s(
|
|
9313
|
+
}), i(this, Yb, (e = performance.now()) => {
|
|
9314
|
+
s(Zb, this).call(this, e), s(Rb, this).push(e);
|
|
9315
|
+
}), i(this, Xb, (e = performance.now()) => (s(Zb, this).call(this, e), s(Rb, this).length >= n.RECONNECT_BACKOFF_BURST_THRESHOLD)), i(this, Zb, (e) => {
|
|
9316
|
+
for (; s(Rb, this).length > 0;) {
|
|
9317
|
+
let t = s(Rb, this)[0];
|
|
9292
9318
|
if (t === void 0 || t > e - n.RECONNECT_BACKOFF_BURST_WINDOW_MS) return;
|
|
9293
|
-
s(
|
|
9319
|
+
s(Rb, this).shift();
|
|
9294
9320
|
}
|
|
9295
9321
|
}), this.logger = l, this.emitter = c, this.config = u, this.apiClient = new g({
|
|
9296
9322
|
publicEndpoint: this.config.options.get("url").toString(),
|
|
9297
9323
|
tokenFactory: () => this.config.options.get("authenticationToken")
|
|
9298
|
-
}), this.emitter.on("page active", s(
|
|
9324
|
+
}), this.emitter.on("page active", s(Jb, this));
|
|
9299
9325
|
}
|
|
9300
9326
|
get rtt() {
|
|
9301
|
-
return s(
|
|
9327
|
+
return s(Cb, this).items().length > 0 ? gt(s(Cb, this).items()) : 0;
|
|
9302
9328
|
}
|
|
9303
9329
|
get isMoq() {
|
|
9304
|
-
return this.connectionImpl instanceof
|
|
9330
|
+
return this.connectionImpl instanceof Uy;
|
|
9305
9331
|
}
|
|
9306
9332
|
get estimatedBandwidth() {
|
|
9307
9333
|
if (this.connectionImpl && "estimatedBandwidth" in this.connectionImpl) {
|
|
9308
9334
|
let e = this.connectionImpl.estimatedBandwidth;
|
|
9309
9335
|
if (e && Number.isFinite(e)) return e;
|
|
9310
9336
|
}
|
|
9311
|
-
return
|
|
9337
|
+
return db(this.rtt);
|
|
9312
9338
|
}
|
|
9313
9339
|
get linkQueue() {
|
|
9314
9340
|
var e;
|
|
9315
9341
|
return (e = this.connectionImpl) == null ? void 0 : e.linkQueue;
|
|
9316
9342
|
}
|
|
9317
9343
|
get firstConnectStartTime() {
|
|
9318
|
-
return s(
|
|
9344
|
+
return s(Mb, this);
|
|
9319
9345
|
}
|
|
9320
9346
|
get lastConnectionTime() {
|
|
9321
|
-
return s(
|
|
9347
|
+
return s(Nb, this);
|
|
9322
9348
|
}
|
|
9323
9349
|
};
|
|
9324
|
-
|
|
9325
|
-
function
|
|
9350
|
+
bb = Qb;
|
|
9351
|
+
function $b() {
|
|
9326
9352
|
var e = this;
|
|
9327
9353
|
return t(function* () {
|
|
9328
|
-
let t = new
|
|
9329
|
-
for (a(
|
|
9354
|
+
let t = new yb({ edgeUrl: e.config.options.get("edgeUrl") });
|
|
9355
|
+
for (a(Lb, e, t), s(Kb, e).call(e), a(Tb, e, 0), a(Eb, e, 0), a(Rb, e, []);;) {
|
|
9330
9356
|
var n, r;
|
|
9331
9357
|
let u = "standard";
|
|
9332
|
-
a(
|
|
9358
|
+
a(Ob, e, (n = s(Ob, e), n++, n)), s(Yb, e).call(e);
|
|
9333
9359
|
let f = !1;
|
|
9334
|
-
a(
|
|
9360
|
+
a(Ib, e, {});
|
|
9335
9361
|
try {
|
|
9336
9362
|
var i, o;
|
|
9337
|
-
let [n, r] = yield Promise.all([s(
|
|
9338
|
-
if (s(
|
|
9363
|
+
let [n, r] = yield Promise.all([s(Hb, e).call(e), s(Ub, e).call(e)]);
|
|
9364
|
+
if (s(Cb, e).clear(), r !== void 0 && s(Cb, e).push(r / 2), !s($, e)) break;
|
|
9339
9365
|
let l = t.select(n.edges);
|
|
9340
9366
|
if (!l) throw new A("Failed to resolve edge url", {
|
|
9341
9367
|
isFatal: !0,
|
|
9342
9368
|
code: "failed_to_resolve_edge_url"
|
|
9343
9369
|
});
|
|
9344
|
-
a(
|
|
9370
|
+
a(Ib, e, { edgeUrl: Pv(mb(l)) });
|
|
9345
9371
|
try {
|
|
9346
|
-
c(n) ? e.connectionImpl = yield
|
|
9372
|
+
c(n) ? e.connectionImpl = yield Uy.start(e.emitter, e.logger, e.apiClient, x(x({}, e.config), {}, {
|
|
9347
9373
|
connectInfo: n,
|
|
9348
9374
|
edgeUrl: l,
|
|
9349
|
-
onTransportConnected: s(
|
|
9350
|
-
}), s(
|
|
9375
|
+
onTransportConnected: s(Vb, e)
|
|
9376
|
+
}), s(Cb, e)) : (d(typeof l == "string", "Edge URL is expected to be a string"), e.connectionImpl = yield fb.start(e.emitter, e.logger, x(x({}, e.config), {}, {
|
|
9351
9377
|
connectInfo: n,
|
|
9352
9378
|
edgeUrl: l,
|
|
9353
|
-
onTransportConnected: s(
|
|
9354
|
-
}), s(
|
|
9379
|
+
onTransportConnected: s(Vb, e)
|
|
9380
|
+
}), s(Cb, e)));
|
|
9355
9381
|
} catch (e) {
|
|
9356
9382
|
throw u = "cached_edge", e;
|
|
9357
9383
|
}
|
|
9358
|
-
a(
|
|
9384
|
+
a(Fb, e, e.connectionImpl.getStatistics()), a(Ib, e, void 0), s($, e) || e.connectionImpl.close("Disconnected during connect"), s(Gb, e).call(e), a(kb, e, (i = s(kb, e), i++, i)), a(Tb, e, 0), a(Eb, e, 0), a(Nb, e, performance.now()), s(Vb, e).call(e);
|
|
9359
9385
|
let f = yield e.connectionImpl.closed();
|
|
9360
|
-
e.connectionImpl.closedForBacklog && a(
|
|
9386
|
+
e.connectionImpl.closedForBacklog && a(Ab, e, (o = s(Ab, e), o++, o)), e.logger.info("Connection closed", { reason: f instanceof Error ? f.message : f }), u = "cached_edge";
|
|
9361
9387
|
} catch (n) {
|
|
9362
|
-
if (e.logger.warn("Failed to connect", n), !e.connectionImpl && (e.config.documentState.isVisible ||
|
|
9388
|
+
if (e.logger.warn("Failed to connect", n), !e.connectionImpl && (e.config.documentState.isVisible || xb(n))) {
|
|
9363
9389
|
var l;
|
|
9364
|
-
a(
|
|
9390
|
+
a(Tb, e, (l = s(Tb, e), l++, l));
|
|
9365
9391
|
}
|
|
9366
9392
|
let r = t.shiftedEdge();
|
|
9367
9393
|
r && e.emitter.emit("telemetry event", {
|
|
9368
9394
|
code: "shifted_edge",
|
|
9369
|
-
edgeUrl:
|
|
9395
|
+
edgeUrl: mb(r)
|
|
9370
9396
|
}), n instanceof A ? (e.emitter.emit("error", n), f = n.isFatal()) : n instanceof Error && e.emitter.emit("error", new A(n.message, {
|
|
9371
9397
|
code: "start_failed",
|
|
9372
9398
|
isFatal: !1
|
|
9373
9399
|
}));
|
|
9374
9400
|
}
|
|
9375
|
-
if ((r = e.connectionImpl) == null || r.unload(), e.connectionImpl = void 0, s(
|
|
9401
|
+
if ((r = e.connectionImpl) == null || r.unload(), e.connectionImpl = void 0, s(Kb, e).call(e), f) {
|
|
9376
9402
|
a($, e, !1);
|
|
9377
9403
|
break;
|
|
9378
9404
|
}
|
|
9379
|
-
if (!s($, e) || !(yield s(
|
|
9405
|
+
if (!s($, e) || !(yield s(qb, e).call(e, u === "cached_edge" && t.hasRemainingEdges() ? "cached_edge" : "standard"))) break;
|
|
9380
9406
|
}
|
|
9381
|
-
a(
|
|
9407
|
+
a(Ib, e, void 0), a(Lb, e, void 0), s(Kb, e).call(e), a(wb, e, void 0), s($, e) && e.connect();
|
|
9382
9408
|
})();
|
|
9383
9409
|
}
|
|
9384
|
-
e(
|
|
9410
|
+
e(Qb, "PING_TIMEOUT", 1e3), e(Qb, "RECONNECT_BACKOFF_MS", 1e3), e(Qb, "RECONNECT_BACKOFF_BURST_WINDOW_MS", 5e3), e(Qb, "RECONNECT_BACKOFF_BURST_THRESHOLD", 3), e(Qb, "EDGE_SELECTOR_RESET_TIMEOUT", 60 * 1e3), e(Qb, "HIDDEN_BACKOFF_BASE_MS", 1e3), e(Qb, "HIDDEN_BACKOFF_MAX_MS", 3e4), e(Qb, "create", (e, t, n) => new bb(e, t, n));
|
|
9385
9411
|
//#endregion
|
|
9386
9412
|
//#region ../../libs/web-sdk/src/modules/ConstraintCapModule.ts
|
|
9387
|
-
var
|
|
9413
|
+
var ex, tx = () => ({
|
|
9388
9414
|
video: x(x({}, mn()), {}, { bitRate: pn() }),
|
|
9389
9415
|
audio: { bitRate: pn() }
|
|
9390
|
-
}),
|
|
9416
|
+
}), nx = () => ({
|
|
9391
9417
|
width: window.innerWidth,
|
|
9392
9418
|
height: window.innerHeight,
|
|
9393
9419
|
bitRate: pn()
|
|
9394
|
-
}),
|
|
9420
|
+
}), rx = class t {
|
|
9395
9421
|
constructor(n, r, i, a) {
|
|
9396
9422
|
e(this, "emitter", void 0), e(this, "timers", new k()), e(this, "pictureInPictureSource", void 0), e(this, "element", void 0), e(this, "currentCap", void 0), e(this, "userSpecifiedCap", void 0), e(this, "renditionLevelSource", void 0), e(this, "resizeObserver", void 0), e(this, "elementSize", void 0), e(this, "_sizeBasedResolutionCapEnabled", void 0), e(this, "unload", () => {
|
|
9397
9423
|
var e;
|
|
@@ -9413,7 +9439,7 @@ var Jb, Yb = () => ({
|
|
|
9413
9439
|
this.timers.unload();
|
|
9414
9440
|
}), e(this, "setUserSpecifiedCap", (e) => {
|
|
9415
9441
|
var t;
|
|
9416
|
-
let n = (t = this.getUserSpecifiedCap()) == null ?
|
|
9442
|
+
let n = (t = this.getUserSpecifiedCap()) == null ? tx() : t;
|
|
9417
9443
|
this.userSpecifiedCap = x(x({}, n), {}, {
|
|
9418
9444
|
video: x(x({}, n.video), e.video),
|
|
9419
9445
|
audio: x(x({}, n.audio), e.audio)
|
|
@@ -9437,7 +9463,7 @@ var Jb, Yb = () => ({
|
|
|
9437
9463
|
});
|
|
9438
9464
|
}), e(this, "evaluateConstraintCap", () => {
|
|
9439
9465
|
var e, t, n, r;
|
|
9440
|
-
let i = this.sizeBasedResolutionCapEnabled ? x(x({},
|
|
9466
|
+
let i = this.sizeBasedResolutionCapEnabled ? x(x({}, tx()), {}, { video: nx() }) : tx();
|
|
9441
9467
|
if (!this.resizeObserver) {
|
|
9442
9468
|
let e = this.element.getBoundingClientRect();
|
|
9443
9469
|
this.elementSize = {
|
|
@@ -9474,20 +9500,20 @@ var Jb, Yb = () => ({
|
|
|
9474
9500
|
this._sizeBasedResolutionCapEnabled = e, this.evaluateConstraintCap();
|
|
9475
9501
|
}
|
|
9476
9502
|
};
|
|
9477
|
-
|
|
9503
|
+
ex = rx, e(rx, "CHECK_SIZE_INTERVAL", 1e3), e(rx, "create", (e, t, n, r) => new ex(e, t, n, r));
|
|
9478
9504
|
//#endregion
|
|
9479
9505
|
//#region ../../libs/web-sdk/src/renditionKey.ts
|
|
9480
|
-
var
|
|
9506
|
+
var ix = (e, t) => `${e}\u0000${t == null ? "" : t}`, ax = (e, t, n, r) => e === n && t === r, ox = class {
|
|
9481
9507
|
constructor() {
|
|
9482
9508
|
e(this, "lastKey", void 0), e(this, "shouldNotify", (e, t) => {
|
|
9483
|
-
let n =
|
|
9509
|
+
let n = ix(e, t);
|
|
9484
9510
|
return this.lastKey === n ? !1 : (this.lastKey = n, !0);
|
|
9485
9511
|
});
|
|
9486
9512
|
}
|
|
9487
|
-
},
|
|
9513
|
+
}, sx = 5, cx = 40, lx = 1, ux = 3e4, dx = 5, fx = (e) => {
|
|
9488
9514
|
var t, n;
|
|
9489
9515
|
return ((t = e.maxCompositionOffsetMs) == null ? 0 : t) - ((n = e.minCompositionOffsetMs) == null ? 0 : n);
|
|
9490
|
-
},
|
|
9516
|
+
}, px = (e, t, n) => {
|
|
9491
9517
|
let r = [];
|
|
9492
9518
|
for (let i of e) {
|
|
9493
9519
|
let e = r[r.length - 1];
|
|
@@ -9501,10 +9527,10 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9501
9527
|
});
|
|
9502
9528
|
}
|
|
9503
9529
|
return r;
|
|
9504
|
-
},
|
|
9530
|
+
}, mx = (e, t) => {
|
|
9505
9531
|
let n = e[e.length - 1];
|
|
9506
9532
|
n && n.end > t && n.start < t && (n.end = t);
|
|
9507
|
-
},
|
|
9533
|
+
}, hx = 100, gx = 1e3, _x = class n {
|
|
9508
9534
|
constructor(t, n, r, i, a = !1, o = !1, s = !1) {
|
|
9509
9535
|
e(this, "backgroundTimersEnabled", !1), e(this, "timers", this.createTimers()), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "trackContexts", void 0), e(this, "playbackSource", void 0), e(this, "isLoaded", !1), e(this, "isSuspended", !1), e(this, "_webCodecsInUse", void 0), e(this, "_audioWebCodecsInUse", void 0), e(this, "_offscreenCanvasInUse", void 0), e(this, "currentVideoDecodeRate", 2), e(this, "decodeRateGraceIntervals", 3), e(this, "isAudioEmitRetryScheduled", !1), e(this, "videoKeyframeTimestamps", []), e(this, "load", () => {
|
|
9510
9536
|
this.isLoaded = !0, this.armTimers(), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode), this.emitter.on("flush buffers", this.resetContexts);
|
|
@@ -9522,8 +9548,8 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9522
9548
|
}), e(this, "unsuspend", () => {
|
|
9523
9549
|
this.isSuspended = !1, this.emitDecodedFrames(), this._audioWebCodecsInUse && this.scheduleAudioEmitRetry();
|
|
9524
9550
|
}), e(this, "armTimers", () => {
|
|
9525
|
-
let e = this._audioWebCodecsInUse ? 20 :
|
|
9526
|
-
this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate,
|
|
9551
|
+
let e = this._audioWebCodecsInUse ? 20 : hx;
|
|
9552
|
+
this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate, gx);
|
|
9527
9553
|
}), e(this, "replaceTimers", () => {
|
|
9528
9554
|
let e = this.isAudioEmitRetryScheduled;
|
|
9529
9555
|
this.isAudioEmitRetryScheduled = !1, this.timers.unload(), this.timers = this.createTimers(), this.timers.isWorkerBackendUnavailable() && this.logger.warn("Background timer worker is unavailable (likely blocked by CSP or unsupported in this environment). Falling back to main-thread timers; hidden-tab playback may be throttled."), this.isLoaded && (this.armTimers(), e && this.scheduleAudioEmitRetry());
|
|
@@ -9592,27 +9618,27 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9592
9618
|
i.stream = `${e.channelId}/${e.renditionId}`;
|
|
9593
9619
|
let c = (e.timestamp + a) / e.timescale * 1e3, l = e.duration / e.timescale * 1e3;
|
|
9594
9620
|
l > 0 && (i.sampleDuration = l);
|
|
9595
|
-
let u = i.sampleDuration ||
|
|
9621
|
+
let u = i.sampleDuration || cx, d = e.timestamp / e.timescale * 1e3, f = a / e.timescale * 1e3, p = fx(i), m = (t = s[s.length - 1]) == null ? void 0 : t.end, h = Math.max(u * dx, p + ((n = i.frontierSampleDurationMs) == null ? u : n)), g = m !== void 0 && c + h < m;
|
|
9596
9622
|
i.lastDecodeTimestampMs = g ? d : Math.max((r = i.lastDecodeTimestampMs) == null ? d : r, d);
|
|
9597
|
-
let _ = i.channelId !== void 0 &&
|
|
9623
|
+
let _ = i.channelId !== void 0 && !ax(i.channelId, i.renditionId, e.channelId, e.renditionId);
|
|
9598
9624
|
i.channelId = e.channelId, i.renditionId = e.renditionId, (g || _) && (i.minCompositionOffsetMs = void 0, i.maxCompositionOffsetMs = void 0, i.hasAnchoredGop = !1, i.isReorderStructureStale = !0);
|
|
9599
9625
|
let v = i.hasAnchoredGop === !0;
|
|
9600
9626
|
if (e.isSync && (i.hasAnchoredGop = !0), !g && i.hasAnchoredGop) {
|
|
9601
9627
|
var y, b;
|
|
9602
9628
|
i.minCompositionOffsetMs = Math.min((y = i.minCompositionOffsetMs) == null ? f : y, f), i.maxCompositionOffsetMs = Math.max((b = i.maxCompositionOffsetMs) == null ? f : b, f), v && (i.isReorderStructureStale = !1);
|
|
9603
9629
|
}
|
|
9604
|
-
let ee =
|
|
9630
|
+
let ee = fx(i) > 0;
|
|
9605
9631
|
if (g) i.buffer = [{
|
|
9606
9632
|
start: c,
|
|
9607
9633
|
end: c + u
|
|
9608
9634
|
}], i.frontierSampleDurationMs = u, e.type === "video" && (this.videoKeyframeTimestamps = []);
|
|
9609
9635
|
else {
|
|
9610
9636
|
var te;
|
|
9611
|
-
!ee && !i.isReorderStructureStale &&
|
|
9637
|
+
!ee && !i.isReorderStructureStale && mx(s, c + u);
|
|
9612
9638
|
let e = (te = s[s.length - 1]) == null ? void 0 : te.end;
|
|
9613
|
-
(e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), tn(s, c, c + u,
|
|
9639
|
+
(e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), tn(s, c, c + u, sx);
|
|
9614
9640
|
}
|
|
9615
|
-
if (rn(i.buffer, this.playbackSource.currentTime -
|
|
9641
|
+
if (rn(i.buffer, this.playbackSource.currentTime - ux), i.playableRangesCache = void 0, e.type === "video" && e.isSync) {
|
|
9616
9642
|
let e = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
|
|
9617
9643
|
e !== void 0 && c < e && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(c), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
|
|
9618
9644
|
}
|
|
@@ -9649,11 +9675,11 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9649
9675
|
}
|
|
9650
9676
|
this.currentVideoDecodeRate = this.calculateVideoDecodeRate(), this.emitter.emit("video decode rate", this.currentVideoDecodeRate);
|
|
9651
9677
|
}), e(this, "playableRanges", (e) => {
|
|
9652
|
-
let t =
|
|
9678
|
+
let t = fx(e);
|
|
9653
9679
|
if (t <= 0) return e.buffer;
|
|
9654
9680
|
if (e.playableRangesCache === void 0) {
|
|
9655
9681
|
var n, r;
|
|
9656
|
-
e.playableRangesCache =
|
|
9682
|
+
e.playableRangesCache = px(e.buffer, ((n = e.lastDecodeTimestampMs) == null ? Infinity : n) - Math.max(0, -((r = e.minCompositionOffsetMs) == null ? 0 : r)) - lx, t + (e.sampleDuration || cx) + lx);
|
|
9657
9683
|
}
|
|
9658
9684
|
return e.playableRangesCache;
|
|
9659
9685
|
}), e(this, "updateBufferState", () => {
|
|
@@ -9740,7 +9766,7 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9740
9766
|
var e;
|
|
9741
9767
|
if (this._offscreenCanvasInUse) return (e = this.trackContexts.get("video")) == null ? void 0 : e.decoderContext.videoTrack;
|
|
9742
9768
|
}
|
|
9743
|
-
},
|
|
9769
|
+
}, vx, yx = class {
|
|
9744
9770
|
constructor(t) {
|
|
9745
9771
|
e(this, "emitter", void 0), e(this, "isVisibleCount", 0), e(this, "isHiddenCount", 0), e(this, "isOnlineCount", 0), e(this, "isOfflineCount", 0), e(this, "isActive", document.visibilityState === "visible"), e(this, "isBehindAnotherApp", !1), e(this, "unload", () => {
|
|
9746
9772
|
this.emitter.off("fullscreen app switch", this.onFullscreenAppSwitch), window.removeEventListener("focus", this.onVisibilityChanged), document.removeEventListener("visibilitychange", this.onVisibilityChanged), window.removeEventListener("pageshow", this.onPageShow), window.removeEventListener("pagehide", this.onPageHide), window.removeEventListener("online", this.onOnline), window.removeEventListener("offline", this.onOffline);
|
|
@@ -9770,12 +9796,12 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9770
9796
|
return document.visibilityState === "visible" && !this.isBehindAnotherApp;
|
|
9771
9797
|
}
|
|
9772
9798
|
};
|
|
9773
|
-
|
|
9799
|
+
vx = yx, e(yx, "create", (e) => new vx(e));
|
|
9774
9800
|
//#endregion
|
|
9775
9801
|
//#region ../../libs/web-sdk/src/modules/EventModule.ts
|
|
9776
|
-
var
|
|
9802
|
+
var bx, xx = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e, Sx = class t {
|
|
9777
9803
|
constructor(n, r, i) {
|
|
9778
|
-
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered",
|
|
9804
|
+
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered", xx(t.EVENT_TIMEOUT)), e(this, "timeSource", void 0), e(this, "timers", new k()), e(this, "load", () => {
|
|
9779
9805
|
this.timers.setInterval(this.onBufferedStateChanged, t.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
|
|
9780
9806
|
}), e(this, "unload", () => {
|
|
9781
9807
|
this.timers.unload(), this.emitter.off("add event", this.addEvent);
|
|
@@ -9802,10 +9828,10 @@ var mx, hx = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e,
|
|
|
9802
9828
|
}), this.logger = r, this.emitter = n, this.timeSource = i;
|
|
9803
9829
|
}
|
|
9804
9830
|
};
|
|
9805
|
-
|
|
9831
|
+
bx = Sx, e(Sx, "EVENT_TIMEOUT", 5e3), e(Sx, "EVENT_CHECK_INTERVAL", 20), e(Sx, "create", (e, t, n) => new bx(e, t, n));
|
|
9806
9832
|
//#endregion
|
|
9807
9833
|
//#region ../../libs/web-sdk/src/modules/JitterModule.ts
|
|
9808
|
-
var
|
|
9834
|
+
var Cx = 1e3, wx = 50, Tx = class t {
|
|
9809
9835
|
constructor(t) {
|
|
9810
9836
|
e(this, "logger", void 0), e(this, "trackingState", /* @__PURE__ */ new Map()), e(this, "runningJitter", /* @__PURE__ */ new Map()), e(this, "recentJitterSamples", /* @__PURE__ */ new Map()), e(this, "load", () => {
|
|
9811
9837
|
this.logger.debug("JitterModule loaded");
|
|
@@ -9826,9 +9852,9 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9826
9852
|
this.trackingState.set(n, {
|
|
9827
9853
|
lastArrivalTime: i,
|
|
9828
9854
|
lastTimestampMs: a,
|
|
9829
|
-
jitterSamples: new r(
|
|
9830
|
-
interArrivalTimes: new r(
|
|
9831
|
-
}), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(
|
|
9855
|
+
jitterSamples: new r(Cx),
|
|
9856
|
+
interArrivalTimes: new r(Cx)
|
|
9857
|
+
}), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(wx));
|
|
9832
9858
|
return;
|
|
9833
9859
|
}
|
|
9834
9860
|
let s = a - o.lastTimestampMs;
|
|
@@ -9841,7 +9867,7 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9841
9867
|
let u = (t = this.runningJitter.get(n)) == null ? 0 : t, d = u + (l - u) / 16;
|
|
9842
9868
|
this.runningJitter.set(n, d);
|
|
9843
9869
|
let f = this.recentJitterSamples.get(n);
|
|
9844
|
-
f || (f = new r(
|
|
9870
|
+
f || (f = new r(wx), this.recentJitterSamples.set(n, f)), f.push(l), o.lastArrivalTime = i, o.lastTimestampMs = a;
|
|
9845
9871
|
}
|
|
9846
9872
|
getJitterForType(e) {
|
|
9847
9873
|
for (let [i, a] of this.trackingState) if (i.startsWith(e)) {
|
|
@@ -9872,10 +9898,10 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9872
9898
|
videoJitter: this.getJitterForType("video")
|
|
9873
9899
|
};
|
|
9874
9900
|
}
|
|
9875
|
-
},
|
|
9901
|
+
}, Ex = () => window.AudioContext || window.webkitAudioContext, Dx = class r extends ne {
|
|
9876
9902
|
constructor() {
|
|
9877
9903
|
var i;
|
|
9878
|
-
super(), i = this, e(this, "context", new (
|
|
9904
|
+
super(), i = this, e(this, "context", new (Ex())()), e(this, "timers", k.create()), e(this, "previousCurrentTime", 0), e(this, "_isStuck", !1), e(this, "mediaStreamDestination", void 0), e(this, "unload", () => (this.timers.unload(), this.context.removeEventListener("statechange", this.onStateChange), this.context.state === "closed" ? Promise.resolve() : this.context.close())), e(this, "createGain", () => this.context.createGain()), e(this, "createBuffer", (e, t, n) => this.context.createBuffer(e, t, n)), e(this, "createBufferSource", () => this.context.createBufferSource()), e(this, "getMediaStreamDestination", () => (this.mediaStreamDestination || (this.mediaStreamDestination = this.context.createMediaStreamDestination()), this.mediaStreamDestination)), e(this, "getDefaultDestination", () => this.context.destination), e(this, "createSplitter", () => this.context.createChannelSplitter(2)), e(this, "resume", t(function* () {
|
|
9879
9905
|
let e = !0, t = i.context.resume();
|
|
9880
9906
|
t.then(() => {
|
|
9881
9907
|
e = !1;
|
|
@@ -9910,10 +9936,10 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9910
9936
|
return this.context.state;
|
|
9911
9937
|
}
|
|
9912
9938
|
};
|
|
9913
|
-
e(
|
|
9939
|
+
e(Dx, "CHECK_INTERVAL", 1e3);
|
|
9914
9940
|
//#endregion
|
|
9915
9941
|
//#region ../../libs/web-audio-player/src/AudioPlayer.ts
|
|
9916
|
-
var
|
|
9942
|
+
var Ox, kx = 150, Ax = 400, jx = (e) => e === void 0 ? 5 : e <= kx ? 1 : e <= Ax ? 2 : 5, Mx = class extends ne {
|
|
9917
9943
|
get isContextRunning() {
|
|
9918
9944
|
var e;
|
|
9919
9945
|
return ((e = this.audio) == null ? void 0 : e.state) === "running";
|
|
@@ -9960,7 +9986,7 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
9960
9986
|
return this._bufferTime;
|
|
9961
9987
|
}
|
|
9962
9988
|
set bufferTime(e) {
|
|
9963
|
-
this._bufferTime = e, this.audioBufferMultiplier =
|
|
9989
|
+
this._bufferTime = e, this.audioBufferMultiplier = jx(e);
|
|
9964
9990
|
}
|
|
9965
9991
|
get sinkPaused() {
|
|
9966
9992
|
return this._sinkPaused;
|
|
@@ -10066,7 +10092,7 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
10066
10092
|
this.ignoreSuspendCalls = !1, this.emit("state change", "suspended");
|
|
10067
10093
|
}), e(this, "getAudioContext", () => this.audio ? this.audio : this.setupContext()), e(this, "setupContext", () => {
|
|
10068
10094
|
var e, t, r;
|
|
10069
|
-
return (e = this.audio) == null || e.unload(), this.audio = new
|
|
10095
|
+
return (e = this.audio) == null || e.unload(), this.audio = new Dx(), this.audio.on("state", (e) => {
|
|
10070
10096
|
this.logger.info("AudioContext state change", { state: e }), e === "running" && (this._muted = this._userProvidedMuted, this.setGain(this._volume)), !this.ignoreSuspendCalls && this.emit("state change", e);
|
|
10071
10097
|
}), this.audio.on("stuck", () => {
|
|
10072
10098
|
if (!this.reInitWhenStuck) {
|
|
@@ -10077,7 +10103,7 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
10077
10103
|
}), (t = this.gainNode) == null || t.disconnect(), this.gainNode = this.audio.createGain(), this.setGain(this._volume), this.startTime = this.audio.currentTime, (r = this.splitter) == null || r.disconnect(), this.splitter = this.audio.createSplitter(), this.audio;
|
|
10078
10104
|
}), e(this, "setGain", (e) => {
|
|
10079
10105
|
this.gainNode && (this.gainNode.gain.value = this._muted ? 0 : e);
|
|
10080
|
-
}), this._muted = o, this._userProvidedMuted = o, this.logger = i, this.clockSource = a, this.reInitWhenStuck = s, this._bufferTime = c, this.audioBufferMultiplier =
|
|
10106
|
+
}), this._muted = o, this._userProvidedMuted = o, this.logger = i, this.clockSource = a, this.reInitWhenStuck = s, this._bufferTime = c, this.audioBufferMultiplier = jx(c);
|
|
10081
10107
|
}
|
|
10082
10108
|
useMediaStreamDestination() {
|
|
10083
10109
|
var e;
|
|
@@ -10090,10 +10116,10 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
10090
10116
|
return (e = this.gainNode) == null || e.connect(t), t;
|
|
10091
10117
|
}
|
|
10092
10118
|
};
|
|
10093
|
-
|
|
10119
|
+
Ox = Mx, e(Mx, "create", (e, t, n) => new Ox(e, t, n));
|
|
10094
10120
|
//#endregion
|
|
10095
10121
|
//#region ../../libs/web-sdk/src/players/VideoPlayer.ts
|
|
10096
|
-
var
|
|
10122
|
+
var Nx, Px = class {
|
|
10097
10123
|
constructor(t, n, r, i, a, o) {
|
|
10098
10124
|
e(this, "staleFrameThresholdMs", 400), e(this, "pool", void 0), e(this, "logger", void 0), e(this, "videoRenderer", new Vr()), e(this, "videoFrameCanvas2DRenderer", null), e(this, "renderQueue", []), e(this, "clockSource", void 0), e(this, "isFirstFrame", !0), e(this, "usingWebCodecs", !1), e(this, "onCanvasChangeCallback", void 0), e(this, "onRendererErrorCallback", void 0), e(this, "animationFrameRequest", void 0), e(this, "firstFrameAnimationFrameRequest", void 0), e(this, "pendingFirstFrameSample", void 0), e(this, "renderedFrameCount", 0), e(this, "rendererDroppedFrameCount", 0), e(this, "renderTargetSize", void 0), e(this, "load", () => {
|
|
10099
10125
|
this.videoRenderer.load(), this.subscribeToContextLost(this.videoRenderer);
|
|
@@ -10183,12 +10209,12 @@ var Dx, Ox = class {
|
|
|
10183
10209
|
}), this.logger = t, this.clockSource = n, this.pool = r, this.renderTargetSize = i || this.videoRenderer.canvas, this.onCanvasChangeCallback = a, this.onRendererErrorCallback = o;
|
|
10184
10210
|
}
|
|
10185
10211
|
};
|
|
10186
|
-
|
|
10212
|
+
Nx = Px, e(Px, "create", (e, t, n, r, i, a) => new Nx(e, t, n, r, i, a));
|
|
10187
10213
|
//#endregion
|
|
10188
10214
|
//#region ../../libs/web-sdk/src/TextTracks.ts
|
|
10189
|
-
var
|
|
10215
|
+
var Fx = /* @__PURE__ */ new WeakMap(), Ix = class {
|
|
10190
10216
|
constructor() {
|
|
10191
|
-
i(this,
|
|
10217
|
+
i(this, Fx, []), a(Fx, this, []);
|
|
10192
10218
|
}
|
|
10193
10219
|
addTextTrack(e, t, n) {
|
|
10194
10220
|
let r = [], i = {
|
|
@@ -10205,43 +10231,43 @@ var kx = /* @__PURE__ */ new WeakMap(), Ax = class {
|
|
|
10205
10231
|
t !== -1 && r.splice(t, 1);
|
|
10206
10232
|
}
|
|
10207
10233
|
};
|
|
10208
|
-
return s(
|
|
10234
|
+
return s(Fx, this).push(i), i;
|
|
10209
10235
|
}
|
|
10210
10236
|
set language(e) {
|
|
10211
|
-
s(
|
|
10237
|
+
s(Fx, this).forEach((t) => {
|
|
10212
10238
|
t.language === e ? t.mode = "showing" : t.mode = "hidden";
|
|
10213
10239
|
});
|
|
10214
10240
|
}
|
|
10215
10241
|
get language() {
|
|
10216
10242
|
var e;
|
|
10217
|
-
return (e = s(
|
|
10243
|
+
return (e = s(Fx, this).find((e) => e.mode === "showing")) == null ? void 0 : e.language;
|
|
10218
10244
|
}
|
|
10219
10245
|
get tracks() {
|
|
10220
|
-
return s(
|
|
10246
|
+
return s(Fx, this);
|
|
10221
10247
|
}
|
|
10222
10248
|
get activeTrack() {
|
|
10223
|
-
return s(
|
|
10249
|
+
return s(Fx, this).find((e) => e.mode === "showing");
|
|
10224
10250
|
}
|
|
10225
10251
|
getActiveCues(e) {
|
|
10226
|
-
let t = s(
|
|
10252
|
+
let t = s(Fx, this).find((e) => e.mode === "showing");
|
|
10227
10253
|
return t ? t.cues.filter(({ startTime: t, endTime: n }) => e >= t && e < n) : [];
|
|
10228
10254
|
}
|
|
10229
|
-
},
|
|
10255
|
+
}, Lx = (e, t) => {
|
|
10230
10256
|
let n;
|
|
10231
10257
|
for (n = t; e > 1; e--) n += t;
|
|
10232
10258
|
return n;
|
|
10233
|
-
},
|
|
10259
|
+
}, Rx = class {
|
|
10234
10260
|
constructor() {
|
|
10235
10261
|
e(this, "audio", void 0), e(this, "unmute", () => this.audio.play().catch(n));
|
|
10236
10262
|
let t = document.createElement("div");
|
|
10237
10263
|
t.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
|
|
10238
10264
|
let r = t.children.item(0);
|
|
10239
|
-
if (r instanceof HTMLAudioElement) this.audio = r, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" +
|
|
10265
|
+
if (r instanceof HTMLAudioElement) this.audio = r, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + Lx(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + Lx(16, "gICA") + Lx(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + Lx(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + Lx(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + Lx(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + Lx(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
|
|
10240
10266
|
else throw Error("Failed to create audio tag");
|
|
10241
10267
|
}
|
|
10242
|
-
},
|
|
10268
|
+
}, zx, Bx = class {
|
|
10243
10269
|
constructor(t, n, r, i, a, o, s, c) {
|
|
10244
|
-
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "audioPlayer", void 0), e(this, "videoPlayer", void 0), e(this, "pool", void 0), e(this, "unmuter", new
|
|
10270
|
+
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "audioPlayer", void 0), e(this, "videoPlayer", void 0), e(this, "pool", void 0), e(this, "unmuter", new Rx()), e(this, "_isPaused", !1), e(this, "isDisconnected", !1), e(this, "timers", new k()), e(this, "isVideoRenderingEnabled", !0), e(this, "isLoaded", !1), e(this, "isSuspended", !0), e(this, "isVideoPlayerLoaded", !1), e(this, "volumeState", void 0), e(this, "textTracks", new Ix()), e(this, "playbackRate", void 0), e(this, "emitVolumeState", () => {
|
|
10245
10271
|
let e = {
|
|
10246
10272
|
volume: this.volume,
|
|
10247
10273
|
isMuted: this.userMuted
|
|
@@ -10283,13 +10309,13 @@ var kx = /* @__PURE__ */ new WeakMap(), Ax = class {
|
|
|
10283
10309
|
e instanceof Error && this.emitter.emit("error", zn(!1, e));
|
|
10284
10310
|
}
|
|
10285
10311
|
this.isVideoRenderingEnabled && this.videoPlayer.onDecodedFrame(e);
|
|
10286
|
-
}), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer =
|
|
10312
|
+
}), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer = Mx.create(this.logger.createContext("AudioPlayerModule"), i, {
|
|
10287
10313
|
muted: a,
|
|
10288
10314
|
reInitWhenStuck: !0,
|
|
10289
10315
|
bufferTime: c
|
|
10290
10316
|
}), o !== void 0 && (this.audioPlayer.volume = o), this.audioPlayer.on("stuck", () => {
|
|
10291
10317
|
this.isDisconnected = !0;
|
|
10292
|
-
}), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer =
|
|
10318
|
+
}), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer = Px.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, void 0, s);
|
|
10293
10319
|
}
|
|
10294
10320
|
get volume() {
|
|
10295
10321
|
return this.audioPlayer.volume;
|
|
@@ -10348,29 +10374,29 @@ var kx = /* @__PURE__ */ new WeakMap(), Ax = class {
|
|
|
10348
10374
|
this._isPaused = !0, this.audioPlayer.pause(), this.emitter.emit("media element state", "paused");
|
|
10349
10375
|
}
|
|
10350
10376
|
};
|
|
10351
|
-
|
|
10377
|
+
zx = Bx, e(Bx, "create", (e, t, n, r, i, a, o, s) => new zx(e, t, n, r, i, a, o, s));
|
|
10352
10378
|
//#endregion
|
|
10353
10379
|
//#region ../../libs/web-sdk/src/modules/MediaSessionModule.ts
|
|
10354
|
-
var
|
|
10380
|
+
var Vx, Hx = [
|
|
10355
10381
|
"play",
|
|
10356
10382
|
"pause",
|
|
10357
10383
|
"stop"
|
|
10358
|
-
],
|
|
10384
|
+
], Ux, Wx = /* @__PURE__ */ new Set(), Gx = class t {
|
|
10359
10385
|
constructor(n, r, i) {
|
|
10360
10386
|
e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "options", void 0), e(this, "isLoaded", !1), e(this, "playbackState", void 0), e(this, "pageMetadata", null), e(this, "load", () => {
|
|
10361
|
-
this.isLoaded || !t.isSupported() || (this.isLoaded = !0,
|
|
10387
|
+
this.isLoaded || !t.isSupported() || (this.isLoaded = !0, Wx.add(this), this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("volume state", this.update));
|
|
10362
10388
|
}), e(this, "unload", () => {
|
|
10363
10389
|
var e;
|
|
10364
|
-
this.isLoaded && (this.isLoaded = !1,
|
|
10390
|
+
this.isLoaded && (this.isLoaded = !1, Wx.delete(this), this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("volume state", this.update), this.handOverOwnership("on unload"), (e = this.options.decoy) == null || e.unload());
|
|
10365
10391
|
}), e(this, "stop", () => {
|
|
10366
10392
|
var e;
|
|
10367
|
-
this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(),
|
|
10393
|
+
this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(), Ux === this && this.handOverOwnership("on stop");
|
|
10368
10394
|
}), e(this, "getStatistics", () => {
|
|
10369
10395
|
var e;
|
|
10370
10396
|
return {
|
|
10371
10397
|
mediaSessionSupported: t.isSupported(),
|
|
10372
|
-
mediaSessionOwner:
|
|
10373
|
-
mediaSessionPlaybackState:
|
|
10398
|
+
mediaSessionOwner: Ux === this,
|
|
10399
|
+
mediaSessionPlaybackState: Ux === this ? this.isPaused ? "paused" : "playing" : "none",
|
|
10374
10400
|
decoyState: (e = this.options.decoy) == null ? void 0 : e.getStatistics().decoyState
|
|
10375
10401
|
};
|
|
10376
10402
|
}), e(this, "onPlaybackState", (e) => {
|
|
@@ -10379,23 +10405,23 @@ var Fx, Ix = [
|
|
|
10379
10405
|
this.update();
|
|
10380
10406
|
}), e(this, "update", () => {
|
|
10381
10407
|
if (this.isLoaded) {
|
|
10382
|
-
if (this.isEligibleToOwn &&
|
|
10408
|
+
if (this.isEligibleToOwn && Ux !== this) {
|
|
10383
10409
|
this.claimOwnership();
|
|
10384
10410
|
return;
|
|
10385
10411
|
}
|
|
10386
10412
|
this.sync();
|
|
10387
10413
|
}
|
|
10388
10414
|
}), e(this, "handOverOwnership", (e) => {
|
|
10389
|
-
if (
|
|
10415
|
+
if (Ux === this) {
|
|
10390
10416
|
this.logger.debug(`Handing over the media session ${e}`), this.releaseOwnership();
|
|
10391
|
-
for (let e of
|
|
10417
|
+
for (let e of Wx) if (e !== this && e.isEligibleToOwn) {
|
|
10392
10418
|
e.claimOwnership();
|
|
10393
10419
|
return;
|
|
10394
10420
|
}
|
|
10395
10421
|
}
|
|
10396
10422
|
}), e(this, "sync", () => {
|
|
10397
10423
|
var e, t, n, r, i, a;
|
|
10398
|
-
if (
|
|
10424
|
+
if (Ux !== this) return;
|
|
10399
10425
|
if ((e = (t = this.options).isSuppressed) != null && e.call(t)) {
|
|
10400
10426
|
var o;
|
|
10401
10427
|
(o = this.options.decoy) == null || o.unload(), this.handOverOwnership("as suppressed");
|
|
@@ -10428,8 +10454,8 @@ var Fx, Ix = [
|
|
|
10428
10454
|
(f = this.options.decoy) == null || f.play();
|
|
10429
10455
|
}
|
|
10430
10456
|
}), e(this, "claimOwnership", () => {
|
|
10431
|
-
|
|
10432
|
-
for (let e of
|
|
10457
|
+
Ux == null || Ux.releaseOwnership(), Ux = this, this.pageMetadata = navigator.mediaSession.metadata, this.applyMetadata();
|
|
10458
|
+
for (let e of Hx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, this.onAction[e]));
|
|
10433
10459
|
this.safely("position state", () => {
|
|
10434
10460
|
var e, t;
|
|
10435
10461
|
return (e = (t = navigator.mediaSession).setPositionState) == null ? void 0 : e.call(t, {
|
|
@@ -10445,9 +10471,9 @@ var Fx, Ix = [
|
|
|
10445
10471
|
});
|
|
10446
10472
|
}), e(this, "releaseOwnership", () => {
|
|
10447
10473
|
var e;
|
|
10448
|
-
if (
|
|
10449
|
-
|
|
10450
|
-
for (let e of
|
|
10474
|
+
if (Ux === this) {
|
|
10475
|
+
Ux = void 0, (e = this.options.decoy) == null || e.pause();
|
|
10476
|
+
for (let e of Hx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, null));
|
|
10451
10477
|
this.options.metadata && this.safely("metadata restore", () => {
|
|
10452
10478
|
navigator.mediaSession.metadata = this.pageMetadata;
|
|
10453
10479
|
}), this.safely("release", () => {
|
|
@@ -10481,15 +10507,15 @@ var Fx, Ix = [
|
|
|
10481
10507
|
return this.playbackState !== void 0 && !this.isPaused && !this.options.isMuted() && ((e = (t = this.options).isSuppressed) == null ? void 0 : e.call(t)) !== !0;
|
|
10482
10508
|
}
|
|
10483
10509
|
};
|
|
10484
|
-
|
|
10510
|
+
Vx = Gx, e(Gx, "create", (e, t, n) => new Vx(e, t, n)), e(Gx, "isSupported", () => typeof navigator < "u" && "mediaSession" in navigator && typeof MediaMetadata < "u");
|
|
10485
10511
|
//#endregion
|
|
10486
10512
|
//#region ../../libs/web-sdk/src/modules/ModernCanvasModule.ts
|
|
10487
|
-
var
|
|
10513
|
+
var Kx, qx = class {
|
|
10488
10514
|
constructor(t, r, i, a, { muted: o, volume: s, type: c, poster: l, offscreenCanvas: u, bufferTime: d, backgroundPlaybackEnabled: f, splitAudio: p }) {
|
|
10489
10515
|
if (e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "sound", void 0), e(this, "wantsPlay", void 0), e(this, "audioPlayer", void 0), e(this, "videoPlayer", void 0), e(this, "pool", void 0), e(this, "isDisconnected", !0), e(this, "_userProvidedMuted", !1), e(this, "timers", new k()), e(this, "offscreenCanvas", void 0), e(this, "videoTrack", void 0), e(this, "canvasCaptureTracks", []), e(this, "backgroundPlaybackEnabled", void 0), e(this, "nativeTracksByLanguage", /* @__PURE__ */ new Map()), e(this, "nativeCuesByLanguage", /* @__PURE__ */ new Map()), e(this, "lastCanvasCueTexts", []), e(this, "isIOSNativeFullscreen", !1), e(this, "knownNativeLanguage", void 0), e(this, "renderCanvasSubtitlesInNativeFullscreen", (() => {
|
|
10490
10516
|
let e = Ge().platform;
|
|
10491
10517
|
return e.isIOS && e.iosVersion <= 16;
|
|
10492
|
-
})()), e(this, "volumeState", void 0), e(this, "textTracks", new
|
|
10518
|
+
})()), e(this, "volumeState", void 0), e(this, "textTracks", new Ix()), e(this, "reset", () => {}), e(this, "load", () => {
|
|
10493
10519
|
this.mediaElement.load(), this.sound && (this.sound.load(), document.body.appendChild(this.sound.element), this.mediaElement.element.addEventListener("pause", this.onVideoPause), this.mediaElement.element.addEventListener("play", this.onVideoPlay), window.addEventListener("focus", this.onWindowFocus)), this.emitter.on("decoded frame", this.onDecodedFrame), this.emitter.on("flush buffers", this.flushBuffers), this.emitter.on("ios-hack: reset size", this.resetCanvasSize), this.emitter.on("enter picture in picture", this.onEnterIOSHack), this.emitter.on("exit picture in picture", this.onExitIOSHack), this.element().element.textTracks.addEventListener("change", this.onNativeTextTrackChange), this.element().element.addEventListener("webkitendfullscreen", this.onExitIOSHack), this.element().element.addEventListener("webkitbeginfullscreen", this.onEnterIOSHack), this.videoPlayer.load(), this.timers.setInterval(this.syncNativeTextTracks, 100);
|
|
10494
10520
|
}), e(this, "unload", () => {
|
|
10495
10521
|
this.emitter.off("target buffer time", this.onTargetBufferTime), this.emitter.off("decoded frame", this.onDecodedFrame), this.emitter.off("flush buffers", this.flushBuffers), this.emitter.off("ios-hack: reset size", this.resetCanvasSize), this.emitter.off("enter picture in picture", this.onEnterIOSHack), this.emitter.off("exit picture in picture", this.onExitIOSHack), this.element().element.textTracks.removeEventListener("change", this.onNativeTextTrackChange), this.element().element.removeEventListener("webkitendfullscreen", this.onExitIOSHack), this.element().element.removeEventListener("webkitbeginfullscreen", this.onEnterIOSHack);
|
|
@@ -10642,13 +10668,13 @@ var Bx, Vx = class {
|
|
|
10642
10668
|
}), this.soundElement.on("media element state", (e) => {
|
|
10643
10669
|
e === "paused" && this.audioPlayer.flushBuffer(), this.audioPlayer.sinkPaused = e === "paused", this.emitPlaybackState();
|
|
10644
10670
|
}), this.sound) for (let e of this.elements()) e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("error", (e) => this.emitter.emit("error", e));
|
|
10645
|
-
this.audioPlayer =
|
|
10671
|
+
this.audioPlayer = Mx.create(this.logger.createContext("AudioPlayerModule"), a, {
|
|
10646
10672
|
muted: !1,
|
|
10647
10673
|
reInitWhenStuck: !1,
|
|
10648
10674
|
bufferTime: d
|
|
10649
10675
|
}), this.audioPlayer.on("state change", (e) => {
|
|
10650
10676
|
e === "suspended" || e === "interrupted" ? this.soundElement.muted = !0 : e === "running" && this.applyVisibilityMutePolicy(), this.updateVolumeState();
|
|
10651
|
-
}), this.videoPlayer =
|
|
10677
|
+
}), this.videoPlayer = Px.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, this.mediaElement.element, () => this.reconnectCanvasStream(), this.onVideoPlayerError);
|
|
10652
10678
|
}
|
|
10653
10679
|
get volume() {
|
|
10654
10680
|
return this.soundElement.volume;
|
|
@@ -10720,10 +10746,10 @@ var Bx, Vx = class {
|
|
|
10720
10746
|
return this.renderCanvasSubtitlesInNativeFullscreen && !this.offscreenCanvas;
|
|
10721
10747
|
}
|
|
10722
10748
|
};
|
|
10723
|
-
|
|
10749
|
+
Kx = qx, e(qx, "create", (e, t, n, r, i) => new Kx(e, t, n, r, i));
|
|
10724
10750
|
//#endregion
|
|
10725
10751
|
//#region ../../libs/web-sdk/src/modules/MseModule.ts
|
|
10726
|
-
var
|
|
10752
|
+
var Jx, Yx = class {
|
|
10727
10753
|
constructor() {
|
|
10728
10754
|
e(this, "initSegments", /* @__PURE__ */ new Map()), e(this, "set", (e, t, n) => {
|
|
10729
10755
|
var r;
|
|
@@ -10735,7 +10761,7 @@ var Hx, Ux = class {
|
|
|
10735
10761
|
});
|
|
10736
10762
|
}
|
|
10737
10763
|
};
|
|
10738
|
-
function
|
|
10764
|
+
function Xx(e, { mediaSource: t, mimeType: n, codec: r }) {
|
|
10739
10765
|
return x(x({}, e), {}, {
|
|
10740
10766
|
state: "initialized",
|
|
10741
10767
|
mimeType: n,
|
|
@@ -10747,10 +10773,10 @@ function Wx(e, { mediaSource: t, mimeType: n, codec: r }) {
|
|
|
10747
10773
|
lastBufferCleanupTime: performance.now()
|
|
10748
10774
|
});
|
|
10749
10775
|
}
|
|
10750
|
-
function
|
|
10776
|
+
function Zx({ initSegments: e, pendingSamples: t }) {
|
|
10751
10777
|
return {
|
|
10752
10778
|
state: "uninitialized",
|
|
10753
|
-
initSegments: e == null ? new
|
|
10779
|
+
initSegments: e == null ? new Yx() : e,
|
|
10754
10780
|
sequenceNumber: 0,
|
|
10755
10781
|
isWorkingOnPendingSamples: !1,
|
|
10756
10782
|
hasFirstSync: t.some((e) => e.isSync),
|
|
@@ -10760,7 +10786,7 @@ function Gx({ initSegments: e, pendingSamples: t }) {
|
|
|
10760
10786
|
successfulAppendCalls: 0
|
|
10761
10787
|
};
|
|
10762
10788
|
}
|
|
10763
|
-
var
|
|
10789
|
+
var Qx = class {
|
|
10764
10790
|
constructor(r, i, a) {
|
|
10765
10791
|
var o = this;
|
|
10766
10792
|
e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", k.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new Js()), e(this, "trackContexts", /* @__PURE__ */ new Map()), e(this, "autoRecoverFromMediaErrors", !0), e(this, "quotaErrorCount", 0), e(this, "recoveredFromErrorCount", 0), e(this, "sourceOpenStartTime", performance.now()), e(this, "sourceOpenEndTime", performance.now()), e(this, "pendingTracksToAddSourceBuffers", void 0), e(this, "hasAddedInitialPosterFrame", !0), e(this, "videoKeyframeTimestamps", []), e(this, "isReopening", !1), e(this, "pendingMediaError", void 0), e(this, "isFlushDeferred", !1), e(this, "hasRecoveredSinceShown", !1), e(this, "playbackStallCount", 0), e(this, "hasStartedPlayback", !1), e(this, "isPlaybackStalled", !1), e(this, "load", () => {
|
|
@@ -10806,7 +10832,7 @@ var Kx = class {
|
|
|
10806
10832
|
var n, r, i;
|
|
10807
10833
|
let a = e.get(t), o = (n = a == null ? void 0 : a.pendingSamples) == null ? [] : n, s = a == null ? void 0 : a.initSegments, c = (r = a == null ? void 0 : a.pendingSamplesOffset) == null ? 0 : r;
|
|
10808
10834
|
for (; c < o.length && !((i = o[c]) != null && i.isSync);) c++;
|
|
10809
|
-
let l =
|
|
10835
|
+
let l = Zx({
|
|
10810
10836
|
pendingSamples: o,
|
|
10811
10837
|
initSegments: s
|
|
10812
10838
|
});
|
|
@@ -10817,14 +10843,14 @@ var Kx = class {
|
|
|
10817
10843
|
this.trackContexts.forEach((e, n) => {
|
|
10818
10844
|
if (t.has(n)) return;
|
|
10819
10845
|
e.state === "initialized" && this.mediaSource.isOpen() && this.mediaSource.removeSourceBuffer(e.sourceBuffer);
|
|
10820
|
-
let r =
|
|
10846
|
+
let r = Zx({
|
|
10821
10847
|
pendingSamples: [],
|
|
10822
10848
|
initSegments: e.initSegments
|
|
10823
10849
|
});
|
|
10824
10850
|
this.trackContexts.set(n, r);
|
|
10825
10851
|
});
|
|
10826
10852
|
}), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "initializeSourceBuffer", (e, t) => {
|
|
10827
|
-
let n =
|
|
10853
|
+
let n = Xx(e, {
|
|
10828
10854
|
mimeType: t.mimeType,
|
|
10829
10855
|
mediaSource: this.mediaSource,
|
|
10830
10856
|
codec: t.codec
|
|
@@ -10851,9 +10877,9 @@ var Kx = class {
|
|
|
10851
10877
|
}
|
|
10852
10878
|
for (let t of e) {
|
|
10853
10879
|
let n = o.trackContexts.get(t.type);
|
|
10854
|
-
if (n || (n =
|
|
10880
|
+
if (n || (n = Zx({
|
|
10855
10881
|
pendingSamples: [],
|
|
10856
|
-
initSegments: new
|
|
10882
|
+
initSegments: new Yx()
|
|
10857
10883
|
}), o.trackContexts.set(t.type, n)), n.state === "initialized") {
|
|
10858
10884
|
if (t.mimeType !== n.sourceBufferMimeType) try {
|
|
10859
10885
|
yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
|
|
@@ -10870,7 +10896,7 @@ var Kx = class {
|
|
|
10870
10896
|
o.logger.warn("removeSourceBuffer failed", { removeError: t }), o.reopenMediaSource("changeType recovery failed"), o.pendingTracksToAddSourceBuffers = e;
|
|
10871
10897
|
return;
|
|
10872
10898
|
}
|
|
10873
|
-
let i =
|
|
10899
|
+
let i = Zx({
|
|
10874
10900
|
pendingSamples: n.pendingSamples,
|
|
10875
10901
|
initSegments: n.initSegments
|
|
10876
10902
|
});
|
|
@@ -10894,7 +10920,7 @@ var Kx = class {
|
|
|
10894
10920
|
};
|
|
10895
10921
|
}), e(this, "getNextBufferedRangeStart", (e) => {
|
|
10896
10922
|
let t = this.getCommonBufferedRangesForCurrentTracks();
|
|
10897
|
-
if (t) return
|
|
10923
|
+
if (t) return $x(e, t);
|
|
10898
10924
|
}), e(this, "getBufferedEndAt", (e) => {
|
|
10899
10925
|
var t;
|
|
10900
10926
|
let n = this.getCommonBufferedRangesForCurrentTracks();
|
|
@@ -10944,9 +10970,9 @@ var Kx = class {
|
|
|
10944
10970
|
s > 0 && performance.now() - r.lastBufferCleanupTime > 1e4 && (r.lastBufferCleanupTime = performance.now(), yield r.sourceBuffer.removeBuffer(0, s + 10));
|
|
10945
10971
|
try {
|
|
10946
10972
|
let t = r.sequenceNumber;
|
|
10947
|
-
if ("fragmented" in n) for (let t of
|
|
10973
|
+
if ("fragmented" in n) for (let t of iS(e)) {
|
|
10948
10974
|
var c;
|
|
10949
|
-
yield r.sourceBuffer.appendBuffer(
|
|
10975
|
+
yield r.sourceBuffer.appendBuffer(aS(t.map((e) => e.data)), (c = t[0]) == null ? void 0 : c.initData);
|
|
10950
10976
|
}
|
|
10951
10977
|
else {
|
|
10952
10978
|
let n = Ps(e, t++);
|
|
@@ -10994,7 +11020,7 @@ var Kx = class {
|
|
|
10994
11020
|
let t = this.trackContexts.get(e.type);
|
|
10995
11021
|
if (!t) throw Hn(e.type, e.renditionId);
|
|
10996
11022
|
let n = t.pendingSamples.length - t.pendingSamplesOffset;
|
|
10997
|
-
if (t.state === "uninitialized" && n >=
|
|
11023
|
+
if (t.state === "uninitialized" && n >= tS && (e.isSync || n >= 2 * tS) && (t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1), !(!t.hasFirstSync && !e.isSync)) {
|
|
10998
11024
|
if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
|
|
10999
11025
|
this.hasAddedInitialPosterFrame = !1;
|
|
11000
11026
|
let n = x({}, e);
|
|
@@ -11005,7 +11031,7 @@ var Kx = class {
|
|
|
11005
11031
|
let t = (e.timestamp + ((r = e.compositionTimeOffset) == null ? 0 : r)) / e.timescale * 1e3, n = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
|
|
11006
11032
|
n !== void 0 && t < n && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(t), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
|
|
11007
11033
|
}
|
|
11008
|
-
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples ||
|
|
11034
|
+
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || sS(t, this.append, this.maxChunkSize).catch((n) => {
|
|
11009
11035
|
if (t.isWorkingOnPendingSamples = !1, !this.isReopening) {
|
|
11010
11036
|
if (!this.isCurrentTrackContext(e.type, t)) {
|
|
11011
11037
|
this.logger.debug("Suppressing append error from stale track context", { type: e.type });
|
|
@@ -11124,14 +11150,14 @@ var Kx = class {
|
|
|
11124
11150
|
if (this.mediaSource.isClosed()) return;
|
|
11125
11151
|
let e = this.getInitializedTrackBuffers();
|
|
11126
11152
|
if (e.length !== 0) return this.getCommonBufferedRanges(e);
|
|
11127
|
-
}), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) =>
|
|
11153
|
+
}), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) => rS(e, t), e[0] ? Array.from(e[0]) : [])), e(this, "getPlaybackStateForBufferedRanges", (e, t) => nn(t, e) ? "playing" : "buffering"), this.logger = r, this.mediaElement = a, this.emitter = i;
|
|
11128
11154
|
}
|
|
11129
11155
|
};
|
|
11130
|
-
|
|
11131
|
-
let r = new
|
|
11156
|
+
Jx = Qx, e(Qx, "create", (e, t, n) => {
|
|
11157
|
+
let r = new Jx(e, t, n);
|
|
11132
11158
|
return r.setTrackContexts(), r.mediaSource.on("source ended", r.onSourceEnded), r.mediaSource.on("source open", r.onSourceOpen), n.addEventListener("error", r.onMediaElementError), n.addEventListener("waiting", r.onPlaybackStall), n.addEventListener("stalled", r.onPlaybackStall), n.addEventListener("playing", r.onPlaybackProgress), n.addEventListener("pause", r.onPlaybackPauseOrSeek), n.addEventListener("play", r.onPlay), n.addEventListener("seeking", r.onPlaybackPauseOrSeek), r.mediaSource.attach(n), r;
|
|
11133
11159
|
});
|
|
11134
|
-
var
|
|
11160
|
+
var $x = (e, t) => {
|
|
11135
11161
|
for (let r = 0; r < t.length; r++) {
|
|
11136
11162
|
let i = t[r];
|
|
11137
11163
|
if (i) {
|
|
@@ -11142,11 +11168,11 @@ var qx = (e, t) => {
|
|
|
11142
11168
|
}
|
|
11143
11169
|
}
|
|
11144
11170
|
}
|
|
11145
|
-
},
|
|
11171
|
+
}, eS = (e, t) => {
|
|
11146
11172
|
var n;
|
|
11147
11173
|
let r = e.renditionId !== t.renditionId, i = e.channelId !== t.channelId, a = ((n = e.timestamp) == null ? 0 : n) > t.timestamp, o = e.type === "video" && t.type === "video" && "levelIdc" in e && "levelIdc" in t && e.levelIdc !== t.levelIdc, s = !1;
|
|
11148
11174
|
return e.type === "video" && t.type === "video" && "width" in e && "width" in t && (s = t.width !== e.width || t.height !== e.height), i || r || a || s || o;
|
|
11149
|
-
},
|
|
11175
|
+
}, tS = 1e3, nS = 32, rS = (e, t) => {
|
|
11150
11176
|
let n = [], r = 0, i = 0;
|
|
11151
11177
|
for (; r < e.length && i < t.length;) {
|
|
11152
11178
|
let a = e[r], o = t[i];
|
|
@@ -11158,7 +11184,7 @@ var qx = (e, t) => {
|
|
|
11158
11184
|
}), a.end <= o.end ? r++ : i++;
|
|
11159
11185
|
}
|
|
11160
11186
|
return n;
|
|
11161
|
-
},
|
|
11187
|
+
}, iS = (e) => {
|
|
11162
11188
|
let t = [];
|
|
11163
11189
|
for (let r of e) {
|
|
11164
11190
|
var n;
|
|
@@ -11167,21 +11193,21 @@ var qx = (e, t) => {
|
|
|
11167
11193
|
(e == null || (n = e[0]) == null ? void 0 : n.initData) === r.initData ? e.push(r) : t.push([r]);
|
|
11168
11194
|
}
|
|
11169
11195
|
return t;
|
|
11170
|
-
},
|
|
11196
|
+
}, aS = (e) => {
|
|
11171
11197
|
if (e.length === 1 && e[0]) return e[0];
|
|
11172
11198
|
let t = new Uint8Array(e.reduce((e, t) => e + t.byteLength, 0)), n = 0;
|
|
11173
11199
|
for (let r of e) t.set(r, n), n += r.byteLength;
|
|
11174
11200
|
return t;
|
|
11175
|
-
},
|
|
11201
|
+
}, oS = (e) => {
|
|
11176
11202
|
let t = e.pendingSamplesOffset;
|
|
11177
11203
|
if (t !== 0) {
|
|
11178
11204
|
if (t >= e.pendingSamples.length) {
|
|
11179
11205
|
e.pendingSamples = [], e.pendingSamplesOffset = 0;
|
|
11180
11206
|
return;
|
|
11181
11207
|
}
|
|
11182
|
-
t <
|
|
11208
|
+
t < nS || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0);
|
|
11183
11209
|
}
|
|
11184
|
-
},
|
|
11210
|
+
}, sS = function() {
|
|
11185
11211
|
var e = t(function* (e, t, n) {
|
|
11186
11212
|
for (e.isWorkingOnPendingSamples = !0; e.pendingSamplesOffset < e.pendingSamples.length;) {
|
|
11187
11213
|
let r = [], i = e.pendingSamplesOffset;
|
|
@@ -11189,7 +11215,7 @@ var qx = (e, t) => {
|
|
|
11189
11215
|
i = t;
|
|
11190
11216
|
let a = e.pendingSamples[t], o = e.pendingSamples[t + 1];
|
|
11191
11217
|
if (a && (r.push(a), o)) {
|
|
11192
|
-
if (
|
|
11218
|
+
if (eS(a, o)) break;
|
|
11193
11219
|
let e = (a.timestamp + a.duration) / a.timescale;
|
|
11194
11220
|
if (o.timestamp / o.timescale - e > .1) break;
|
|
11195
11221
|
}
|
|
@@ -11197,14 +11223,14 @@ var qx = (e, t) => {
|
|
|
11197
11223
|
}
|
|
11198
11224
|
let a = r[0];
|
|
11199
11225
|
if (!a) break;
|
|
11200
|
-
yield t(r, e.previousSample ?
|
|
11226
|
+
yield t(r, e.previousSample ? eS(e.previousSample, a) : !0), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], oS(e);
|
|
11201
11227
|
}
|
|
11202
11228
|
e.isWorkingOnPendingSamples = !1;
|
|
11203
11229
|
});
|
|
11204
11230
|
return function(t, n, r) {
|
|
11205
11231
|
return e.apply(this, arguments);
|
|
11206
11232
|
};
|
|
11207
|
-
}(),
|
|
11233
|
+
}(), cS, lS = class {
|
|
11208
11234
|
constructor(n, r) {
|
|
11209
11235
|
var i = this;
|
|
11210
11236
|
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "element", void 0), e(this, "pictureInPictureWindow", void 0), e(this, "unload", () => {
|
|
@@ -11236,10 +11262,10 @@ var qx = (e, t) => {
|
|
|
11236
11262
|
}()), e(this, "isWebkitPresentationModeSupported", () => !!this.element && lt(this.element)), this.emitter = n, this.logger = r, this.emitter.on("add picture in picture listener", this.onEnablePictureInPicture);
|
|
11237
11263
|
}
|
|
11238
11264
|
};
|
|
11239
|
-
|
|
11265
|
+
cS = lS, e(lS, "create", (e, t) => new cS(e, t));
|
|
11240
11266
|
//#endregion
|
|
11241
11267
|
//#region ../../libs/web-sdk/src/modules/PlaybackModule.ts
|
|
11242
|
-
var
|
|
11268
|
+
var uS, dS = class {
|
|
11243
11269
|
constructor(t, n, r, i) {
|
|
11244
11270
|
e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "clockSource", void 0), e(this, "state", "buffering"), e(this, "bufferFullness", 0), e(this, "targetBufferTime", void 0), e(this, "lastBufferStateEvent", "drained"), e(this, "firstFrameTime", void 0), e(this, "currentTimeIsInRange", !1), e(this, "needsInputForAudioCount", 0), e(this, "needsInputForVideoCount", 0), e(this, "unload", () => {
|
|
11245
11271
|
this.emitter.off("buffer state", this.onBufferedStateChanged), this.emitter.off("needs user input", this.onNeedsUserInput);
|
|
@@ -11257,24 +11283,24 @@ var iS, aS = class {
|
|
|
11257
11283
|
}), this.emitter = t, this.logger = n, this.clockSource = r, this.targetBufferTime = i, this.emitter.on("buffer state", this.onBufferedStateChanged), this.emitter.on("needs user input", this.onNeedsUserInput), this.emitter.emit("target buffer time", i);
|
|
11258
11284
|
}
|
|
11259
11285
|
};
|
|
11260
|
-
|
|
11286
|
+
uS = dS, e(dS, "create", (e, t, n, r) => new uS(e, t, n, r));
|
|
11261
11287
|
//#endregion
|
|
11262
11288
|
//#region ../../libs/web-sdk/src/modules/QualityOfServiceModule.ts
|
|
11263
|
-
var
|
|
11289
|
+
var fS, pS = () => ({
|
|
11264
11290
|
upgradesFromLevel: [],
|
|
11265
11291
|
downgradesFromLevel: [],
|
|
11266
11292
|
bufferingRanges: [],
|
|
11267
11293
|
activeRanges: [],
|
|
11268
11294
|
decodeRate: 2 ** 53 - 1
|
|
11269
|
-
}),
|
|
11295
|
+
}), mS = () => ({
|
|
11270
11296
|
levels: {},
|
|
11271
11297
|
levelDowngrades: [],
|
|
11272
11298
|
levelUpgrades: [],
|
|
11273
11299
|
bufferFullness: 0,
|
|
11274
|
-
general:
|
|
11275
|
-
}),
|
|
11300
|
+
general: pS()
|
|
11301
|
+
}), hS = 100, gS = 3600, _S = 1e3, vS = class {
|
|
11276
11302
|
constructor(t, n, i, a) {
|
|
11277
|
-
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", k.create()), e(this, "metrics",
|
|
11303
|
+
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", k.create()), e(this, "metrics", mS()), e(this, "bufferFullness", new r(Infinity)), e(this, "bufferFullnessRegression", void 0), e(this, "lastDeliveryResumeTime", -Infinity), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "renditionLevelSource", void 0), e(this, "targetBufferTimeSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasPlayedInSession", !1), e(this, "hasAsserted", !1), e(this, "load", () => {
|
|
11278
11304
|
this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("buffer fullness", this.onBufferFullness), this.emitter.on("media delivery resumed", this.onMediaDeliveryResumed), this.emitter.on("rendition level changed", this.onRenditionLevelChanged), this.emitter.on("video decode rate", this.onVideoDecodeRate), this.emitter.on("connection state", this.onConnectionState);
|
|
11279
11305
|
}), e(this, "unload", () => {
|
|
11280
11306
|
this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("media delivery resumed", this.onMediaDeliveryResumed), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("connection state", this.onConnectionState), this.suspend();
|
|
@@ -11292,7 +11318,7 @@ var oS, sS = () => ({
|
|
|
11292
11318
|
return this.metrics.levels[a];
|
|
11293
11319
|
}), e(this, "getBufferFullnessRegression", (e = !1) => {
|
|
11294
11320
|
if (!e) return this.bufferFullnessRegression;
|
|
11295
|
-
if (performance.now() - this.lastDeliveryResumeTime <
|
|
11321
|
+
if (performance.now() - this.lastDeliveryResumeTime < _S) return;
|
|
11296
11322
|
let t = this.bufferFullness.items().filter(({ time: e }) => e >= this.lastDeliveryResumeTime);
|
|
11297
11323
|
return t.length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression(t) : void 0;
|
|
11298
11324
|
}), e(this, "getTargetBufferTime", () => {
|
|
@@ -11352,21 +11378,21 @@ var oS, sS = () => ({
|
|
|
11352
11378
|
let d = !1;
|
|
11353
11379
|
if (e.from) {
|
|
11354
11380
|
var f;
|
|
11355
|
-
let e = (f = this.metrics.levels[l]) == null ?
|
|
11381
|
+
let e = (f = this.metrics.levels[l]) == null ? pS() : f;
|
|
11356
11382
|
l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), Zt(e.activeRanges);
|
|
11357
11383
|
let t = e.bufferingRanges[e.bufferingRanges.length - 1];
|
|
11358
11384
|
d = !!t && !t.end, Zt(e.bufferingRanges), this.metrics.levels[l] = e;
|
|
11359
11385
|
}
|
|
11360
11386
|
if (e.to) {
|
|
11361
11387
|
var p;
|
|
11362
|
-
let e = (p = this.metrics.levels[u]) == null ?
|
|
11388
|
+
let e = (p = this.metrics.levels[u]) == null ? pS() : p;
|
|
11363
11389
|
Qt(e.activeRanges), d && Qt(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
|
|
11364
11390
|
}
|
|
11365
11391
|
}), e(this, "onMediaDeliveryResumed", () => {
|
|
11366
11392
|
this.lastDeliveryResumeTime = performance.now();
|
|
11367
11393
|
}), e(this, "onBufferFullness", (e) => {
|
|
11368
11394
|
if (this.metrics.bufferFullness = e, this.isSuspended) return;
|
|
11369
|
-
let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e /
|
|
11395
|
+
let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e / hS);
|
|
11370
11396
|
if (n && r(n.time) === r(t)) n.time = t, n.value = e;
|
|
11371
11397
|
else {
|
|
11372
11398
|
var i, a;
|
|
@@ -11374,7 +11400,7 @@ var oS, sS = () => ({
|
|
|
11374
11400
|
time: t,
|
|
11375
11401
|
value: e
|
|
11376
11402
|
});
|
|
11377
|
-
let n = this.bufferFullness.items(), r = (i = (a = n[n.length - this.minBufferFullnessLengthForRegression]) == null ? void 0 : a.time) == null ? -Infinity : i, o = Math.min(t -
|
|
11403
|
+
let n = this.bufferFullness.items(), r = (i = (a = n[n.length - this.minBufferFullnessLengthForRegression]) == null ? void 0 : a.time) == null ? -Infinity : i, o = Math.min(t - gS, r);
|
|
11378
11404
|
this.bufferFullness.filterPop(({ time: e }) => e >= o);
|
|
11379
11405
|
}
|
|
11380
11406
|
this.bufferFullnessRegression = this.bufferFullness.items().length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression() : void 0;
|
|
@@ -11446,10 +11472,10 @@ var oS, sS = () => ({
|
|
|
11446
11472
|
Qt(this.metrics.general.activeRanges);
|
|
11447
11473
|
}
|
|
11448
11474
|
};
|
|
11449
|
-
|
|
11475
|
+
fS = vS, e(vS, "create", (e, t, n, r) => new fS(e, t, n, r));
|
|
11450
11476
|
//#endregion
|
|
11451
11477
|
//#region ../../libs/web-sdk/src/modules/RenditionsModule.ts
|
|
11452
|
-
var
|
|
11478
|
+
var yS, bS = class {
|
|
11453
11479
|
constructor(t, n) {
|
|
11454
11480
|
e(this, "renditions", /* @__PURE__ */ new Map()), e(this, "renditionLevels", []), e(this, "languages", []), e(this, "emitter", void 0), e(this, "subscriptionSource", void 0), e(this, "renditionLevelChangeCount", 0), e(this, "unload", () => {
|
|
11455
11481
|
this.emitter.off("renditions", this.onRenditions), this.emitter.off("subscription changed", this.onSubscriptionChanged);
|
|
@@ -11524,10 +11550,10 @@ var pS, mS = class {
|
|
|
11524
11550
|
}), e(this, "getCurrentSubscription", () => this.subscriptionSource.getCurrentSubscription()), this.subscriptionSource = n, this.emitter = t, this.emitter.on("renditions", this.onRenditions), this.emitter.on("subscription changed", this.onSubscriptionChanged);
|
|
11525
11551
|
}
|
|
11526
11552
|
};
|
|
11527
|
-
|
|
11553
|
+
yS = bS, e(bS, "create", (e, t) => new yS(e, t));
|
|
11528
11554
|
//#endregion
|
|
11529
11555
|
//#region ../../libs/web-sdk/src/BFrameTracker.ts
|
|
11530
|
-
var
|
|
11556
|
+
var xS = class t {
|
|
11531
11557
|
constructor() {
|
|
11532
11558
|
e(this, "channelId", void 0), e(this, "renditionId", void 0), e(this, "anchorCts", void 0), e(this, "hasBFramesValue", !1), e(this, "isAwaitingAssessment", !1), e(this, "zeroOffsetSamples", 0), e(this, "omittedBoundaryCrossings", 0), e(this, "hasSeenKeyframe", !1), e(this, "hasObservedReordering", !1), e(this, "rememberedRenditions", new Tt(t.MAX_REMEMBERED_RENDITIONS));
|
|
11533
11559
|
}
|
|
@@ -11563,7 +11589,7 @@ var hS = class t {
|
|
|
11563
11589
|
this.channelId = void 0, this.renditionId = void 0, this.anchorCts = void 0, this.hasBFramesValue = !1, this.zeroOffsetSamples = 0, this.omittedBoundaryCrossings = 0, this.hasSeenKeyframe = !1, this.hasObservedReordering = !1, this.isAwaitingAssessment = !0;
|
|
11564
11590
|
}
|
|
11565
11591
|
remember(e) {
|
|
11566
|
-
this.channelId !== void 0 && this.rememberedRenditions.set(
|
|
11592
|
+
this.channelId !== void 0 && this.rememberedRenditions.set(ix(this.channelId, this.renditionId), e);
|
|
11567
11593
|
}
|
|
11568
11594
|
latchBFrames() {
|
|
11569
11595
|
this.hasBFramesValue = !0, this.hasObservedReordering = !0, this.isAwaitingAssessment = !1, this.remember(!0);
|
|
@@ -11575,18 +11601,18 @@ var hS = class t {
|
|
|
11575
11601
|
this.hasSeenKeyframe && !this.hasObservedReordering && (this.remember(!1), this.hasBFramesValue = !1), this.hasSeenKeyframe = !0, this.omittedBoundaryCrossings = 0;
|
|
11576
11602
|
}
|
|
11577
11603
|
resetOnSwitch(e, t) {
|
|
11578
|
-
if (
|
|
11604
|
+
if (!ax(e, t, this.channelId, this.renditionId)) {
|
|
11579
11605
|
let n = this.channelId !== void 0;
|
|
11580
11606
|
this.channelId = e, this.renditionId = t, this.anchorCts = void 0, this.zeroOffsetSamples = 0, this.omittedBoundaryCrossings = 0, this.hasSeenKeyframe = !1, this.hasObservedReordering = !1;
|
|
11581
|
-
let r = this.rememberedRenditions.get(
|
|
11607
|
+
let r = this.rememberedRenditions.get(ix(e, t));
|
|
11582
11608
|
this.hasBFramesValue = r == null ? !1 : r, n && (this.isAwaitingAssessment = r === void 0);
|
|
11583
11609
|
}
|
|
11584
11610
|
}
|
|
11585
11611
|
};
|
|
11586
|
-
e(
|
|
11612
|
+
e(xS, "MAX_REMEMBERED_RENDITIONS", 32);
|
|
11587
11613
|
//#endregion
|
|
11588
11614
|
//#region ../../libs/web-sdk/src/modules/SyncModule.ts
|
|
11589
|
-
var
|
|
11615
|
+
var SS, CS = 5e3, wS = .5, TS = 3e3, ES = () => Ne() || Ae(), DS = (e) => e && ES() ? 100 : 0, OS = (e) => (t) => t > e, kS = 100, AS = 1e3, jS = 1e3, MS = 1e3, NS = 100, PS = 50, FS = {
|
|
11590
11616
|
seek: {
|
|
11591
11617
|
toleranceMs: 200,
|
|
11592
11618
|
toleranceMaxMs: 2500,
|
|
@@ -11618,7 +11644,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11618
11644
|
decayCooldownMultiplier: 3,
|
|
11619
11645
|
decayCheckInterval: 15e3
|
|
11620
11646
|
}
|
|
11621
|
-
},
|
|
11647
|
+
}, IS = class {
|
|
11622
11648
|
get driftSamplesToCollect() {
|
|
11623
11649
|
return this._driftSamplesToCollect;
|
|
11624
11650
|
}
|
|
@@ -11626,8 +11652,8 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11626
11652
|
this._driftSamplesToCollect = e, this.driftSamples = new r(e);
|
|
11627
11653
|
}
|
|
11628
11654
|
constructor(t, n, i, a, o, s = !0) {
|
|
11629
|
-
e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new r(10)), e(this, "lastSeekTime", void 0), e(this, "timeshiftDeferralStartedAt", void 0), e(this, "needsMediaSourceRecovery", !1), e(this, "lastAdjustmentTime", performance.now()), e(this, "lastDecayCheckTime", performance.now()), e(this, "syncInterval", void 0), e(this, "currentSyncIntervalMs",
|
|
11630
|
-
this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ?
|
|
11655
|
+
e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new r(10)), e(this, "lastSeekTime", void 0), e(this, "timeshiftDeferralStartedAt", void 0), e(this, "needsMediaSourceRecovery", !1), e(this, "lastAdjustmentTime", performance.now()), e(this, "lastDecayCheckTime", performance.now()), e(this, "syncInterval", void 0), e(this, "currentSyncIntervalMs", kS), e(this, "config", void 0), e(this, "state", void 0), e(this, "allowTimeshiftOnAudio", !1), e(this, "syncInfoToleranceMaxMs", 150), e(this, "syncInfoToleranceStep", 20), e(this, "seekOvershoot", void 0), e(this, "timers", k.create()), e(this, "rtt", 0), e(this, "channelSyncInfo", /* @__PURE__ */ new Map()), e(this, "seekAdjustmentCount", 0), e(this, "timeshiftAdjustmentCount", 0), e(this, "syncInfoCorrectionCount", 0), e(this, "playbackRateAdjustmentCount", 0), e(this, "lastPlaybackRateChangeTime", 0), e(this, "seekAdjustmentTimestamps", []), e(this, "timeshiftAdjustmentTimestamps", []), e(this, "_driftSamplesToCollect", 5), e(this, "driftSamples", new r(this._driftSamplesToCollect)), e(this, "timestampOffset", void 0), e(this, "hasObservedBFrames", !1), e(this, "bFrameDetector", new xS()), e(this, "currentChannelId", void 0), e(this, "highestSeenTimestamps", /* @__PURE__ */ new Map()), e(this, "isSuspended", !1), e(this, "isSyncAdjustmentActivated", !1), e(this, "queuedTimeshift", !1), e(this, "playbackState", void 0), e(this, "hasPerformedRecoverySeekInCurrentRecoveryState", !1), e(this, "shouldSeekAfterBuffering", !1), e(this, "shouldSeekWhileStuck", !1), e(this, "hasPerformedStuckSeekInCurrentStillness", !1), e(this, "positionSetBySeek", void 0), e(this, "lastPlayheadPosition", void 0), e(this, "lastPlayheadProgressAt", performance.now()), e(this, "usesMse", void 0), e(this, "load", () => {
|
|
11656
|
+
this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? AS : kS);
|
|
11631
11657
|
}), e(this, "unload", () => {
|
|
11632
11658
|
this.logger.debug("Unloading module..."), this.emitter.off("rtt", this.updateRtt), this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("page active", this.onPageActive), this.emitter.off("pageshow", this.onPageShow), this.emitter.off("buffers flushed", this.clearBFrameLatch), this.emitter.off("recovered from media error", this.onMediaSourceRecovered), this.clearSyncInterval(), this.timers.unload(), this.logger.debug("Unloaded module");
|
|
11633
11659
|
}), e(this, "suspend", () => {
|
|
@@ -11669,7 +11695,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11669
11695
|
}), e(this, "processSample", (e) => {
|
|
11670
11696
|
var t;
|
|
11671
11697
|
if (!e.channelId) throw Error("Sample must be assigned to a channel");
|
|
11672
|
-
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 -
|
|
11698
|
+
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - CS);
|
|
11673
11699
|
let n = e.type === "video" && e.isSync;
|
|
11674
11700
|
if (this.bFrameDetector.update(e), this.latchBFramesIfDetected(), this.currentChannelId !== e.channelId) {
|
|
11675
11701
|
let t = 2 ** 53 - 1;
|
|
@@ -11686,7 +11712,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11686
11712
|
this.currentChannelId || (this.currentChannelId = e);
|
|
11687
11713
|
let i = t.mediaType();
|
|
11688
11714
|
if (!i) throw Error("Fragment must have a media type");
|
|
11689
|
-
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 -
|
|
11715
|
+
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - CS);
|
|
11690
11716
|
let a = i === "video" && t.startsWithKeyframe();
|
|
11691
11717
|
if (i === "video" && (this.bFrameDetector.updateFromFragment({
|
|
11692
11718
|
type: i,
|
|
@@ -11811,7 +11837,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11811
11837
|
this.timeshiftDeferralStartedAt = void 0;
|
|
11812
11838
|
return;
|
|
11813
11839
|
}
|
|
11814
|
-
let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(
|
|
11840
|
+
let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(OS(i)).length;
|
|
11815
11841
|
if (a && this.state.timeshiftToleranceMultiplier > 2) {
|
|
11816
11842
|
this.logger.debug("Too many timeshifts within sliding window", {
|
|
11817
11843
|
timeshiftCooldownThreshold: i,
|
|
@@ -11822,12 +11848,12 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11822
11848
|
if (e) {
|
|
11823
11849
|
var o, s;
|
|
11824
11850
|
let e = this.playbackSource.currentTime, t = (o = (s = this.bufferSource).getBufferedEndAt) == null ? void 0 : o.call(s, e), n = Math.max(0, (t == null ? e : t) - e);
|
|
11825
|
-
if (n - r < this.bufferSource.getTargetBufferTime() *
|
|
11851
|
+
if (n - r < this.bufferSource.getTargetBufferTime() * wS) {
|
|
11826
11852
|
let e = performance.now();
|
|
11827
11853
|
if (this.timeshiftDeferralStartedAt === void 0 && (this.timeshiftDeferralStartedAt = e, this.logger.debug("Deferring timeshift while buffered ahead is thin", {
|
|
11828
11854
|
drift: r,
|
|
11829
11855
|
bufferedAhead: n
|
|
11830
|
-
})), e - this.timeshiftDeferralStartedAt <
|
|
11856
|
+
})), e - this.timeshiftDeferralStartedAt < TS) return;
|
|
11831
11857
|
}
|
|
11832
11858
|
this.timeshiftDeferralStartedAt !== void 0 && this.logger.debug("Releasing timeshift deferral", { deferredMs: performance.now() - this.timeshiftDeferralStartedAt });
|
|
11833
11859
|
}
|
|
@@ -11847,20 +11873,20 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11847
11873
|
let n = (e = (t = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : e.call(t, this.playbackSource.currentTime);
|
|
11848
11874
|
return this.shouldSeekAfterBuffering = n !== void 0, n;
|
|
11849
11875
|
}), e(this, "observePlayheadProgress", () => {
|
|
11850
|
-
let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek >
|
|
11876
|
+
let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > PS);
|
|
11851
11877
|
this.positionSetBySeek = void 0, (n || this.playbackSource.isPaused) && (this.hasPerformedStuckSeekInCurrentStillness = !1), (t || this.playbackSource.isPaused || this.isSeeking()) && (this.lastPlayheadPosition = e, this.lastPlayheadProgressAt = performance.now());
|
|
11852
11878
|
}), e(this, "isPlayheadStuckInBuffer", () => {
|
|
11853
11879
|
var e, t;
|
|
11854
|
-
if (performance.now() - this.lastPlayheadProgressAt <
|
|
11880
|
+
if (performance.now() - this.lastPlayheadProgressAt < jS) return !1;
|
|
11855
11881
|
let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n);
|
|
11856
|
-
return r !== void 0 && r - n >=
|
|
11882
|
+
return r !== void 0 && r - n >= MS;
|
|
11857
11883
|
}), e(this, "getRecoverySeekReason", () => {
|
|
11858
11884
|
if (this.needsMediaSourceRecovery) return "media source reopen";
|
|
11859
11885
|
if (this.shouldSeekWhileStuck) return "stuck in buffer";
|
|
11860
11886
|
if (this.shouldSeekAfterBuffering) return "buffering";
|
|
11861
11887
|
}), e(this, "shouldSkipNormalSeek", (e) => e < 0 && -e < this.currentAheadToleranceMs() || e > 0 && e < this.currentSeekToleranceMs() || Math.abs(e) < 1 ? !0 : !this.isAllowedToSync()), e(this, "shouldDeferRecoverySeek", (e, t) => t !== void 0 && t > e), e(this, "buildStuckInBufferSeekPlan", () => {
|
|
11862
11888
|
var e, t;
|
|
11863
|
-
let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot,
|
|
11889
|
+
let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, NS);
|
|
11864
11890
|
if (r === void 0 || i >= r) return;
|
|
11865
11891
|
let a = this.findKeyframeCloseToTimestamp(i);
|
|
11866
11892
|
return {
|
|
@@ -11941,7 +11967,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11941
11967
|
if (r && (this.isSeeking() || !this.currentChannelId || this.isSuspended || this.playbackSource.isPaused) || (this.driftSamples.push(t), vt(this.driftSamples.items()) < this.currentTimeshiftToleranceMs() && (this.timeshiftDeferralStartedAt = void 0), !this.isSeekCooldownExpired()) || !r && this.driftSamples.items().length < this.driftSamplesToCollect && Math.abs(t) < 2e3) return;
|
|
11942
11968
|
let i = r ? t : vt(this.driftSamples.items());
|
|
11943
11969
|
if (!r && this.tryPlaybackRateSync(i) || !r && this.shouldSkipNormalSeek(i)) return;
|
|
11944
|
-
let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(
|
|
11970
|
+
let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(OS(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
|
|
11945
11971
|
if (o && this.state.seekToleranceMultiplier > 2 && !r && !c) {
|
|
11946
11972
|
this.logger.debug("Too many seek adjustments within sliding window", {
|
|
11947
11973
|
seekCooldownThreshold: a,
|
|
@@ -11970,9 +11996,9 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11970
11996
|
return;
|
|
11971
11997
|
}
|
|
11972
11998
|
}), e(this, "onPageActive", (e) => {
|
|
11973
|
-
this.setSyncInterval(e ?
|
|
11999
|
+
this.setSyncInterval(e ? kS : AS), e && this.onSync();
|
|
11974
12000
|
}), e(this, "onPageShow", (e) => {
|
|
11975
|
-
e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ?
|
|
12001
|
+
e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? AS : kS), this.onSync());
|
|
11976
12002
|
}), e(this, "setSyncInterval", (e) => {
|
|
11977
12003
|
this.syncInterval !== void 0 && this.currentSyncIntervalMs === e || (this.clearSyncInterval(), this.currentSyncIntervalMs = e, this.syncInterval = this.timers.setInterval(this.onSync, e));
|
|
11978
12004
|
}), e(this, "clearSyncInterval", () => {
|
|
@@ -11983,11 +12009,11 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11983
12009
|
let t = n >= e - this.config.seek.keyframeSearchBeforeMs, r = n <= e + this.config.seek.keyframeSearchAfterMs;
|
|
11984
12010
|
if (t && r) return n;
|
|
11985
12011
|
}
|
|
11986
|
-
}), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot =
|
|
11987
|
-
seek: x({},
|
|
11988
|
-
timeshift: x({},
|
|
11989
|
-
playbackRate: x({},
|
|
11990
|
-
backoff: x({},
|
|
12012
|
+
}), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot = DS(s), this.config = {
|
|
12013
|
+
seek: x({}, FS.seek),
|
|
12014
|
+
timeshift: x({}, FS.timeshift),
|
|
12015
|
+
playbackRate: x({}, FS.playbackRate),
|
|
12016
|
+
backoff: x({}, FS.backoff)
|
|
11991
12017
|
}, this.config.timeshift.enabled = o, s || (this.config.seek.toleranceMs = 50, this.config.timeshift.toleranceMs = 20, this.config.seek.aheadToleranceMs = 40), this.state = {
|
|
11992
12018
|
seekToleranceMultiplier: 1,
|
|
11993
12019
|
timeshiftToleranceMultiplier: 1
|
|
@@ -12049,10 +12075,10 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
12049
12075
|
return this.serverCurrentTime - this.playbackSource.currentTime;
|
|
12050
12076
|
}
|
|
12051
12077
|
};
|
|
12052
|
-
|
|
12078
|
+
SS = IS, e(IS, "create", (e, t, n, r, i, a = !0) => new SS(e, t, n, r, i, a));
|
|
12053
12079
|
//#endregion
|
|
12054
12080
|
//#region ../../libs/web-sdk/src/modules/TelemetryModule.ts
|
|
12055
|
-
var
|
|
12081
|
+
var LS, RS = {
|
|
12056
12082
|
enabled: !0,
|
|
12057
12083
|
interval: 3e4,
|
|
12058
12084
|
includeErrors: !0,
|
|
@@ -12061,11 +12087,11 @@ var jS, MS = {
|
|
|
12061
12087
|
maxRetries: 10,
|
|
12062
12088
|
maxErrorReports: 50,
|
|
12063
12089
|
maxEvents: 50
|
|
12064
|
-
},
|
|
12090
|
+
}, zS = (e, t) => x(x({}, t), {}, {
|
|
12065
12091
|
type: e,
|
|
12066
12092
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12067
12093
|
discriminator: "web"
|
|
12068
|
-
}),
|
|
12094
|
+
}), BS = class {
|
|
12069
12095
|
constructor(n, i, a, o) {
|
|
12070
12096
|
var s = this;
|
|
12071
12097
|
e(this, "logger", void 0), e(this, "timers", new k()), e(this, "emitter", void 0), e(this, "options", void 0), e(this, "parentContext", void 0), e(this, "unsentLines", new r(100)), e(this, "retries", 0), e(this, "errorCount", 0), e(this, "eventCount", 0), e(this, "statsCount", 0), e(this, "unload", () => {
|
|
@@ -12082,7 +12108,7 @@ var jS, MS = {
|
|
|
12082
12108
|
initiator: "interval"
|
|
12083
12109
|
}, n = {}) => {
|
|
12084
12110
|
if (!this.options.includeStats) return;
|
|
12085
|
-
let r = this.parentContext.getStatistics(), i =
|
|
12111
|
+
let r = this.parentContext.getStatistics(), i = zS("stats", x(x(x({}, n), r), {}, {
|
|
12086
12112
|
isFinal: e,
|
|
12087
12113
|
initiator: t,
|
|
12088
12114
|
count: this.statsCount++
|
|
@@ -12090,7 +12116,7 @@ var jS, MS = {
|
|
|
12090
12116
|
this.unsentLines.push(i);
|
|
12091
12117
|
}), e(this, "addEvent", (e) => {
|
|
12092
12118
|
if (!this.options.includeEvents || this.eventCount > this.options.maxEvents) return;
|
|
12093
|
-
let t =
|
|
12119
|
+
let t = zS("event", x(x({}, this.parentContext.getStatistics()), e));
|
|
12094
12120
|
this.eventCount++, this.unsentLines.push(t);
|
|
12095
12121
|
}), e(this, "getStatistics", () => ({ errorCount: this.errorCount })), e(this, "send", function() {
|
|
12096
12122
|
var e = t(function* (e) {
|
|
@@ -12135,14 +12161,14 @@ var jS, MS = {
|
|
|
12135
12161
|
let { includeErrors: t, maxErrorReports: n } = this.options;
|
|
12136
12162
|
if (!(e instanceof A) || e.code() === "channel_not_live" || !t || (this.errorCount++, this.errorCount > n)) return;
|
|
12137
12163
|
let r = this.parentContext.getStatistics();
|
|
12138
|
-
this.unsentLines.push(
|
|
12139
|
-
}), this.logger = n, this.emitter = i, this.options = x(x({},
|
|
12164
|
+
this.unsentLines.push(zS("error", x(x({}, r), e.toStringifiable())));
|
|
12165
|
+
}), this.logger = n, this.emitter = i, this.options = x(x({}, RS), a), this.parentContext = o;
|
|
12140
12166
|
}
|
|
12141
12167
|
};
|
|
12142
|
-
|
|
12168
|
+
LS = BS, e(BS, "create", (e, t, n, r) => new LS(e, t, n, r));
|
|
12143
12169
|
//#endregion
|
|
12144
12170
|
//#region ../../libs/web-sdk/src/modules/UnpauseModule.ts
|
|
12145
|
-
var
|
|
12171
|
+
var VS, HS = class {
|
|
12146
12172
|
constructor(t, n, r) {
|
|
12147
12173
|
e(this, "logger", void 0), e(this, "elements", void 0), e(this, "documentState", void 0), e(this, "timers", new k()), e(this, "unload", () => {
|
|
12148
12174
|
this.timers.unload();
|
|
@@ -12151,10 +12177,10 @@ var FS, IS = class {
|
|
|
12151
12177
|
}), this.logger = t, this.elements = n, this.documentState = r, this.timers.setInterval(this.unpause, 100);
|
|
12152
12178
|
}
|
|
12153
12179
|
};
|
|
12154
|
-
|
|
12180
|
+
VS = HS, e(HS, "create", (e, t, n) => new VS(e, t, n));
|
|
12155
12181
|
//#endregion
|
|
12156
12182
|
//#region ../../libs/web-sdk/src/OptionsProvider.ts
|
|
12157
|
-
var
|
|
12183
|
+
var US = [
|
|
12158
12184
|
"minBufferTime",
|
|
12159
12185
|
"maxBufferTime",
|
|
12160
12186
|
"burstEnabled",
|
|
@@ -12163,10 +12189,10 @@ var LS = [
|
|
|
12163
12189
|
"offscreenCanvasEnabled",
|
|
12164
12190
|
"videoCodecs"
|
|
12165
12191
|
];
|
|
12166
|
-
function
|
|
12167
|
-
return
|
|
12192
|
+
function WS(e) {
|
|
12193
|
+
return US.includes(e);
|
|
12168
12194
|
}
|
|
12169
|
-
var
|
|
12195
|
+
var GS = class {
|
|
12170
12196
|
constructor(t) {
|
|
12171
12197
|
e(this, "options", void 0), e(this, "overrides", /* @__PURE__ */ new Map()), this.options = t;
|
|
12172
12198
|
}
|
|
@@ -12180,7 +12206,7 @@ var zS = class {
|
|
|
12180
12206
|
this.options[e] = t;
|
|
12181
12207
|
}
|
|
12182
12208
|
get(e, t) {
|
|
12183
|
-
if (t &&
|
|
12209
|
+
if (t && WS(e)) {
|
|
12184
12210
|
var n;
|
|
12185
12211
|
let r = (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
12186
12212
|
if (r !== void 0) return r;
|
|
@@ -12191,7 +12217,7 @@ var zS = class {
|
|
|
12191
12217
|
var n;
|
|
12192
12218
|
return (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
12193
12219
|
}
|
|
12194
|
-
},
|
|
12220
|
+
}, KS = 6, qS = (e) => {
|
|
12195
12221
|
let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
|
|
12196
12222
|
var i, a;
|
|
12197
12223
|
if (e.flags && Is(e.flags)) {
|
|
@@ -12203,7 +12229,7 @@ var zS = class {
|
|
|
12203
12229
|
return u > 0 && (r = u), x(x({}, e), {}, { duration: u > 0 ? u : r });
|
|
12204
12230
|
};
|
|
12205
12231
|
return (e, n = !1) => {
|
|
12206
|
-
if (e.flags && Is(e.flags) && n && (i = !i), !(n && t.length <
|
|
12232
|
+
if (e.flags && Is(e.flags) && n && (i = !i), !(n && t.length < KS && i) && t.length > 0) {
|
|
12207
12233
|
i = !1;
|
|
12208
12234
|
let n = e;
|
|
12209
12235
|
for (let e = t.length - 1; e > 0; e--) {
|
|
@@ -12216,13 +12242,13 @@ var zS = class {
|
|
|
12216
12242
|
}
|
|
12217
12243
|
return t.push(e), [];
|
|
12218
12244
|
};
|
|
12219
|
-
},
|
|
12245
|
+
}, JS = ["mse", "wasm"], YS = (e) => e == null ? JS : e, XS = (e) => {
|
|
12220
12246
|
if (!e) return !1;
|
|
12221
12247
|
let t = e.headers && Object.keys(e.headers).length > 0, n = e.queryParams && Object.keys(e.queryParams).length > 0;
|
|
12222
12248
|
return !!(t || n);
|
|
12223
|
-
},
|
|
12224
|
-
if (
|
|
12225
|
-
let r =
|
|
12249
|
+
}, ZS = (e, t, n) => {
|
|
12250
|
+
if (XS(n)) return "mse";
|
|
12251
|
+
let r = YS(e);
|
|
12226
12252
|
for (let e of r) switch (e) {
|
|
12227
12253
|
case "mse":
|
|
12228
12254
|
if (t) return "mse";
|
|
@@ -12233,7 +12259,7 @@ var zS = class {
|
|
|
12233
12259
|
case "wasm": return "wasm";
|
|
12234
12260
|
}
|
|
12235
12261
|
return "wasm";
|
|
12236
|
-
},
|
|
12262
|
+
}, QS = (e, t, n) => {
|
|
12237
12263
|
if (un(t)) return x(x({}, e), {}, {
|
|
12238
12264
|
type: "video",
|
|
12239
12265
|
codec: t.codec,
|
|
@@ -12254,12 +12280,12 @@ var zS = class {
|
|
|
12254
12280
|
data: e.payload,
|
|
12255
12281
|
duration: 0
|
|
12256
12282
|
});
|
|
12257
|
-
},
|
|
12283
|
+
}, $S = ({ average: e, last: t, max: n, min: r }) => ({
|
|
12258
12284
|
average: Math.round(e),
|
|
12259
12285
|
last: Math.round(t),
|
|
12260
12286
|
max: Math.round(n),
|
|
12261
12287
|
min: Math.round(r)
|
|
12262
|
-
}),
|
|
12288
|
+
}), eC = [
|
|
12263
12289
|
"timeSpentBuffering",
|
|
12264
12290
|
"timePerBufferingEvent",
|
|
12265
12291
|
"drift",
|
|
@@ -12271,24 +12297,24 @@ var zS = class {
|
|
|
12271
12297
|
"videoKeyframeIntervalMs",
|
|
12272
12298
|
"timeToConnected",
|
|
12273
12299
|
"mediaSourceOpenTime"
|
|
12274
|
-
],
|
|
12300
|
+
], tC = [
|
|
12275
12301
|
"videoDecodeTime",
|
|
12276
12302
|
"audioDecodeTime",
|
|
12277
12303
|
"videoTransportTime",
|
|
12278
12304
|
"rtt"
|
|
12279
|
-
],
|
|
12305
|
+
], nC = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, rC = (e) => {
|
|
12280
12306
|
let t = x({}, e);
|
|
12281
|
-
for (let e of
|
|
12307
|
+
for (let e of eC) {
|
|
12282
12308
|
let n = t[e];
|
|
12283
12309
|
typeof n == "number" && (t[e] = Math.round(n));
|
|
12284
12310
|
}
|
|
12285
|
-
for (let e of
|
|
12311
|
+
for (let e of tC) {
|
|
12286
12312
|
let n = t[e];
|
|
12287
|
-
|
|
12313
|
+
nC(n) && (t[e] = $S(n));
|
|
12288
12314
|
}
|
|
12289
12315
|
return t;
|
|
12290
|
-
},
|
|
12291
|
-
if (
|
|
12316
|
+
}, iC = (e, t) => e && typeof e == "object" && t in e, aC = (e) => !(typeof e != "object" || !iC(e, "channelId") || typeof e.channelId != "string" || !iC(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), oC = (e) => {
|
|
12317
|
+
if (!aC(e)) throw new A("Invalid options", {
|
|
12292
12318
|
isFatal: !0,
|
|
12293
12319
|
code: "invalid_options"
|
|
12294
12320
|
});
|
|
@@ -12297,13 +12323,13 @@ var zS = class {
|
|
|
12297
12323
|
let n = t;
|
|
12298
12324
|
n[e] === void 0 && delete n[e];
|
|
12299
12325
|
}), t;
|
|
12300
|
-
},
|
|
12326
|
+
}, sC = (e) => {
|
|
12301
12327
|
if (typeof e != "object" || !e) throw Error("not an object");
|
|
12302
12328
|
if (!("video" in e)) throw Error("missing video in subscription");
|
|
12303
12329
|
if (!("audio" in e)) throw Error("missing audio in subscription");
|
|
12304
12330
|
if (!("channelId" in e)) throw Error("missing channelId");
|
|
12305
12331
|
return !0;
|
|
12306
|
-
},
|
|
12332
|
+
}, cC = class {
|
|
12307
12333
|
constructor(n) {
|
|
12308
12334
|
var r = this;
|
|
12309
12335
|
e(this, "cache", /* @__PURE__ */ new Map()), e(this, "inFlight", /* @__PURE__ */ new Map()), e(this, "checkVideoSupport", function() {
|
|
@@ -12364,10 +12390,10 @@ var zS = class {
|
|
|
12364
12390
|
return this.inFlight.set(e, o), o;
|
|
12365
12391
|
}), this.logger = n;
|
|
12366
12392
|
}
|
|
12367
|
-
},
|
|
12393
|
+
}, lC = 1e4, uC = 300, dC = 3e3, fC = 1e4, pC = 1280 * 720, mC = /* @__PURE__ */ new WeakMap(), hC = /* @__PURE__ */ new WeakMap(), gC = /* @__PURE__ */ new WeakMap(), _C = class n extends ne {
|
|
12368
12394
|
constructor(r) {
|
|
12369
12395
|
var o, c, u;
|
|
12370
|
-
super(), o = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", Ge()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ne()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", sn()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "upgradeHeld", !1), e(this, "hasRequestedAudioSession", !1), e(this, "isUserPaused", !1), e(this, "isMediaElementPaused", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new ie(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new on()), e(this, "encryptedMediaExtensions", void 0), i(this,
|
|
12396
|
+
super(), o = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", Ge()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ne()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", sn()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "upgradeHeld", !1), e(this, "hasRequestedAudioSession", !1), e(this, "isUserPaused", !1), e(this, "isMediaElementPaused", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new ie(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new on()), e(this, "encryptedMediaExtensions", void 0), i(this, mC, 0), i(this, hC, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new ox()), e(this, "unextractableSamplesWarned", new ox()), e(this, "sizes", /* @__PURE__ */ new Map()), e(this, "isSuspended", !0), e(this, "inactivityDisconnectInterval", void 0), e(this, "visiblePauseTimeout", void 0), e(this, "offscreenSubtitleInterval", void 0), i(this, gC, void 0), e(this, "attach", (e) => {
|
|
12371
12397
|
var t;
|
|
12372
12398
|
(t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
|
|
12373
12399
|
}), e(this, "setElement", (e) => {
|
|
@@ -12467,20 +12493,20 @@ var zS = class {
|
|
|
12467
12493
|
}), e(this, "updateTextTracks", (e) => {
|
|
12468
12494
|
let t = e.filter((e) => e.codec === "webvtt");
|
|
12469
12495
|
t.forEach((e) => {
|
|
12470
|
-
if (!s(
|
|
12496
|
+
if (!s(hC, this).find((t) => t.language === e.language)) {
|
|
12471
12497
|
if (this.modules.canvasModule) {
|
|
12472
12498
|
let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
|
|
12473
|
-
s(
|
|
12499
|
+
s(hC, this).push(t);
|
|
12474
12500
|
} else if (this.mediaElement instanceof HTMLVideoElement) {
|
|
12475
12501
|
let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
|
|
12476
|
-
s(
|
|
12502
|
+
s(hC, this).push(t);
|
|
12477
12503
|
}
|
|
12478
12504
|
}
|
|
12479
12505
|
});
|
|
12480
|
-
for (let e of s(
|
|
12506
|
+
for (let e of s(hC, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
|
|
12481
12507
|
this.emit("text tracks", this.textTracks);
|
|
12482
12508
|
}), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
|
|
12483
|
-
s(
|
|
12509
|
+
s(hC, this).forEach((t) => {
|
|
12484
12510
|
if (t.cues) for (let n of Array.from(t.cues)) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
|
|
12485
12511
|
});
|
|
12486
12512
|
}), e(this, "filterRenditions", function() {
|
|
@@ -12540,7 +12566,7 @@ var zS = class {
|
|
|
12540
12566
|
var e;
|
|
12541
12567
|
let t = this.modules.connection.linkQueue;
|
|
12542
12568
|
if (!t) return !1;
|
|
12543
|
-
let n = Math.max(this.targetBufferTime,
|
|
12569
|
+
let n = Math.max(this.targetBufferTime, dC), r = t.peak(n), i = performance.now() - ((e = this.modules.connection.lastConnectionTime) == null ? performance.now() : e), a = r === void 0 ? i < fC : !(r < uC);
|
|
12544
12570
|
return a && !this.upgradeHeld && this.logger.debug("Holding the upgrade while the link queues", {
|
|
12545
12571
|
linkQueuePeakMs: r === void 0 ? void 0 : Math.round(r),
|
|
12546
12572
|
windowMs: n
|
|
@@ -12645,8 +12671,8 @@ var zS = class {
|
|
|
12645
12671
|
u = void 0, d = void 0, o.logger.warn("Failed to enable OffscreenCanvas; falling back to main thread rendering", { error: e });
|
|
12646
12672
|
}
|
|
12647
12673
|
else s && o.logger.warn("OffscreenCanvas requested but not supported; falling back to main thread rendering");
|
|
12648
|
-
let f = o.capturesCanvasOnWebKit(u), p = yield
|
|
12649
|
-
if (h instanceof
|
|
12674
|
+
let f = o.capturesCanvasOnWebKit(u), p = yield _x.create(o.emitter, o.logger.createContext("DecoderModule"), o.options.get("logLevel"), n, o.playbackSource, o.pool, i, a, u, f), { videoRenderer: m } = p.getStatistics(), h = o.modules.canvasModule;
|
|
12675
|
+
if (h instanceof Bx) if (m === "OffscreenCanvas" && d) {
|
|
12650
12676
|
h.setVideoRenderingEnabled(!1);
|
|
12651
12677
|
let e = o.element;
|
|
12652
12678
|
e.parentElement ? e.parentElement.replaceChild(d, e) : o.logger.warn("OffscreenCanvas rendering is active but the current element is not attached to the DOM. Updating internal element reference only."), o.offscreenCanvasElement = d, o.setElement(d);
|
|
@@ -12658,11 +12684,11 @@ var zS = class {
|
|
|
12658
12684
|
t.parentElement && t.parentElement.replaceChild(e, t), o.setElement(e);
|
|
12659
12685
|
}
|
|
12660
12686
|
}
|
|
12661
|
-
else h instanceof
|
|
12687
|
+
else h instanceof qx && (h.setBackgroundPlaybackEnabled(o.isBackgroundPlayEnabled(o.channelId)), m === "OffscreenCanvas" && d ? (h.setOffscreenCanvas(d), o.offscreenCanvasElement = d, f && o.connectWebKitVideoOutput(p, h)) : (h.setVideoTrack(void 0), h.setOffscreenCanvas(void 0), o.offscreenCanvasElement = void 0));
|
|
12662
12688
|
(e = o.modules.decoder) == null || e.unload(), o.modules.decoder = p, o.isHiddenWithBackgroundPlayback() && o.modules.decoder.enableBackgroundTimers(), o.modules.decoder.setVideoRenderingEnabled(o.isVideoOnScreen()), o.modules.decoder.load(), o.setupOffscreenSubtitleRouting();
|
|
12663
|
-
})), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof
|
|
12689
|
+
})), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof qx), e(this, "connectWebKitVideoOutput", (e, t) => {
|
|
12664
12690
|
let n = () => {
|
|
12665
|
-
t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(
|
|
12691
|
+
t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(pC);
|
|
12666
12692
|
};
|
|
12667
12693
|
e.onVideoTrackLost((e) => {
|
|
12668
12694
|
this.logger.warn("Worker video track lost, falling back to canvas capture", { error: e }), n();
|
|
@@ -12670,7 +12696,7 @@ var zS = class {
|
|
|
12670
12696
|
let r = e.videoTrack;
|
|
12671
12697
|
r ? t.setVideoTrack(r) : n();
|
|
12672
12698
|
}), e(this, "setupOffscreenSubtitleRouting", () => {
|
|
12673
|
-
if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof
|
|
12699
|
+
if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof qx) return;
|
|
12674
12700
|
let e = this.modules.decoder, t = this.modules.canvasModule;
|
|
12675
12701
|
if (!t) return;
|
|
12676
12702
|
let n = !1;
|
|
@@ -12712,7 +12738,7 @@ var zS = class {
|
|
|
12712
12738
|
this.clearVisiblePauseDisconnect(), this.isUserPaused = !1, this.requestAudioSessionOnce(), this.hasCalledConnect ? this.unsuspend() : this.playbackState !== "playing" && (this._connect(), self.addEventListener("__vindral_register_debug__", this.registerDebugInstance), this.modules.timer.setInterval(() => this.cleanupTextTracks(), n.REMOVE_CUE_THRESHOLD)), (e = this.wakeLock) == null || e.enable(), this.playbackState === "paused" && this.playbackSource.isActivated && (this.resetModules(), this.emitter.emit("flush buffers"), this.cleanupTextTracks(2 ** 53 - 1)), this.playbackSource.play(), this.isHiddenWithBackgroundPlayback() && this.scheduleInactivityDisconnect();
|
|
12713
12739
|
}), e(this, "getStatistics", () => {
|
|
12714
12740
|
let e = Object.values(this.modules).reduce((e, t) => t && "getStatistics" in t ? x(x({}, e), t.getStatistics()) : e, this.getRuntimeInfo()), t = Math.round(this.timeActive > 0 ? (e.bytesReceived || 0) * 8 / (this.timeActive / 1e3) : 0), n = this.uptime / 36e5, r = Math.max(0, (e.connectCount || 0) - 1), i = n > 0 ? r / n : 0, a = this.timeActive / 6e4, o = Math.max(a, 1), s = a > 0 ? (e.seekAdjustmentCount || 0) / o : 0, c = a > 0 ? (e.timeshiftAdjustmentCount || 0) / o : 0;
|
|
12715
|
-
return
|
|
12741
|
+
return rC(x(x({}, e), {}, {
|
|
12716
12742
|
averageBitRate: t,
|
|
12717
12743
|
reconnectsPerHour: i,
|
|
12718
12744
|
seekAdjustmentsPerMinute: s,
|
|
@@ -12721,7 +12747,7 @@ var zS = class {
|
|
|
12721
12747
|
}), e(this, "resetModules", () => {
|
|
12722
12748
|
Object.values(this.modules).forEach((e) => {
|
|
12723
12749
|
e && "reset" in e && e.reset();
|
|
12724
|
-
}), this.playbackSource instanceof uc && this.modules.adaptivity.holdReconnect(
|
|
12750
|
+
}), this.playbackSource instanceof uc && this.modules.adaptivity.holdReconnect(lC), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
|
|
12725
12751
|
}), e(this, "disconnectForInactivePage", (e) => {
|
|
12726
12752
|
if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
|
|
12727
12753
|
var t;
|
|
@@ -12752,10 +12778,10 @@ var zS = class {
|
|
|
12752
12778
|
e && "unsuspend" in e && e.unsuspend();
|
|
12753
12779
|
});
|
|
12754
12780
|
}), e(this, "getRuntimeInfo", () => {
|
|
12755
|
-
let e = this.modules.canvasModule instanceof
|
|
12781
|
+
let e = this.modules.canvasModule instanceof qx ? !0 : void 0;
|
|
12756
12782
|
return x({
|
|
12757
12783
|
uptime: this.uptime,
|
|
12758
|
-
version: "4.8.
|
|
12784
|
+
version: "4.8.1",
|
|
12759
12785
|
clientId: this.clientId,
|
|
12760
12786
|
sessionId: this.sessionId,
|
|
12761
12787
|
channelId: this.channelId,
|
|
@@ -12800,7 +12826,7 @@ var zS = class {
|
|
|
12800
12826
|
if (this.browser.platform.isWebKit || !this.browser.isMobile) return !1;
|
|
12801
12827
|
let t = (e = this.modules) == null ? void 0 : e.decoder;
|
|
12802
12828
|
return t ? t.audioWebCodecsInUse : this.isWebCodecsAudioAvailable(this.channelId);
|
|
12803
|
-
}), this.options = new
|
|
12829
|
+
}), this.options = new GS(x(x({}, ir), oC(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
|
|
12804
12830
|
let d = {
|
|
12805
12831
|
channelId: this.options.get("channelId"),
|
|
12806
12832
|
audio: {
|
|
@@ -12813,14 +12839,14 @@ var zS = class {
|
|
|
12813
12839
|
height: this.options.get("maxSize").height
|
|
12814
12840
|
}
|
|
12815
12841
|
}, f = S.get();
|
|
12816
|
-
f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new
|
|
12842
|
+
f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new cC(f), r.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
|
|
12817
12843
|
let p = (c = r.streamToMediaElementEnabled) == null ? r.iosMediaElementEnabled : c;
|
|
12818
12844
|
p !== void 0 && (this.options.set("streamToMediaElementEnabled", p), this.options.set("iosMediaElementEnabled", p)), r.iosBackgroundPlayEnabled !== void 0 && this.logger.warn("Option iosBackgroundPlayEnabled is deprecated and will be removed in a future release. Use backgroundPlayEnabled instead.");
|
|
12819
12845
|
let m = (u = r.backgroundPlayEnabled) == null ? r.iosBackgroundPlayEnabled : u;
|
|
12820
12846
|
m !== void 0 && (this.options.set("backgroundPlayEnabled", m), this.options.set("iosBackgroundPlayEnabled", m));
|
|
12821
12847
|
let g = r.mseEnabled !== void 0, _ = r.decoders !== void 0;
|
|
12822
12848
|
g && this.logger.warn("Option mseEnabled is deprecated and will be removed in a future release. Use decoders instead (e.g. decoders: [\"wasm\"])."), g && !_ && r.mseEnabled === !1 && this.options.set("decoders", ["wasm"]);
|
|
12823
|
-
let v =
|
|
12849
|
+
let v = lS.create(this.emitter, this.logger.createContext("PictureInPictureModule")), y = this.options.get("mediaSessionEnabled") ? Gx.create(this.emitter, this.logger.createContext("MediaSessionModule"), {
|
|
12824
12850
|
metadata: this.options.get("mediaSessionMetadata"),
|
|
12825
12851
|
decoy: this.willUseMediaSource() || this.usesSplitCanvasAudio() ? void 0 : kc.create(this.logger.createContext("AudioFocusDecoy"), this.yieldToInterruption),
|
|
12826
12852
|
isMuted: () => this.playbackSource.userMuted,
|
|
@@ -12831,12 +12857,12 @@ var zS = class {
|
|
|
12831
12857
|
holdDecoyWhilePaused: this.holdsDecoyWhilePaused(),
|
|
12832
12858
|
keepDecoyWhenMuted: this.isWebKitCanvasPath(),
|
|
12833
12859
|
pauseMeansMute: !this.options.get("pauseSupportEnabled")
|
|
12834
|
-
}) : void 0, b = k.create(), te =
|
|
12860
|
+
}) : void 0, b = k.create(), te = yx.create(this.emitter), re = Qb.create(this.emitter, this.logger.createContext("ConnectionModule"), {
|
|
12835
12861
|
reconnectHandler: this.options.get("reconnectHandler"),
|
|
12836
12862
|
options: this.options,
|
|
12837
12863
|
onConnectInfo: this.onConnectInfo,
|
|
12838
12864
|
documentState: te
|
|
12839
|
-
}), C = Mv.create(this.logger.createContext("SubscriptionModule"), this.emitter, d), w =
|
|
12865
|
+
}), C = Mv.create(this.logger.createContext("SubscriptionModule"), this.emitter, d), w = bS.create(this.emitter, C), ae = dS.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime")), oe = vS.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), w, ae);
|
|
12840
12866
|
this.encryptedMediaExtensions = new Si(this.emitter, this.logger.createContext("EncryptedMediaExtensions"), r.drm), this.drm = {
|
|
12841
12867
|
setHeaders: (e) => {
|
|
12842
12868
|
this.encryptedMediaExtensions.headers = e;
|
|
@@ -12855,9 +12881,9 @@ var zS = class {
|
|
|
12855
12881
|
logger: this.logger.createContext("MediaElement"),
|
|
12856
12882
|
poster: ce
|
|
12857
12883
|
});
|
|
12858
|
-
e.on("buffer state", (e) => this.onMediaElementBufferState(e, T)), e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("volume state", (e) => this.emitter.emit("volume state", e)), e.on("media element state", (e) => this.onMediaElementState(e)), this.element = e.element, this.playbackSource = e, Si.isSupported() && this.encryptedMediaExtensions.attach(e.element), T =
|
|
12884
|
+
e.on("buffer state", (e) => this.onMediaElementBufferState(e, T)), e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("volume state", (e) => this.emitter.emit("volume state", e)), e.on("media element state", (e) => this.onMediaElementState(e)), this.element = e.element, this.playbackSource = e, Si.isSupported() && this.encryptedMediaExtensions.attach(e.element), T = Qx.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (le = HS.create(this.logger.createContext("UnpauseModule"), [e], te)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
|
|
12859
12885
|
} else if (this.streamsToMediaElement()) {
|
|
12860
|
-
let e =
|
|
12886
|
+
let e = qx.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
|
|
12861
12887
|
type: this.options.get("media") === "audio" ? "audio" : "video",
|
|
12862
12888
|
muted: this.options.get("muted") || this.options.get("media") === "video",
|
|
12863
12889
|
volume: this.options.get("volume"),
|
|
@@ -12869,10 +12895,10 @@ var zS = class {
|
|
|
12869
12895
|
});
|
|
12870
12896
|
this.element = e.element().element, this.playbackSource = e, ue = e;
|
|
12871
12897
|
let t = this.browser.platform.isIOS && this.browser.platform.iosVersion <= 15;
|
|
12872
|
-
this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (le =
|
|
12898
|
+
this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (le = HS.create(this.logger.createContext("UnpauseModule"), e.elements(), te));
|
|
12873
12899
|
} else {
|
|
12874
12900
|
let e;
|
|
12875
|
-
e =
|
|
12901
|
+
e = Bx.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
|
|
12876
12902
|
this.setElement(e.element());
|
|
12877
12903
|
}, this.options.get("minBufferTime")), this.element = e.element(), this.playbackSource = e, ue = e, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new Zs());
|
|
12878
12904
|
}
|
|
@@ -12890,9 +12916,9 @@ var zS = class {
|
|
|
12890
12916
|
getTargetBufferTime: () => ae.getTargetBufferTime(),
|
|
12891
12917
|
getNextBufferedRangeStart: T ? (e) => T.getNextBufferedRangeStart(e) : void 0,
|
|
12892
12918
|
getBufferedEndAt: T ? (e) => T.getBufferedEndAt(e) : void 0
|
|
12893
|
-
}, me =
|
|
12919
|
+
}, me = IS.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, pe, fe, de), he = Tx.create(this.logger.createContext("JitterModule")), ge = pc.create(this.emitter), _e = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), E = new URL("/telemetry", _e).toString();
|
|
12894
12920
|
this.modules = {
|
|
12895
|
-
telemetry:
|
|
12921
|
+
telemetry: BS.create(this.logger.createContext("TelemetryModule"), this.emitter, {
|
|
12896
12922
|
url: E,
|
|
12897
12923
|
enabled: this.options.get("telemetryEnabled"),
|
|
12898
12924
|
includeStats: !1,
|
|
@@ -12904,8 +12930,8 @@ var zS = class {
|
|
|
12904
12930
|
}),
|
|
12905
12931
|
incomingData: ge,
|
|
12906
12932
|
adaptivity: Cc.create(this.emitter, this.logger.createContext("AdaptivityModule"), oe, ge, { cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3) }),
|
|
12907
|
-
constraintCap:
|
|
12908
|
-
event:
|
|
12933
|
+
constraintCap: rx.create(this.emitter, this.element, w, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
|
|
12934
|
+
event: Sx.create(this.emitter, this.logger.createContext("EventModule"), me),
|
|
12909
12935
|
sync: me,
|
|
12910
12936
|
jitter: he,
|
|
12911
12937
|
documentState: te,
|
|
@@ -12977,7 +13003,7 @@ var zS = class {
|
|
|
12977
13003
|
let r = ((t = (n = e.telemetry) == null ? void 0 : n.probability) == null ? 1 : t) >= Math.random();
|
|
12978
13004
|
if (e.telemetry) {
|
|
12979
13005
|
var i;
|
|
12980
|
-
(i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry =
|
|
13006
|
+
(i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = BS.create(this.logger.createContext("TelemetryModule"), this.emitter, x(x({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
|
|
12981
13007
|
}
|
|
12982
13008
|
}), this.emitter.on("adapt level", (e) => {
|
|
12983
13009
|
let t = this.modules.renditions.getRenditionLevels(), n = this.modules.renditions.getRenditionLevel(), r = t.findIndex((e) => e === n), i = t.length - 1, a = r;
|
|
@@ -13020,8 +13046,8 @@ var zS = class {
|
|
|
13020
13046
|
audio: x(x({}, this.targetSubscription.audio), f == null ? void 0 : f.audio)
|
|
13021
13047
|
})), this.emitter.emit("adapted level");
|
|
13022
13048
|
}), this.emitter.on("ping timeout", this.onPingTimeout), this.emitter.on("text track data", (e) => {
|
|
13023
|
-
let t = s(
|
|
13024
|
-
if (a(
|
|
13049
|
+
let t = s(hC, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(mC, this);
|
|
13050
|
+
if (a(mC, this, n), t) {
|
|
13025
13051
|
if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
|
|
13026
13052
|
for (let r of e.cues) {
|
|
13027
13053
|
let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
|
|
@@ -13037,19 +13063,19 @@ var zS = class {
|
|
|
13037
13063
|
this.clientIp = t.ip;
|
|
13038
13064
|
break;
|
|
13039
13065
|
case "renditions":
|
|
13040
|
-
this.updateTextTracks(t.renditions), a(
|
|
13066
|
+
this.updateTextTracks(t.renditions), a(gC, this, this.filterRenditions(t.renditions, n.channelId).then((e) => {
|
|
13041
13067
|
r === this.sessionId && (this.emitter.emit("renditions", {
|
|
13042
13068
|
renditions: e,
|
|
13043
13069
|
channelId: n.channelId
|
|
13044
13070
|
}), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged());
|
|
13045
13071
|
}).finally(() => {
|
|
13046
|
-
a(
|
|
13072
|
+
a(gC, this, void 0);
|
|
13047
13073
|
}));
|
|
13048
13074
|
break;
|
|
13049
13075
|
case "subscription changed":
|
|
13050
13076
|
var i;
|
|
13051
13077
|
try {
|
|
13052
|
-
|
|
13078
|
+
sC(t.subscription);
|
|
13053
13079
|
} catch (e) {
|
|
13054
13080
|
this.emitter.emit("error", new A("Subscription failed validation", {
|
|
13055
13081
|
source: e instanceof Error ? e : void 0,
|
|
@@ -13180,7 +13206,7 @@ var zS = class {
|
|
|
13180
13206
|
let ye = function() {
|
|
13181
13207
|
var e = t(function* (e) {
|
|
13182
13208
|
let t = e.channelId;
|
|
13183
|
-
s(
|
|
13209
|
+
s(gC, o) && (yield s(gC, o));
|
|
13184
13210
|
let n = o.modules.renditions.getRendition(e.renditionId, t);
|
|
13185
13211
|
if (!Rs(e.flags)) {
|
|
13186
13212
|
if (zs(e.flags)) {
|
|
@@ -13194,8 +13220,8 @@ var zS = class {
|
|
|
13194
13220
|
} catch (e) {
|
|
13195
13221
|
o.logger.warn("failed to parse WebVTT segment, dropping it", e);
|
|
13196
13222
|
}
|
|
13197
|
-
let i = n / 1e3, c = s(
|
|
13198
|
-
if (a(
|
|
13223
|
+
let i = n / 1e3, c = s(hC, o).find((t) => t.language === e.language), l = i - s(mC, o);
|
|
13224
|
+
if (a(mC, o, i), c) {
|
|
13199
13225
|
if (c.cues) for (let e of c.cues) e.startTime -= l, e.endTime -= l;
|
|
13200
13226
|
for (let e of r) {
|
|
13201
13227
|
let t = new VTTCue(e.startTime - i, e.endTime - i, e.text);
|
|
@@ -13231,10 +13257,10 @@ var zS = class {
|
|
|
13231
13257
|
mimeType: s
|
|
13232
13258
|
}), o.emit("initialized media");
|
|
13233
13259
|
} else {
|
|
13234
|
-
let t =
|
|
13260
|
+
let t = QS(e, n, o.sizes.get(e.renditionId));
|
|
13235
13261
|
o.modules.jitter.recordSample(t);
|
|
13236
13262
|
let i = o.sampleProcessingSesssions.get(r);
|
|
13237
|
-
if (!i) i =
|
|
13263
|
+
if (!i) i = qS(o.modules.sync.processSample(t)), o.sampleProcessingSesssions.set(r, i);
|
|
13238
13264
|
else {
|
|
13239
13265
|
let e = o.willUseMediaSource() && o.isSwitchingRenditionLevel && t.type === "video", n = i(o.modules.sync.processSample(t), e), r = t;
|
|
13240
13266
|
n.forEach((e) => {
|
|
@@ -13341,7 +13367,7 @@ var zS = class {
|
|
|
13341
13367
|
this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
|
|
13342
13368
|
}
|
|
13343
13369
|
set textTrack(e) {
|
|
13344
|
-
e !== this.textTrack && (s(
|
|
13370
|
+
e !== this.textTrack && (s(hC, this).forEach((t) => {
|
|
13345
13371
|
if (t.label === e) t.mode = "showing";
|
|
13346
13372
|
else {
|
|
13347
13373
|
if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
|
|
@@ -13350,11 +13376,11 @@ var zS = class {
|
|
|
13350
13376
|
}), this.emitter.emit("text track", e));
|
|
13351
13377
|
}
|
|
13352
13378
|
get textTracks() {
|
|
13353
|
-
return s(
|
|
13379
|
+
return s(hC, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
|
|
13354
13380
|
}
|
|
13355
13381
|
get textTrack() {
|
|
13356
13382
|
var e;
|
|
13357
|
-
return (e = s(
|
|
13383
|
+
return (e = s(hC, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
|
|
13358
13384
|
}
|
|
13359
13385
|
get channelId() {
|
|
13360
13386
|
var e, t;
|
|
@@ -13492,7 +13518,7 @@ var zS = class {
|
|
|
13492
13518
|
return this.modules.subscription.getTargetSubscription();
|
|
13493
13519
|
}
|
|
13494
13520
|
resolvedDecoder(e) {
|
|
13495
|
-
return
|
|
13521
|
+
return ZS(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
|
|
13496
13522
|
}
|
|
13497
13523
|
usesSplitCanvasAudio() {
|
|
13498
13524
|
return !this.willUseMediaSource() && this.options.get("streamToMediaElementEnabled") && mt(this.browser) && this.options.get("media") !== "audio" && this.options.get("media") !== "video" && this.browser.platform.isIOS;
|
|
@@ -13532,6 +13558,6 @@ var zS = class {
|
|
|
13532
13558
|
return this.hasCalledConnect && this.isBackgroundPlayEnabled(e) && !this.isUserPaused;
|
|
13533
13559
|
}
|
|
13534
13560
|
};
|
|
13535
|
-
e(
|
|
13561
|
+
e(_C, "MAX_POOL_SIZE", 10), e(_C, "REMOVE_CUE_THRESHOLD", 1e3 * 10), e(_C, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 1e3 * 15), e(_C, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
|
|
13536
13562
|
//#endregion
|
|
13537
|
-
export { ut as C, pt as D, lt as E, ze as O, ft as S, at as T, tt as _, bn as a, et as b, gn as c, Sn as d, A as f, Qe as g, nt as h, vn as i, Re as k, Dn as l, $e as m, Nn as n, xn as o, qt as p, yn as r, _n as s,
|
|
13563
|
+
export { ut as C, pt as D, lt as E, ze as O, ft as S, at as T, tt as _, bn as a, et as b, gn as c, Sn as d, A as f, Qe as g, nt as h, vn as i, Re as k, Dn as l, $e as m, Nn as n, xn as o, qt as p, yn as r, _n as s, _C as t, Cn as u, st as v, ct as w, it as x, Ze as y };
|