@vindral/web-sdk 4.8.0-1-g2694f6a6 → 4.8.0-2-g31d0f7c0
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/{BvS18--X.js → C9eQS1Qa.js} +483 -467
- package/{DP2MXiaO.js → DtZRH1Mz.js} +1 -1
- package/core.js +1 -1
- package/legacy.es.js +668 -650
- package/legacy.umd.js +16 -16
- package/package.json +1 -1
- package/player.js +2 -2
- 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, "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");
|
|
@@ -9070,7 +9086,7 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9070
9086
|
}
|
|
9071
9087
|
}
|
|
9072
9088
|
}), e(this, "connectWebSocketTransport", () => {
|
|
9073
|
-
let e = new
|
|
9089
|
+
let e = new ob({
|
|
9074
9090
|
reconnectDelay: 1e3,
|
|
9075
9091
|
onMessage: this.onMessage,
|
|
9076
9092
|
reconnectHandler: this.config.reconnectHandler,
|
|
@@ -9094,7 +9110,7 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9094
9110
|
}), 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
9111
|
if (this.isContextSwitchInProgress || !e.includes("\"timing info\"")) return !1;
|
|
9096
9112
|
let t = JSON.parse(e);
|
|
9097
|
-
return !hn(t) || t.type !== "timing info" ? !1 : (this.linkQueue.sample(t.timingInfo.wallclockTime, performance.timeOrigin + performance.now()),
|
|
9113
|
+
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
9114
|
}), e(this, "correctTimingInfo", (e) => {
|
|
9099
9115
|
var t;
|
|
9100
9116
|
if (!e.includes("\"timing info\"")) return e;
|
|
@@ -9118,8 +9134,8 @@ var $y = /* @__PURE__ */ function(e) {
|
|
|
9118
9134
|
return this.disconnected.promise;
|
|
9119
9135
|
}
|
|
9120
9136
|
};
|
|
9121
|
-
|
|
9122
|
-
let o = new
|
|
9137
|
+
sb = fb, e(fb, "PING_INTERVAL", 5e3), e(fb, "MAX_MISSED_PINGS", 4), e(fb, "TLS_ROUNDTRIPS", 3), e(fb, "start", (e, t, n, r) => new Promise((i, a) => {
|
|
9138
|
+
let o = new sb(e, t, n, r);
|
|
9123
9139
|
o.transport.once("error", (e) => a(e)), o.transport.once("open", () => {
|
|
9124
9140
|
var e;
|
|
9125
9141
|
(e = n.onTransportConnected) == null || e.call(n), i(o);
|
|
@@ -9127,58 +9143,58 @@ tb = ob, e(ob, "PING_INTERVAL", 5e3), e(ob, "MAX_MISSED_PINGS", 4), e(ob, "TLS_R
|
|
|
9127
9143
|
}));
|
|
9128
9144
|
//#endregion
|
|
9129
9145
|
//#region ../../libs/web-sdk/src/EdgeSelector.ts
|
|
9130
|
-
var
|
|
9146
|
+
var pb = (e) => {
|
|
9131
9147
|
var t;
|
|
9132
9148
|
return typeof e == "string" ? e : `${e.moqWsUrl}|${(t = e.moqUrl) == null ? "" : t}`;
|
|
9133
|
-
},
|
|
9149
|
+
}, 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
9150
|
constructor(e) {
|
|
9135
|
-
i(this,
|
|
9151
|
+
i(this, hb, void 0), i(this, gb, []), i(this, _b, /* @__PURE__ */ new Set()), i(this, vb, void 0), a(hb, this, e);
|
|
9136
9152
|
}
|
|
9137
9153
|
select(e) {
|
|
9138
|
-
if (s(
|
|
9154
|
+
if (s(hb, this).edgeUrl) return s(hb, this).edgeUrl;
|
|
9139
9155
|
if (e.length > 0) {
|
|
9140
|
-
a(
|
|
9141
|
-
let t = new Set(s(
|
|
9142
|
-
for (let e of s(
|
|
9156
|
+
a(gb, this, [...e]);
|
|
9157
|
+
let t = new Set(s(gb, this).map((e) => pb(e)));
|
|
9158
|
+
for (let e of s(_b, this)) t.has(e) || s(_b, this).delete(e);
|
|
9143
9159
|
}
|
|
9144
|
-
if (s(
|
|
9145
|
-
let t = s(
|
|
9146
|
-
t.length === 0 && (s(
|
|
9160
|
+
if (s(gb, this).length === 0) return;
|
|
9161
|
+
let t = s(gb, this).filter((e) => !s(_b, this).has(pb(e)));
|
|
9162
|
+
t.length === 0 && (s(_b, this).clear(), t = s(gb, this));
|
|
9147
9163
|
let n = t[0];
|
|
9148
|
-
if (n) return s(
|
|
9164
|
+
if (n) return s(_b, this).add(pb(n)), a(vb, this, n), n;
|
|
9149
9165
|
}
|
|
9150
9166
|
shiftedEdge() {
|
|
9151
|
-
return s(
|
|
9167
|
+
return s(vb, this);
|
|
9152
9168
|
}
|
|
9153
9169
|
hasRemainingEdges() {
|
|
9154
|
-
return s(
|
|
9170
|
+
return s(gb, this).some((e) => !s(_b, this).has(pb(e)));
|
|
9155
9171
|
}
|
|
9156
9172
|
reset() {
|
|
9157
|
-
a(
|
|
9173
|
+
a(vb, this, void 0), a(gb, this, []), s(_b, this).clear();
|
|
9158
9174
|
}
|
|
9159
|
-
},
|
|
9175
|
+
}, bb, xb = (e) => {
|
|
9160
9176
|
if (e instanceof A && (e.code() === "channel_not_live" || e.code() === "channel_not_found")) return !0;
|
|
9161
9177
|
let t = e instanceof A ? e.source() : e;
|
|
9162
9178
|
if (!(t instanceof Error) || !f(t)) return !1;
|
|
9163
9179
|
let { status: n } = t;
|
|
9164
9180
|
return n >= 400 && n < 500 && n !== 408 && n !== 429;
|
|
9165
|
-
},
|
|
9181
|
+
}, 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
9182
|
constructor(c, l, u) {
|
|
9167
9183
|
var d = this;
|
|
9168
|
-
C(this,
|
|
9184
|
+
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
9185
|
var e;
|
|
9170
|
-
this.logger.debug("Unloading module..."), this.emitter.off("page active", s(
|
|
9186
|
+
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
9187
|
}), e(this, "suspend", () => {
|
|
9172
9188
|
var e, t;
|
|
9173
|
-
a($, this, !1), (e = s(
|
|
9189
|
+
a($, this, !1), (e = s(Db, this)) == null || e.abort(), (t = this.connectionImpl) == null || t.suspend();
|
|
9174
9190
|
}), e(this, "unsuspend", () => {
|
|
9175
9191
|
var e;
|
|
9176
9192
|
a($, this, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
|
|
9177
9193
|
}), e(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected"), e(this, "getStatistics", () => {
|
|
9178
9194
|
var e;
|
|
9179
|
-
let t = s(
|
|
9195
|
+
let t = s(Ob, this) > 0 ? s(kb, this) / s(Ob, this) : 0;
|
|
9180
9196
|
if (!this.connectionImpl) {
|
|
9181
|
-
let e = s(
|
|
9197
|
+
let e = s(Bb, this).call(this);
|
|
9182
9198
|
return {
|
|
9183
9199
|
rtt: {
|
|
9184
9200
|
min: 0,
|
|
@@ -9187,17 +9203,17 @@ var sb = (e) => {
|
|
|
9187
9203
|
last: 0
|
|
9188
9204
|
},
|
|
9189
9205
|
estimatedBandwidth: 0,
|
|
9190
|
-
connectCount: s(
|
|
9191
|
-
backlogReconnectCount: s(
|
|
9192
|
-
connectionAttemptCount: s(
|
|
9206
|
+
connectCount: s(kb, this),
|
|
9207
|
+
backlogReconnectCount: s(Ab, this),
|
|
9208
|
+
connectionAttemptCount: s(Ob, this),
|
|
9193
9209
|
connectionSuccessRatio: t,
|
|
9194
|
-
timeToConnected: s(
|
|
9210
|
+
timeToConnected: s(Pb, this),
|
|
9195
9211
|
edgeUrl: e == null ? void 0 : e.edgeUrl,
|
|
9196
9212
|
connectionProtocol: e == null ? void 0 : e.connectionProtocol,
|
|
9197
9213
|
transportSelectionReason: e == null ? void 0 : e.transportSelectionReason
|
|
9198
9214
|
};
|
|
9199
9215
|
}
|
|
9200
|
-
let n = this.connectionImpl.getStatistics(), r = (e = this.linkQueue) == null ? void 0 : e.summary(
|
|
9216
|
+
let n = this.connectionImpl.getStatistics(), r = (e = this.linkQueue) == null ? void 0 : e.summary(Sb);
|
|
9201
9217
|
return x(x({}, n), {}, {
|
|
9202
9218
|
linkQueue: r && {
|
|
9203
9219
|
last: Math.round(r.last),
|
|
@@ -9205,30 +9221,30 @@ var sb = (e) => {
|
|
|
9205
9221
|
max: Math.round(r.max),
|
|
9206
9222
|
min: Math.round(r.min)
|
|
9207
9223
|
},
|
|
9208
|
-
rtt: yt(s(
|
|
9224
|
+
rtt: yt(s(Cb, this).items()),
|
|
9209
9225
|
estimatedBandwidth: this.estimatedBandwidth,
|
|
9210
|
-
connectCount: s(
|
|
9211
|
-
backlogReconnectCount: s(
|
|
9212
|
-
connectionAttemptCount: s(
|
|
9226
|
+
connectCount: s(kb, this),
|
|
9227
|
+
backlogReconnectCount: s(Ab, this),
|
|
9228
|
+
connectionAttemptCount: s(Ob, this),
|
|
9213
9229
|
connectionSuccessRatio: t,
|
|
9214
|
-
timeToConnected: s(
|
|
9230
|
+
timeToConnected: s(Pb, this)
|
|
9215
9231
|
});
|
|
9216
|
-
}), i(this,
|
|
9217
|
-
if (a($, this, !0), s(
|
|
9232
|
+
}), i(this, Bb, () => s($, this) && s(Ib, this) ? s(Ib, this) : s(Fb, this)), e(this, "connect", () => {
|
|
9233
|
+
if (a($, this, !0), s(wb, this)) {
|
|
9218
9234
|
var e;
|
|
9219
|
-
(e = s(
|
|
9235
|
+
(e = s(Db, this)) == null || e.abort();
|
|
9220
9236
|
return;
|
|
9221
9237
|
}
|
|
9222
9238
|
let t = performance.now();
|
|
9223
|
-
s(
|
|
9224
|
-
}), i(this,
|
|
9225
|
-
s(
|
|
9239
|
+
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));
|
|
9240
|
+
}), i(this, Vb, () => {
|
|
9241
|
+
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
9242
|
}), e(this, "disconnect", (e = "Disconnect Requested") => {
|
|
9227
9243
|
var t, n;
|
|
9228
|
-
a($, this, !1), (t = s(
|
|
9244
|
+
a($, this, !1), (t = s(Db, this)) == null || t.abort(), s(Kb, this).call(this), (n = this.connectionImpl) == null || n.close(e);
|
|
9229
9245
|
}), e(this, "reconnect", (e) => {
|
|
9230
9246
|
this.disconnect(e), this.connect();
|
|
9231
|
-
}), i(this,
|
|
9247
|
+
}), i(this, Hb, t(function* () {
|
|
9232
9248
|
try {
|
|
9233
9249
|
return yield d.apiClient.connect(d.config.options.getOptions());
|
|
9234
9250
|
} catch (e) {
|
|
@@ -9239,7 +9255,7 @@ var sb = (e) => {
|
|
|
9239
9255
|
}
|
|
9240
9256
|
throw d.emitter.emit("error", Qn(e instanceof Error ? e : void 0)), e;
|
|
9241
9257
|
}
|
|
9242
|
-
})), i(this,
|
|
9258
|
+
})), i(this, Ub, t(function* () {
|
|
9243
9259
|
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
9260
|
try {
|
|
9245
9261
|
return yield fetch(new URL("/api/v4/connect/ping", d.config.options.get("url")).toString(), {
|
|
@@ -9251,147 +9267,147 @@ var sb = (e) => {
|
|
|
9251
9267
|
} finally {
|
|
9252
9268
|
clearTimeout(i);
|
|
9253
9269
|
}
|
|
9254
|
-
})), i(this,
|
|
9255
|
-
s(
|
|
9270
|
+
})), i(this, Gb, () => {
|
|
9271
|
+
s(Kb, this).call(this), a(zb, this, setTimeout(() => {
|
|
9256
9272
|
var e;
|
|
9257
|
-
!s(
|
|
9273
|
+
!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
9274
|
}, n.EDGE_SELECTOR_RESET_TIMEOUT));
|
|
9259
|
-
}), i(this,
|
|
9260
|
-
s(
|
|
9261
|
-
}), i(this,
|
|
9275
|
+
}), i(this, Kb, () => {
|
|
9276
|
+
s(zb, this) !== void 0 && (clearTimeout(s(zb, this)), a(zb, this, void 0));
|
|
9277
|
+
}), i(this, qb, function() {
|
|
9262
9278
|
var e = t(function* (e) {
|
|
9263
|
-
a(
|
|
9279
|
+
a(Db, d, globalThis.AbortController ? new AbortController() : void 0);
|
|
9264
9280
|
try {
|
|
9265
|
-
let c = yield d.config.reconnectHandler({ reconnectRetries: s(
|
|
9281
|
+
let c = yield d.config.reconnectHandler({ reconnectRetries: s(Tb, d) });
|
|
9266
9282
|
if (!s($, d)) return !1;
|
|
9267
9283
|
if (!c) return a($, d, !1), d.emitter.emit("error", $n()), !1;
|
|
9268
9284
|
if (!d.config.documentState.isVisible) {
|
|
9269
9285
|
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(
|
|
9286
|
+
if ((t = s(Db, d)) != null && t.signal.aborted) return s($, d);
|
|
9287
|
+
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);
|
|
9288
|
+
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
9289
|
}
|
|
9274
|
-
return a(
|
|
9290
|
+
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
9291
|
} finally {
|
|
9276
|
-
a(
|
|
9292
|
+
a(Db, d, void 0);
|
|
9277
9293
|
}
|
|
9278
9294
|
});
|
|
9279
9295
|
return function(t) {
|
|
9280
9296
|
return e.apply(this, arguments);
|
|
9281
9297
|
};
|
|
9282
|
-
}()), i(this,
|
|
9298
|
+
}()), i(this, Jb, (e) => {
|
|
9283
9299
|
if (e) {
|
|
9284
9300
|
var t;
|
|
9285
|
-
(t = s(
|
|
9301
|
+
(t = s(Db, this)) == null || t.abort();
|
|
9286
9302
|
}
|
|
9287
|
-
}), i(this,
|
|
9288
|
-
s(
|
|
9289
|
-
}), i(this,
|
|
9290
|
-
for (; s(
|
|
9291
|
-
let t = s(
|
|
9303
|
+
}), i(this, Yb, (e = performance.now()) => {
|
|
9304
|
+
s(Zb, this).call(this, e), s(Rb, this).push(e);
|
|
9305
|
+
}), 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) => {
|
|
9306
|
+
for (; s(Rb, this).length > 0;) {
|
|
9307
|
+
let t = s(Rb, this)[0];
|
|
9292
9308
|
if (t === void 0 || t > e - n.RECONNECT_BACKOFF_BURST_WINDOW_MS) return;
|
|
9293
|
-
s(
|
|
9309
|
+
s(Rb, this).shift();
|
|
9294
9310
|
}
|
|
9295
9311
|
}), this.logger = l, this.emitter = c, this.config = u, this.apiClient = new g({
|
|
9296
9312
|
publicEndpoint: this.config.options.get("url").toString(),
|
|
9297
9313
|
tokenFactory: () => this.config.options.get("authenticationToken")
|
|
9298
|
-
}), this.emitter.on("page active", s(
|
|
9314
|
+
}), this.emitter.on("page active", s(Jb, this));
|
|
9299
9315
|
}
|
|
9300
9316
|
get rtt() {
|
|
9301
|
-
return s(
|
|
9317
|
+
return s(Cb, this).items().length > 0 ? gt(s(Cb, this).items()) : 0;
|
|
9302
9318
|
}
|
|
9303
9319
|
get isMoq() {
|
|
9304
|
-
return this.connectionImpl instanceof
|
|
9320
|
+
return this.connectionImpl instanceof Uy;
|
|
9305
9321
|
}
|
|
9306
9322
|
get estimatedBandwidth() {
|
|
9307
9323
|
if (this.connectionImpl && "estimatedBandwidth" in this.connectionImpl) {
|
|
9308
9324
|
let e = this.connectionImpl.estimatedBandwidth;
|
|
9309
9325
|
if (e && Number.isFinite(e)) return e;
|
|
9310
9326
|
}
|
|
9311
|
-
return
|
|
9327
|
+
return db(this.rtt);
|
|
9312
9328
|
}
|
|
9313
9329
|
get linkQueue() {
|
|
9314
9330
|
var e;
|
|
9315
9331
|
return (e = this.connectionImpl) == null ? void 0 : e.linkQueue;
|
|
9316
9332
|
}
|
|
9317
9333
|
get firstConnectStartTime() {
|
|
9318
|
-
return s(
|
|
9334
|
+
return s(Mb, this);
|
|
9319
9335
|
}
|
|
9320
9336
|
get lastConnectionTime() {
|
|
9321
|
-
return s(
|
|
9337
|
+
return s(Nb, this);
|
|
9322
9338
|
}
|
|
9323
9339
|
};
|
|
9324
|
-
|
|
9325
|
-
function
|
|
9340
|
+
bb = Qb;
|
|
9341
|
+
function $b() {
|
|
9326
9342
|
var e = this;
|
|
9327
9343
|
return t(function* () {
|
|
9328
|
-
let t = new
|
|
9329
|
-
for (a(
|
|
9344
|
+
let t = new yb({ edgeUrl: e.config.options.get("edgeUrl") });
|
|
9345
|
+
for (a(Lb, e, t), s(Kb, e).call(e), a(Tb, e, 0), a(Eb, e, 0), a(Rb, e, []);;) {
|
|
9330
9346
|
var n, r;
|
|
9331
9347
|
let u = "standard";
|
|
9332
|
-
a(
|
|
9348
|
+
a(Ob, e, (n = s(Ob, e), n++, n)), s(Yb, e).call(e);
|
|
9333
9349
|
let f = !1;
|
|
9334
|
-
a(
|
|
9350
|
+
a(Ib, e, {});
|
|
9335
9351
|
try {
|
|
9336
9352
|
var i, o;
|
|
9337
|
-
let [n, r] = yield Promise.all([s(
|
|
9338
|
-
if (s(
|
|
9353
|
+
let [n, r] = yield Promise.all([s(Hb, e).call(e), s(Ub, e).call(e)]);
|
|
9354
|
+
if (s(Cb, e).clear(), r !== void 0 && s(Cb, e).push(r / 2), !s($, e)) break;
|
|
9339
9355
|
let l = t.select(n.edges);
|
|
9340
9356
|
if (!l) throw new A("Failed to resolve edge url", {
|
|
9341
9357
|
isFatal: !0,
|
|
9342
9358
|
code: "failed_to_resolve_edge_url"
|
|
9343
9359
|
});
|
|
9344
|
-
a(
|
|
9360
|
+
a(Ib, e, { edgeUrl: Pv(mb(l)) });
|
|
9345
9361
|
try {
|
|
9346
|
-
c(n) ? e.connectionImpl = yield
|
|
9362
|
+
c(n) ? e.connectionImpl = yield Uy.start(e.emitter, e.logger, e.apiClient, x(x({}, e.config), {}, {
|
|
9347
9363
|
connectInfo: n,
|
|
9348
9364
|
edgeUrl: l,
|
|
9349
|
-
onTransportConnected: s(
|
|
9350
|
-
}), s(
|
|
9365
|
+
onTransportConnected: s(Vb, e)
|
|
9366
|
+
}), 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
9367
|
connectInfo: n,
|
|
9352
9368
|
edgeUrl: l,
|
|
9353
|
-
onTransportConnected: s(
|
|
9354
|
-
}), s(
|
|
9369
|
+
onTransportConnected: s(Vb, e)
|
|
9370
|
+
}), s(Cb, e)));
|
|
9355
9371
|
} catch (e) {
|
|
9356
9372
|
throw u = "cached_edge", e;
|
|
9357
9373
|
}
|
|
9358
|
-
a(
|
|
9374
|
+
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
9375
|
let f = yield e.connectionImpl.closed();
|
|
9360
|
-
e.connectionImpl.closedForBacklog && a(
|
|
9376
|
+
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
9377
|
} catch (n) {
|
|
9362
|
-
if (e.logger.warn("Failed to connect", n), !e.connectionImpl && (e.config.documentState.isVisible ||
|
|
9378
|
+
if (e.logger.warn("Failed to connect", n), !e.connectionImpl && (e.config.documentState.isVisible || xb(n))) {
|
|
9363
9379
|
var l;
|
|
9364
|
-
a(
|
|
9380
|
+
a(Tb, e, (l = s(Tb, e), l++, l));
|
|
9365
9381
|
}
|
|
9366
9382
|
let r = t.shiftedEdge();
|
|
9367
9383
|
r && e.emitter.emit("telemetry event", {
|
|
9368
9384
|
code: "shifted_edge",
|
|
9369
|
-
edgeUrl:
|
|
9385
|
+
edgeUrl: mb(r)
|
|
9370
9386
|
}), n instanceof A ? (e.emitter.emit("error", n), f = n.isFatal()) : n instanceof Error && e.emitter.emit("error", new A(n.message, {
|
|
9371
9387
|
code: "start_failed",
|
|
9372
9388
|
isFatal: !1
|
|
9373
9389
|
}));
|
|
9374
9390
|
}
|
|
9375
|
-
if ((r = e.connectionImpl) == null || r.unload(), e.connectionImpl = void 0, s(
|
|
9391
|
+
if ((r = e.connectionImpl) == null || r.unload(), e.connectionImpl = void 0, s(Kb, e).call(e), f) {
|
|
9376
9392
|
a($, e, !1);
|
|
9377
9393
|
break;
|
|
9378
9394
|
}
|
|
9379
|
-
if (!s($, e) || !(yield s(
|
|
9395
|
+
if (!s($, e) || !(yield s(qb, e).call(e, u === "cached_edge" && t.hasRemainingEdges() ? "cached_edge" : "standard"))) break;
|
|
9380
9396
|
}
|
|
9381
|
-
a(
|
|
9397
|
+
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
9398
|
})();
|
|
9383
9399
|
}
|
|
9384
|
-
e(
|
|
9400
|
+
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
9401
|
//#endregion
|
|
9386
9402
|
//#region ../../libs/web-sdk/src/modules/ConstraintCapModule.ts
|
|
9387
|
-
var
|
|
9403
|
+
var ex, tx = () => ({
|
|
9388
9404
|
video: x(x({}, mn()), {}, { bitRate: pn() }),
|
|
9389
9405
|
audio: { bitRate: pn() }
|
|
9390
|
-
}),
|
|
9406
|
+
}), nx = () => ({
|
|
9391
9407
|
width: window.innerWidth,
|
|
9392
9408
|
height: window.innerHeight,
|
|
9393
9409
|
bitRate: pn()
|
|
9394
|
-
}),
|
|
9410
|
+
}), rx = class t {
|
|
9395
9411
|
constructor(n, r, i, a) {
|
|
9396
9412
|
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
9413
|
var e;
|
|
@@ -9413,7 +9429,7 @@ var Jb, Yb = () => ({
|
|
|
9413
9429
|
this.timers.unload();
|
|
9414
9430
|
}), e(this, "setUserSpecifiedCap", (e) => {
|
|
9415
9431
|
var t;
|
|
9416
|
-
let n = (t = this.getUserSpecifiedCap()) == null ?
|
|
9432
|
+
let n = (t = this.getUserSpecifiedCap()) == null ? tx() : t;
|
|
9417
9433
|
this.userSpecifiedCap = x(x({}, n), {}, {
|
|
9418
9434
|
video: x(x({}, n.video), e.video),
|
|
9419
9435
|
audio: x(x({}, n.audio), e.audio)
|
|
@@ -9437,7 +9453,7 @@ var Jb, Yb = () => ({
|
|
|
9437
9453
|
});
|
|
9438
9454
|
}), e(this, "evaluateConstraintCap", () => {
|
|
9439
9455
|
var e, t, n, r;
|
|
9440
|
-
let i = this.sizeBasedResolutionCapEnabled ? x(x({},
|
|
9456
|
+
let i = this.sizeBasedResolutionCapEnabled ? x(x({}, tx()), {}, { video: nx() }) : tx();
|
|
9441
9457
|
if (!this.resizeObserver) {
|
|
9442
9458
|
let e = this.element.getBoundingClientRect();
|
|
9443
9459
|
this.elementSize = {
|
|
@@ -9474,20 +9490,20 @@ var Jb, Yb = () => ({
|
|
|
9474
9490
|
this._sizeBasedResolutionCapEnabled = e, this.evaluateConstraintCap();
|
|
9475
9491
|
}
|
|
9476
9492
|
};
|
|
9477
|
-
|
|
9493
|
+
ex = rx, e(rx, "CHECK_SIZE_INTERVAL", 1e3), e(rx, "create", (e, t, n, r) => new ex(e, t, n, r));
|
|
9478
9494
|
//#endregion
|
|
9479
9495
|
//#region ../../libs/web-sdk/src/renditionKey.ts
|
|
9480
|
-
var
|
|
9496
|
+
var ix = (e, t) => `${e}\u0000${t == null ? "" : t}`, ax = (e, t, n, r) => e === n && t === r, ox = class {
|
|
9481
9497
|
constructor() {
|
|
9482
9498
|
e(this, "lastKey", void 0), e(this, "shouldNotify", (e, t) => {
|
|
9483
|
-
let n =
|
|
9499
|
+
let n = ix(e, t);
|
|
9484
9500
|
return this.lastKey === n ? !1 : (this.lastKey = n, !0);
|
|
9485
9501
|
});
|
|
9486
9502
|
}
|
|
9487
|
-
},
|
|
9503
|
+
}, sx = 5, cx = 40, lx = 1, ux = 3e4, dx = 5, fx = (e) => {
|
|
9488
9504
|
var t, n;
|
|
9489
9505
|
return ((t = e.maxCompositionOffsetMs) == null ? 0 : t) - ((n = e.minCompositionOffsetMs) == null ? 0 : n);
|
|
9490
|
-
},
|
|
9506
|
+
}, px = (e, t, n) => {
|
|
9491
9507
|
let r = [];
|
|
9492
9508
|
for (let i of e) {
|
|
9493
9509
|
let e = r[r.length - 1];
|
|
@@ -9501,10 +9517,10 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9501
9517
|
});
|
|
9502
9518
|
}
|
|
9503
9519
|
return r;
|
|
9504
|
-
},
|
|
9520
|
+
}, mx = (e, t) => {
|
|
9505
9521
|
let n = e[e.length - 1];
|
|
9506
9522
|
n && n.end > t && n.start < t && (n.end = t);
|
|
9507
|
-
},
|
|
9523
|
+
}, hx = 100, gx = 1e3, _x = class n {
|
|
9508
9524
|
constructor(t, n, r, i, a = !1, o = !1, s = !1) {
|
|
9509
9525
|
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
9526
|
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 +9538,8 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9522
9538
|
}), e(this, "unsuspend", () => {
|
|
9523
9539
|
this.isSuspended = !1, this.emitDecodedFrames(), this._audioWebCodecsInUse && this.scheduleAudioEmitRetry();
|
|
9524
9540
|
}), e(this, "armTimers", () => {
|
|
9525
|
-
let e = this._audioWebCodecsInUse ? 20 :
|
|
9526
|
-
this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate,
|
|
9541
|
+
let e = this._audioWebCodecsInUse ? 20 : hx;
|
|
9542
|
+
this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate, gx);
|
|
9527
9543
|
}), e(this, "replaceTimers", () => {
|
|
9528
9544
|
let e = this.isAudioEmitRetryScheduled;
|
|
9529
9545
|
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 +9608,27 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9592
9608
|
i.stream = `${e.channelId}/${e.renditionId}`;
|
|
9593
9609
|
let c = (e.timestamp + a) / e.timescale * 1e3, l = e.duration / e.timescale * 1e3;
|
|
9594
9610
|
l > 0 && (i.sampleDuration = l);
|
|
9595
|
-
let u = i.sampleDuration ||
|
|
9611
|
+
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
9612
|
i.lastDecodeTimestampMs = g ? d : Math.max((r = i.lastDecodeTimestampMs) == null ? d : r, d);
|
|
9597
|
-
let _ = i.channelId !== void 0 &&
|
|
9613
|
+
let _ = i.channelId !== void 0 && !ax(i.channelId, i.renditionId, e.channelId, e.renditionId);
|
|
9598
9614
|
i.channelId = e.channelId, i.renditionId = e.renditionId, (g || _) && (i.minCompositionOffsetMs = void 0, i.maxCompositionOffsetMs = void 0, i.hasAnchoredGop = !1, i.isReorderStructureStale = !0);
|
|
9599
9615
|
let v = i.hasAnchoredGop === !0;
|
|
9600
9616
|
if (e.isSync && (i.hasAnchoredGop = !0), !g && i.hasAnchoredGop) {
|
|
9601
9617
|
var y, b;
|
|
9602
9618
|
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
9619
|
}
|
|
9604
|
-
let ee =
|
|
9620
|
+
let ee = fx(i) > 0;
|
|
9605
9621
|
if (g) i.buffer = [{
|
|
9606
9622
|
start: c,
|
|
9607
9623
|
end: c + u
|
|
9608
9624
|
}], i.frontierSampleDurationMs = u, e.type === "video" && (this.videoKeyframeTimestamps = []);
|
|
9609
9625
|
else {
|
|
9610
9626
|
var te;
|
|
9611
|
-
!ee && !i.isReorderStructureStale &&
|
|
9627
|
+
!ee && !i.isReorderStructureStale && mx(s, c + u);
|
|
9612
9628
|
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,
|
|
9629
|
+
(e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), tn(s, c, c + u, sx);
|
|
9614
9630
|
}
|
|
9615
|
-
if (rn(i.buffer, this.playbackSource.currentTime -
|
|
9631
|
+
if (rn(i.buffer, this.playbackSource.currentTime - ux), i.playableRangesCache = void 0, e.type === "video" && e.isSync) {
|
|
9616
9632
|
let e = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
|
|
9617
9633
|
e !== void 0 && c < e && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(c), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
|
|
9618
9634
|
}
|
|
@@ -9649,11 +9665,11 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9649
9665
|
}
|
|
9650
9666
|
this.currentVideoDecodeRate = this.calculateVideoDecodeRate(), this.emitter.emit("video decode rate", this.currentVideoDecodeRate);
|
|
9651
9667
|
}), e(this, "playableRanges", (e) => {
|
|
9652
|
-
let t =
|
|
9668
|
+
let t = fx(e);
|
|
9653
9669
|
if (t <= 0) return e.buffer;
|
|
9654
9670
|
if (e.playableRangesCache === void 0) {
|
|
9655
9671
|
var n, r;
|
|
9656
|
-
e.playableRangesCache =
|
|
9672
|
+
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
9673
|
}
|
|
9658
9674
|
return e.playableRangesCache;
|
|
9659
9675
|
}), e(this, "updateBufferState", () => {
|
|
@@ -9740,7 +9756,7 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9740
9756
|
var e;
|
|
9741
9757
|
if (this._offscreenCanvasInUse) return (e = this.trackContexts.get("video")) == null ? void 0 : e.decoderContext.videoTrack;
|
|
9742
9758
|
}
|
|
9743
|
-
},
|
|
9759
|
+
}, vx, yx = class {
|
|
9744
9760
|
constructor(t) {
|
|
9745
9761
|
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
9762
|
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 +9786,12 @@ var Qb = (e, t) => `${e}\u0000${t == null ? "" : t}`, $b = (e, t, n, r) => e ===
|
|
|
9770
9786
|
return document.visibilityState === "visible" && !this.isBehindAnotherApp;
|
|
9771
9787
|
}
|
|
9772
9788
|
};
|
|
9773
|
-
|
|
9789
|
+
vx = yx, e(yx, "create", (e) => new vx(e));
|
|
9774
9790
|
//#endregion
|
|
9775
9791
|
//#region ../../libs/web-sdk/src/modules/EventModule.ts
|
|
9776
|
-
var
|
|
9792
|
+
var bx, xx = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e, Sx = class t {
|
|
9777
9793
|
constructor(n, r, i) {
|
|
9778
|
-
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered",
|
|
9794
|
+
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
9795
|
this.timers.setInterval(this.onBufferedStateChanged, t.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
|
|
9780
9796
|
}), e(this, "unload", () => {
|
|
9781
9797
|
this.timers.unload(), this.emitter.off("add event", this.addEvent);
|
|
@@ -9802,10 +9818,10 @@ var mx, hx = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e,
|
|
|
9802
9818
|
}), this.logger = r, this.emitter = n, this.timeSource = i;
|
|
9803
9819
|
}
|
|
9804
9820
|
};
|
|
9805
|
-
|
|
9821
|
+
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
9822
|
//#endregion
|
|
9807
9823
|
//#region ../../libs/web-sdk/src/modules/JitterModule.ts
|
|
9808
|
-
var
|
|
9824
|
+
var Cx = 1e3, wx = 50, Tx = class t {
|
|
9809
9825
|
constructor(t) {
|
|
9810
9826
|
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
9827
|
this.logger.debug("JitterModule loaded");
|
|
@@ -9826,9 +9842,9 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9826
9842
|
this.trackingState.set(n, {
|
|
9827
9843
|
lastArrivalTime: i,
|
|
9828
9844
|
lastTimestampMs: a,
|
|
9829
|
-
jitterSamples: new r(
|
|
9830
|
-
interArrivalTimes: new r(
|
|
9831
|
-
}), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(
|
|
9845
|
+
jitterSamples: new r(Cx),
|
|
9846
|
+
interArrivalTimes: new r(Cx)
|
|
9847
|
+
}), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(wx));
|
|
9832
9848
|
return;
|
|
9833
9849
|
}
|
|
9834
9850
|
let s = a - o.lastTimestampMs;
|
|
@@ -9841,7 +9857,7 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9841
9857
|
let u = (t = this.runningJitter.get(n)) == null ? 0 : t, d = u + (l - u) / 16;
|
|
9842
9858
|
this.runningJitter.set(n, d);
|
|
9843
9859
|
let f = this.recentJitterSamples.get(n);
|
|
9844
|
-
f || (f = new r(
|
|
9860
|
+
f || (f = new r(wx), this.recentJitterSamples.set(n, f)), f.push(l), o.lastArrivalTime = i, o.lastTimestampMs = a;
|
|
9845
9861
|
}
|
|
9846
9862
|
getJitterForType(e) {
|
|
9847
9863
|
for (let [i, a] of this.trackingState) if (i.startsWith(e)) {
|
|
@@ -9872,10 +9888,10 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9872
9888
|
videoJitter: this.getJitterForType("video")
|
|
9873
9889
|
};
|
|
9874
9890
|
}
|
|
9875
|
-
},
|
|
9891
|
+
}, Ex = () => window.AudioContext || window.webkitAudioContext, Dx = class r extends ne {
|
|
9876
9892
|
constructor() {
|
|
9877
9893
|
var i;
|
|
9878
|
-
super(), i = this, e(this, "context", new (
|
|
9894
|
+
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
9895
|
let e = !0, t = i.context.resume();
|
|
9880
9896
|
t.then(() => {
|
|
9881
9897
|
e = !1;
|
|
@@ -9910,10 +9926,10 @@ var _x = 1e3, vx = 50, yx = class t {
|
|
|
9910
9926
|
return this.context.state;
|
|
9911
9927
|
}
|
|
9912
9928
|
};
|
|
9913
|
-
e(
|
|
9929
|
+
e(Dx, "CHECK_INTERVAL", 1e3);
|
|
9914
9930
|
//#endregion
|
|
9915
9931
|
//#region ../../libs/web-audio-player/src/AudioPlayer.ts
|
|
9916
|
-
var
|
|
9932
|
+
var Ox, kx = 150, Ax = 400, jx = (e) => e === void 0 ? 5 : e <= kx ? 1 : e <= Ax ? 2 : 5, Mx = class extends ne {
|
|
9917
9933
|
get isContextRunning() {
|
|
9918
9934
|
var e;
|
|
9919
9935
|
return ((e = this.audio) == null ? void 0 : e.state) === "running";
|
|
@@ -9960,7 +9976,7 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
9960
9976
|
return this._bufferTime;
|
|
9961
9977
|
}
|
|
9962
9978
|
set bufferTime(e) {
|
|
9963
|
-
this._bufferTime = e, this.audioBufferMultiplier =
|
|
9979
|
+
this._bufferTime = e, this.audioBufferMultiplier = jx(e);
|
|
9964
9980
|
}
|
|
9965
9981
|
get sinkPaused() {
|
|
9966
9982
|
return this._sinkPaused;
|
|
@@ -10066,7 +10082,7 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
10066
10082
|
this.ignoreSuspendCalls = !1, this.emit("state change", "suspended");
|
|
10067
10083
|
}), e(this, "getAudioContext", () => this.audio ? this.audio : this.setupContext()), e(this, "setupContext", () => {
|
|
10068
10084
|
var e, t, r;
|
|
10069
|
-
return (e = this.audio) == null || e.unload(), this.audio = new
|
|
10085
|
+
return (e = this.audio) == null || e.unload(), this.audio = new Dx(), this.audio.on("state", (e) => {
|
|
10070
10086
|
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
10087
|
}), this.audio.on("stuck", () => {
|
|
10072
10088
|
if (!this.reInitWhenStuck) {
|
|
@@ -10077,7 +10093,7 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
10077
10093
|
}), (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
10094
|
}), e(this, "setGain", (e) => {
|
|
10079
10095
|
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 =
|
|
10096
|
+
}), this._muted = o, this._userProvidedMuted = o, this.logger = i, this.clockSource = a, this.reInitWhenStuck = s, this._bufferTime = c, this.audioBufferMultiplier = jx(c);
|
|
10081
10097
|
}
|
|
10082
10098
|
useMediaStreamDestination() {
|
|
10083
10099
|
var e;
|
|
@@ -10090,10 +10106,10 @@ var Sx, Cx = 150, wx = 400, Tx = (e) => e === void 0 ? 5 : e <= Cx ? 1 : e <= wx
|
|
|
10090
10106
|
return (e = this.gainNode) == null || e.connect(t), t;
|
|
10091
10107
|
}
|
|
10092
10108
|
};
|
|
10093
|
-
|
|
10109
|
+
Ox = Mx, e(Mx, "create", (e, t, n) => new Ox(e, t, n));
|
|
10094
10110
|
//#endregion
|
|
10095
10111
|
//#region ../../libs/web-sdk/src/players/VideoPlayer.ts
|
|
10096
|
-
var
|
|
10112
|
+
var Nx, Px = class {
|
|
10097
10113
|
constructor(t, n, r, i, a, o) {
|
|
10098
10114
|
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
10115
|
this.videoRenderer.load(), this.subscribeToContextLost(this.videoRenderer);
|
|
@@ -10183,12 +10199,12 @@ var Dx, Ox = class {
|
|
|
10183
10199
|
}), this.logger = t, this.clockSource = n, this.pool = r, this.renderTargetSize = i || this.videoRenderer.canvas, this.onCanvasChangeCallback = a, this.onRendererErrorCallback = o;
|
|
10184
10200
|
}
|
|
10185
10201
|
};
|
|
10186
|
-
|
|
10202
|
+
Nx = Px, e(Px, "create", (e, t, n, r, i, a) => new Nx(e, t, n, r, i, a));
|
|
10187
10203
|
//#endregion
|
|
10188
10204
|
//#region ../../libs/web-sdk/src/TextTracks.ts
|
|
10189
|
-
var
|
|
10205
|
+
var Fx = /* @__PURE__ */ new WeakMap(), Ix = class {
|
|
10190
10206
|
constructor() {
|
|
10191
|
-
i(this,
|
|
10207
|
+
i(this, Fx, []), a(Fx, this, []);
|
|
10192
10208
|
}
|
|
10193
10209
|
addTextTrack(e, t, n) {
|
|
10194
10210
|
let r = [], i = {
|
|
@@ -10205,43 +10221,43 @@ var kx = /* @__PURE__ */ new WeakMap(), Ax = class {
|
|
|
10205
10221
|
t !== -1 && r.splice(t, 1);
|
|
10206
10222
|
}
|
|
10207
10223
|
};
|
|
10208
|
-
return s(
|
|
10224
|
+
return s(Fx, this).push(i), i;
|
|
10209
10225
|
}
|
|
10210
10226
|
set language(e) {
|
|
10211
|
-
s(
|
|
10227
|
+
s(Fx, this).forEach((t) => {
|
|
10212
10228
|
t.language === e ? t.mode = "showing" : t.mode = "hidden";
|
|
10213
10229
|
});
|
|
10214
10230
|
}
|
|
10215
10231
|
get language() {
|
|
10216
10232
|
var e;
|
|
10217
|
-
return (e = s(
|
|
10233
|
+
return (e = s(Fx, this).find((e) => e.mode === "showing")) == null ? void 0 : e.language;
|
|
10218
10234
|
}
|
|
10219
10235
|
get tracks() {
|
|
10220
|
-
return s(
|
|
10236
|
+
return s(Fx, this);
|
|
10221
10237
|
}
|
|
10222
10238
|
get activeTrack() {
|
|
10223
|
-
return s(
|
|
10239
|
+
return s(Fx, this).find((e) => e.mode === "showing");
|
|
10224
10240
|
}
|
|
10225
10241
|
getActiveCues(e) {
|
|
10226
|
-
let t = s(
|
|
10242
|
+
let t = s(Fx, this).find((e) => e.mode === "showing");
|
|
10227
10243
|
return t ? t.cues.filter(({ startTime: t, endTime: n }) => e >= t && e < n) : [];
|
|
10228
10244
|
}
|
|
10229
|
-
},
|
|
10245
|
+
}, Lx = (e, t) => {
|
|
10230
10246
|
let n;
|
|
10231
10247
|
for (n = t; e > 1; e--) n += t;
|
|
10232
10248
|
return n;
|
|
10233
|
-
},
|
|
10249
|
+
}, Rx = class {
|
|
10234
10250
|
constructor() {
|
|
10235
10251
|
e(this, "audio", void 0), e(this, "unmute", () => this.audio.play().catch(n));
|
|
10236
10252
|
let t = document.createElement("div");
|
|
10237
10253
|
t.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
|
|
10238
10254
|
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" +
|
|
10255
|
+
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
10256
|
else throw Error("Failed to create audio tag");
|
|
10241
10257
|
}
|
|
10242
|
-
},
|
|
10258
|
+
}, zx, Bx = class {
|
|
10243
10259
|
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
|
|
10260
|
+
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
10261
|
let e = {
|
|
10246
10262
|
volume: this.volume,
|
|
10247
10263
|
isMuted: this.userMuted
|
|
@@ -10283,13 +10299,13 @@ var kx = /* @__PURE__ */ new WeakMap(), Ax = class {
|
|
|
10283
10299
|
e instanceof Error && this.emitter.emit("error", zn(!1, e));
|
|
10284
10300
|
}
|
|
10285
10301
|
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 =
|
|
10302
|
+
}), 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
10303
|
muted: a,
|
|
10288
10304
|
reInitWhenStuck: !0,
|
|
10289
10305
|
bufferTime: c
|
|
10290
10306
|
}), o !== void 0 && (this.audioPlayer.volume = o), this.audioPlayer.on("stuck", () => {
|
|
10291
10307
|
this.isDisconnected = !0;
|
|
10292
|
-
}), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer =
|
|
10308
|
+
}), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer = Px.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, void 0, s);
|
|
10293
10309
|
}
|
|
10294
10310
|
get volume() {
|
|
10295
10311
|
return this.audioPlayer.volume;
|
|
@@ -10348,29 +10364,29 @@ var kx = /* @__PURE__ */ new WeakMap(), Ax = class {
|
|
|
10348
10364
|
this._isPaused = !0, this.audioPlayer.pause(), this.emitter.emit("media element state", "paused");
|
|
10349
10365
|
}
|
|
10350
10366
|
};
|
|
10351
|
-
|
|
10367
|
+
zx = Bx, e(Bx, "create", (e, t, n, r, i, a, o, s) => new zx(e, t, n, r, i, a, o, s));
|
|
10352
10368
|
//#endregion
|
|
10353
10369
|
//#region ../../libs/web-sdk/src/modules/MediaSessionModule.ts
|
|
10354
|
-
var
|
|
10370
|
+
var Vx, Hx = [
|
|
10355
10371
|
"play",
|
|
10356
10372
|
"pause",
|
|
10357
10373
|
"stop"
|
|
10358
|
-
],
|
|
10374
|
+
], Ux, Wx = /* @__PURE__ */ new Set(), Gx = class t {
|
|
10359
10375
|
constructor(n, r, i) {
|
|
10360
10376
|
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,
|
|
10377
|
+
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
10378
|
}), e(this, "unload", () => {
|
|
10363
10379
|
var e;
|
|
10364
|
-
this.isLoaded && (this.isLoaded = !1,
|
|
10380
|
+
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
10381
|
}), e(this, "stop", () => {
|
|
10366
10382
|
var e;
|
|
10367
|
-
this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(),
|
|
10383
|
+
this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(), Ux === this && this.handOverOwnership("on stop");
|
|
10368
10384
|
}), e(this, "getStatistics", () => {
|
|
10369
10385
|
var e;
|
|
10370
10386
|
return {
|
|
10371
10387
|
mediaSessionSupported: t.isSupported(),
|
|
10372
|
-
mediaSessionOwner:
|
|
10373
|
-
mediaSessionPlaybackState:
|
|
10388
|
+
mediaSessionOwner: Ux === this,
|
|
10389
|
+
mediaSessionPlaybackState: Ux === this ? this.isPaused ? "paused" : "playing" : "none",
|
|
10374
10390
|
decoyState: (e = this.options.decoy) == null ? void 0 : e.getStatistics().decoyState
|
|
10375
10391
|
};
|
|
10376
10392
|
}), e(this, "onPlaybackState", (e) => {
|
|
@@ -10379,23 +10395,23 @@ var Fx, Ix = [
|
|
|
10379
10395
|
this.update();
|
|
10380
10396
|
}), e(this, "update", () => {
|
|
10381
10397
|
if (this.isLoaded) {
|
|
10382
|
-
if (this.isEligibleToOwn &&
|
|
10398
|
+
if (this.isEligibleToOwn && Ux !== this) {
|
|
10383
10399
|
this.claimOwnership();
|
|
10384
10400
|
return;
|
|
10385
10401
|
}
|
|
10386
10402
|
this.sync();
|
|
10387
10403
|
}
|
|
10388
10404
|
}), e(this, "handOverOwnership", (e) => {
|
|
10389
|
-
if (
|
|
10405
|
+
if (Ux === this) {
|
|
10390
10406
|
this.logger.debug(`Handing over the media session ${e}`), this.releaseOwnership();
|
|
10391
|
-
for (let e of
|
|
10407
|
+
for (let e of Wx) if (e !== this && e.isEligibleToOwn) {
|
|
10392
10408
|
e.claimOwnership();
|
|
10393
10409
|
return;
|
|
10394
10410
|
}
|
|
10395
10411
|
}
|
|
10396
10412
|
}), e(this, "sync", () => {
|
|
10397
10413
|
var e, t, n, r, i, a;
|
|
10398
|
-
if (
|
|
10414
|
+
if (Ux !== this) return;
|
|
10399
10415
|
if ((e = (t = this.options).isSuppressed) != null && e.call(t)) {
|
|
10400
10416
|
var o;
|
|
10401
10417
|
(o = this.options.decoy) == null || o.unload(), this.handOverOwnership("as suppressed");
|
|
@@ -10428,8 +10444,8 @@ var Fx, Ix = [
|
|
|
10428
10444
|
(f = this.options.decoy) == null || f.play();
|
|
10429
10445
|
}
|
|
10430
10446
|
}), e(this, "claimOwnership", () => {
|
|
10431
|
-
|
|
10432
|
-
for (let e of
|
|
10447
|
+
Ux == null || Ux.releaseOwnership(), Ux = this, this.pageMetadata = navigator.mediaSession.metadata, this.applyMetadata();
|
|
10448
|
+
for (let e of Hx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, this.onAction[e]));
|
|
10433
10449
|
this.safely("position state", () => {
|
|
10434
10450
|
var e, t;
|
|
10435
10451
|
return (e = (t = navigator.mediaSession).setPositionState) == null ? void 0 : e.call(t, {
|
|
@@ -10445,9 +10461,9 @@ var Fx, Ix = [
|
|
|
10445
10461
|
});
|
|
10446
10462
|
}), e(this, "releaseOwnership", () => {
|
|
10447
10463
|
var e;
|
|
10448
|
-
if (
|
|
10449
|
-
|
|
10450
|
-
for (let e of
|
|
10464
|
+
if (Ux === this) {
|
|
10465
|
+
Ux = void 0, (e = this.options.decoy) == null || e.pause();
|
|
10466
|
+
for (let e of Hx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, null));
|
|
10451
10467
|
this.options.metadata && this.safely("metadata restore", () => {
|
|
10452
10468
|
navigator.mediaSession.metadata = this.pageMetadata;
|
|
10453
10469
|
}), this.safely("release", () => {
|
|
@@ -10481,15 +10497,15 @@ var Fx, Ix = [
|
|
|
10481
10497
|
return this.playbackState !== void 0 && !this.isPaused && !this.options.isMuted() && ((e = (t = this.options).isSuppressed) == null ? void 0 : e.call(t)) !== !0;
|
|
10482
10498
|
}
|
|
10483
10499
|
};
|
|
10484
|
-
|
|
10500
|
+
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
10501
|
//#endregion
|
|
10486
10502
|
//#region ../../libs/web-sdk/src/modules/ModernCanvasModule.ts
|
|
10487
|
-
var
|
|
10503
|
+
var Kx, qx = class {
|
|
10488
10504
|
constructor(t, r, i, a, { muted: o, volume: s, type: c, poster: l, offscreenCanvas: u, bufferTime: d, backgroundPlaybackEnabled: f, splitAudio: p }) {
|
|
10489
10505
|
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
10506
|
let e = Ge().platform;
|
|
10491
10507
|
return e.isIOS && e.iosVersion <= 16;
|
|
10492
|
-
})()), e(this, "volumeState", void 0), e(this, "textTracks", new
|
|
10508
|
+
})()), e(this, "volumeState", void 0), e(this, "textTracks", new Ix()), e(this, "reset", () => {}), e(this, "load", () => {
|
|
10493
10509
|
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
10510
|
}), e(this, "unload", () => {
|
|
10495
10511
|
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 +10658,13 @@ var Bx, Vx = class {
|
|
|
10642
10658
|
}), this.soundElement.on("media element state", (e) => {
|
|
10643
10659
|
e === "paused" && this.audioPlayer.flushBuffer(), this.audioPlayer.sinkPaused = e === "paused", this.emitPlaybackState();
|
|
10644
10660
|
}), 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 =
|
|
10661
|
+
this.audioPlayer = Mx.create(this.logger.createContext("AudioPlayerModule"), a, {
|
|
10646
10662
|
muted: !1,
|
|
10647
10663
|
reInitWhenStuck: !1,
|
|
10648
10664
|
bufferTime: d
|
|
10649
10665
|
}), this.audioPlayer.on("state change", (e) => {
|
|
10650
10666
|
e === "suspended" || e === "interrupted" ? this.soundElement.muted = !0 : e === "running" && this.applyVisibilityMutePolicy(), this.updateVolumeState();
|
|
10651
|
-
}), this.videoPlayer =
|
|
10667
|
+
}), this.videoPlayer = Px.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, this.mediaElement.element, () => this.reconnectCanvasStream(), this.onVideoPlayerError);
|
|
10652
10668
|
}
|
|
10653
10669
|
get volume() {
|
|
10654
10670
|
return this.soundElement.volume;
|
|
@@ -10720,10 +10736,10 @@ var Bx, Vx = class {
|
|
|
10720
10736
|
return this.renderCanvasSubtitlesInNativeFullscreen && !this.offscreenCanvas;
|
|
10721
10737
|
}
|
|
10722
10738
|
};
|
|
10723
|
-
|
|
10739
|
+
Kx = qx, e(qx, "create", (e, t, n, r, i) => new Kx(e, t, n, r, i));
|
|
10724
10740
|
//#endregion
|
|
10725
10741
|
//#region ../../libs/web-sdk/src/modules/MseModule.ts
|
|
10726
|
-
var
|
|
10742
|
+
var Jx, Yx = class {
|
|
10727
10743
|
constructor() {
|
|
10728
10744
|
e(this, "initSegments", /* @__PURE__ */ new Map()), e(this, "set", (e, t, n) => {
|
|
10729
10745
|
var r;
|
|
@@ -10735,7 +10751,7 @@ var Hx, Ux = class {
|
|
|
10735
10751
|
});
|
|
10736
10752
|
}
|
|
10737
10753
|
};
|
|
10738
|
-
function
|
|
10754
|
+
function Xx(e, { mediaSource: t, mimeType: n, codec: r }) {
|
|
10739
10755
|
return x(x({}, e), {}, {
|
|
10740
10756
|
state: "initialized",
|
|
10741
10757
|
mimeType: n,
|
|
@@ -10747,10 +10763,10 @@ function Wx(e, { mediaSource: t, mimeType: n, codec: r }) {
|
|
|
10747
10763
|
lastBufferCleanupTime: performance.now()
|
|
10748
10764
|
});
|
|
10749
10765
|
}
|
|
10750
|
-
function
|
|
10766
|
+
function Zx({ initSegments: e, pendingSamples: t }) {
|
|
10751
10767
|
return {
|
|
10752
10768
|
state: "uninitialized",
|
|
10753
|
-
initSegments: e == null ? new
|
|
10769
|
+
initSegments: e == null ? new Yx() : e,
|
|
10754
10770
|
sequenceNumber: 0,
|
|
10755
10771
|
isWorkingOnPendingSamples: !1,
|
|
10756
10772
|
hasFirstSync: t.some((e) => e.isSync),
|
|
@@ -10760,7 +10776,7 @@ function Gx({ initSegments: e, pendingSamples: t }) {
|
|
|
10760
10776
|
successfulAppendCalls: 0
|
|
10761
10777
|
};
|
|
10762
10778
|
}
|
|
10763
|
-
var
|
|
10779
|
+
var Qx = class {
|
|
10764
10780
|
constructor(r, i, a) {
|
|
10765
10781
|
var o = this;
|
|
10766
10782
|
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 +10822,7 @@ var Kx = class {
|
|
|
10806
10822
|
var n, r, i;
|
|
10807
10823
|
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
10824
|
for (; c < o.length && !((i = o[c]) != null && i.isSync);) c++;
|
|
10809
|
-
let l =
|
|
10825
|
+
let l = Zx({
|
|
10810
10826
|
pendingSamples: o,
|
|
10811
10827
|
initSegments: s
|
|
10812
10828
|
});
|
|
@@ -10817,14 +10833,14 @@ var Kx = class {
|
|
|
10817
10833
|
this.trackContexts.forEach((e, n) => {
|
|
10818
10834
|
if (t.has(n)) return;
|
|
10819
10835
|
e.state === "initialized" && this.mediaSource.isOpen() && this.mediaSource.removeSourceBuffer(e.sourceBuffer);
|
|
10820
|
-
let r =
|
|
10836
|
+
let r = Zx({
|
|
10821
10837
|
pendingSamples: [],
|
|
10822
10838
|
initSegments: e.initSegments
|
|
10823
10839
|
});
|
|
10824
10840
|
this.trackContexts.set(n, r);
|
|
10825
10841
|
});
|
|
10826
10842
|
}), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "initializeSourceBuffer", (e, t) => {
|
|
10827
|
-
let n =
|
|
10843
|
+
let n = Xx(e, {
|
|
10828
10844
|
mimeType: t.mimeType,
|
|
10829
10845
|
mediaSource: this.mediaSource,
|
|
10830
10846
|
codec: t.codec
|
|
@@ -10851,9 +10867,9 @@ var Kx = class {
|
|
|
10851
10867
|
}
|
|
10852
10868
|
for (let t of e) {
|
|
10853
10869
|
let n = o.trackContexts.get(t.type);
|
|
10854
|
-
if (n || (n =
|
|
10870
|
+
if (n || (n = Zx({
|
|
10855
10871
|
pendingSamples: [],
|
|
10856
|
-
initSegments: new
|
|
10872
|
+
initSegments: new Yx()
|
|
10857
10873
|
}), o.trackContexts.set(t.type, n)), n.state === "initialized") {
|
|
10858
10874
|
if (t.mimeType !== n.sourceBufferMimeType) try {
|
|
10859
10875
|
yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
|
|
@@ -10870,7 +10886,7 @@ var Kx = class {
|
|
|
10870
10886
|
o.logger.warn("removeSourceBuffer failed", { removeError: t }), o.reopenMediaSource("changeType recovery failed"), o.pendingTracksToAddSourceBuffers = e;
|
|
10871
10887
|
return;
|
|
10872
10888
|
}
|
|
10873
|
-
let i =
|
|
10889
|
+
let i = Zx({
|
|
10874
10890
|
pendingSamples: n.pendingSamples,
|
|
10875
10891
|
initSegments: n.initSegments
|
|
10876
10892
|
});
|
|
@@ -10894,7 +10910,7 @@ var Kx = class {
|
|
|
10894
10910
|
};
|
|
10895
10911
|
}), e(this, "getNextBufferedRangeStart", (e) => {
|
|
10896
10912
|
let t = this.getCommonBufferedRangesForCurrentTracks();
|
|
10897
|
-
if (t) return
|
|
10913
|
+
if (t) return $x(e, t);
|
|
10898
10914
|
}), e(this, "getBufferedEndAt", (e) => {
|
|
10899
10915
|
var t;
|
|
10900
10916
|
let n = this.getCommonBufferedRangesForCurrentTracks();
|
|
@@ -10944,9 +10960,9 @@ var Kx = class {
|
|
|
10944
10960
|
s > 0 && performance.now() - r.lastBufferCleanupTime > 1e4 && (r.lastBufferCleanupTime = performance.now(), yield r.sourceBuffer.removeBuffer(0, s + 10));
|
|
10945
10961
|
try {
|
|
10946
10962
|
let t = r.sequenceNumber;
|
|
10947
|
-
if ("fragmented" in n) for (let t of
|
|
10963
|
+
if ("fragmented" in n) for (let t of iS(e)) {
|
|
10948
10964
|
var c;
|
|
10949
|
-
yield r.sourceBuffer.appendBuffer(
|
|
10965
|
+
yield r.sourceBuffer.appendBuffer(aS(t.map((e) => e.data)), (c = t[0]) == null ? void 0 : c.initData);
|
|
10950
10966
|
}
|
|
10951
10967
|
else {
|
|
10952
10968
|
let n = Ps(e, t++);
|
|
@@ -10994,7 +11010,7 @@ var Kx = class {
|
|
|
10994
11010
|
let t = this.trackContexts.get(e.type);
|
|
10995
11011
|
if (!t) throw Hn(e.type, e.renditionId);
|
|
10996
11012
|
let n = t.pendingSamples.length - t.pendingSamplesOffset;
|
|
10997
|
-
if (t.state === "uninitialized" && n >=
|
|
11013
|
+
if (t.state === "uninitialized" && n >= tS && (e.isSync || n >= 2 * tS) && (t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1), !(!t.hasFirstSync && !e.isSync)) {
|
|
10998
11014
|
if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
|
|
10999
11015
|
this.hasAddedInitialPosterFrame = !1;
|
|
11000
11016
|
let n = x({}, e);
|
|
@@ -11005,7 +11021,7 @@ var Kx = class {
|
|
|
11005
11021
|
let t = (e.timestamp + ((r = e.compositionTimeOffset) == null ? 0 : r)) / e.timescale * 1e3, n = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
|
|
11006
11022
|
n !== void 0 && t < n && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(t), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
|
|
11007
11023
|
}
|
|
11008
|
-
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples ||
|
|
11024
|
+
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || sS(t, this.append, this.maxChunkSize).catch((n) => {
|
|
11009
11025
|
if (t.isWorkingOnPendingSamples = !1, !this.isReopening) {
|
|
11010
11026
|
if (!this.isCurrentTrackContext(e.type, t)) {
|
|
11011
11027
|
this.logger.debug("Suppressing append error from stale track context", { type: e.type });
|
|
@@ -11124,14 +11140,14 @@ var Kx = class {
|
|
|
11124
11140
|
if (this.mediaSource.isClosed()) return;
|
|
11125
11141
|
let e = this.getInitializedTrackBuffers();
|
|
11126
11142
|
if (e.length !== 0) return this.getCommonBufferedRanges(e);
|
|
11127
|
-
}), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) =>
|
|
11143
|
+
}), 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
11144
|
}
|
|
11129
11145
|
};
|
|
11130
|
-
|
|
11131
|
-
let r = new
|
|
11146
|
+
Jx = Qx, e(Qx, "create", (e, t, n) => {
|
|
11147
|
+
let r = new Jx(e, t, n);
|
|
11132
11148
|
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
11149
|
});
|
|
11134
|
-
var
|
|
11150
|
+
var $x = (e, t) => {
|
|
11135
11151
|
for (let r = 0; r < t.length; r++) {
|
|
11136
11152
|
let i = t[r];
|
|
11137
11153
|
if (i) {
|
|
@@ -11142,11 +11158,11 @@ var qx = (e, t) => {
|
|
|
11142
11158
|
}
|
|
11143
11159
|
}
|
|
11144
11160
|
}
|
|
11145
|
-
},
|
|
11161
|
+
}, eS = (e, t) => {
|
|
11146
11162
|
var n;
|
|
11147
11163
|
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
11164
|
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
|
-
},
|
|
11165
|
+
}, tS = 1e3, nS = 32, rS = (e, t) => {
|
|
11150
11166
|
let n = [], r = 0, i = 0;
|
|
11151
11167
|
for (; r < e.length && i < t.length;) {
|
|
11152
11168
|
let a = e[r], o = t[i];
|
|
@@ -11158,7 +11174,7 @@ var qx = (e, t) => {
|
|
|
11158
11174
|
}), a.end <= o.end ? r++ : i++;
|
|
11159
11175
|
}
|
|
11160
11176
|
return n;
|
|
11161
|
-
},
|
|
11177
|
+
}, iS = (e) => {
|
|
11162
11178
|
let t = [];
|
|
11163
11179
|
for (let r of e) {
|
|
11164
11180
|
var n;
|
|
@@ -11167,21 +11183,21 @@ var qx = (e, t) => {
|
|
|
11167
11183
|
(e == null || (n = e[0]) == null ? void 0 : n.initData) === r.initData ? e.push(r) : t.push([r]);
|
|
11168
11184
|
}
|
|
11169
11185
|
return t;
|
|
11170
|
-
},
|
|
11186
|
+
}, aS = (e) => {
|
|
11171
11187
|
if (e.length === 1 && e[0]) return e[0];
|
|
11172
11188
|
let t = new Uint8Array(e.reduce((e, t) => e + t.byteLength, 0)), n = 0;
|
|
11173
11189
|
for (let r of e) t.set(r, n), n += r.byteLength;
|
|
11174
11190
|
return t;
|
|
11175
|
-
},
|
|
11191
|
+
}, oS = (e) => {
|
|
11176
11192
|
let t = e.pendingSamplesOffset;
|
|
11177
11193
|
if (t !== 0) {
|
|
11178
11194
|
if (t >= e.pendingSamples.length) {
|
|
11179
11195
|
e.pendingSamples = [], e.pendingSamplesOffset = 0;
|
|
11180
11196
|
return;
|
|
11181
11197
|
}
|
|
11182
|
-
t <
|
|
11198
|
+
t < nS || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0);
|
|
11183
11199
|
}
|
|
11184
|
-
},
|
|
11200
|
+
}, sS = function() {
|
|
11185
11201
|
var e = t(function* (e, t, n) {
|
|
11186
11202
|
for (e.isWorkingOnPendingSamples = !0; e.pendingSamplesOffset < e.pendingSamples.length;) {
|
|
11187
11203
|
let r = [], i = e.pendingSamplesOffset;
|
|
@@ -11189,7 +11205,7 @@ var qx = (e, t) => {
|
|
|
11189
11205
|
i = t;
|
|
11190
11206
|
let a = e.pendingSamples[t], o = e.pendingSamples[t + 1];
|
|
11191
11207
|
if (a && (r.push(a), o)) {
|
|
11192
|
-
if (
|
|
11208
|
+
if (eS(a, o)) break;
|
|
11193
11209
|
let e = (a.timestamp + a.duration) / a.timescale;
|
|
11194
11210
|
if (o.timestamp / o.timescale - e > .1) break;
|
|
11195
11211
|
}
|
|
@@ -11197,14 +11213,14 @@ var qx = (e, t) => {
|
|
|
11197
11213
|
}
|
|
11198
11214
|
let a = r[0];
|
|
11199
11215
|
if (!a) break;
|
|
11200
|
-
yield t(r, e.previousSample ?
|
|
11216
|
+
yield t(r, e.previousSample ? eS(e.previousSample, a) : !0), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], oS(e);
|
|
11201
11217
|
}
|
|
11202
11218
|
e.isWorkingOnPendingSamples = !1;
|
|
11203
11219
|
});
|
|
11204
11220
|
return function(t, n, r) {
|
|
11205
11221
|
return e.apply(this, arguments);
|
|
11206
11222
|
};
|
|
11207
|
-
}(),
|
|
11223
|
+
}(), cS, lS = class {
|
|
11208
11224
|
constructor(n, r) {
|
|
11209
11225
|
var i = this;
|
|
11210
11226
|
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 +11252,10 @@ var qx = (e, t) => {
|
|
|
11236
11252
|
}()), 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
11253
|
}
|
|
11238
11254
|
};
|
|
11239
|
-
|
|
11255
|
+
cS = lS, e(lS, "create", (e, t) => new cS(e, t));
|
|
11240
11256
|
//#endregion
|
|
11241
11257
|
//#region ../../libs/web-sdk/src/modules/PlaybackModule.ts
|
|
11242
|
-
var
|
|
11258
|
+
var uS, dS = class {
|
|
11243
11259
|
constructor(t, n, r, i) {
|
|
11244
11260
|
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
11261
|
this.emitter.off("buffer state", this.onBufferedStateChanged), this.emitter.off("needs user input", this.onNeedsUserInput);
|
|
@@ -11257,24 +11273,24 @@ var iS, aS = class {
|
|
|
11257
11273
|
}), 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
11274
|
}
|
|
11259
11275
|
};
|
|
11260
|
-
|
|
11276
|
+
uS = dS, e(dS, "create", (e, t, n, r) => new uS(e, t, n, r));
|
|
11261
11277
|
//#endregion
|
|
11262
11278
|
//#region ../../libs/web-sdk/src/modules/QualityOfServiceModule.ts
|
|
11263
|
-
var
|
|
11279
|
+
var fS, pS = () => ({
|
|
11264
11280
|
upgradesFromLevel: [],
|
|
11265
11281
|
downgradesFromLevel: [],
|
|
11266
11282
|
bufferingRanges: [],
|
|
11267
11283
|
activeRanges: [],
|
|
11268
11284
|
decodeRate: 2 ** 53 - 1
|
|
11269
|
-
}),
|
|
11285
|
+
}), mS = () => ({
|
|
11270
11286
|
levels: {},
|
|
11271
11287
|
levelDowngrades: [],
|
|
11272
11288
|
levelUpgrades: [],
|
|
11273
11289
|
bufferFullness: 0,
|
|
11274
|
-
general:
|
|
11275
|
-
}),
|
|
11290
|
+
general: pS()
|
|
11291
|
+
}), hS = 100, gS = 3600, _S = 1e3, vS = class {
|
|
11276
11292
|
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",
|
|
11293
|
+
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
11294
|
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
11295
|
}), e(this, "unload", () => {
|
|
11280
11296
|
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 +11308,7 @@ var oS, sS = () => ({
|
|
|
11292
11308
|
return this.metrics.levels[a];
|
|
11293
11309
|
}), e(this, "getBufferFullnessRegression", (e = !1) => {
|
|
11294
11310
|
if (!e) return this.bufferFullnessRegression;
|
|
11295
|
-
if (performance.now() - this.lastDeliveryResumeTime <
|
|
11311
|
+
if (performance.now() - this.lastDeliveryResumeTime < _S) return;
|
|
11296
11312
|
let t = this.bufferFullness.items().filter(({ time: e }) => e >= this.lastDeliveryResumeTime);
|
|
11297
11313
|
return t.length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression(t) : void 0;
|
|
11298
11314
|
}), e(this, "getTargetBufferTime", () => {
|
|
@@ -11352,21 +11368,21 @@ var oS, sS = () => ({
|
|
|
11352
11368
|
let d = !1;
|
|
11353
11369
|
if (e.from) {
|
|
11354
11370
|
var f;
|
|
11355
|
-
let e = (f = this.metrics.levels[l]) == null ?
|
|
11371
|
+
let e = (f = this.metrics.levels[l]) == null ? pS() : f;
|
|
11356
11372
|
l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), Zt(e.activeRanges);
|
|
11357
11373
|
let t = e.bufferingRanges[e.bufferingRanges.length - 1];
|
|
11358
11374
|
d = !!t && !t.end, Zt(e.bufferingRanges), this.metrics.levels[l] = e;
|
|
11359
11375
|
}
|
|
11360
11376
|
if (e.to) {
|
|
11361
11377
|
var p;
|
|
11362
|
-
let e = (p = this.metrics.levels[u]) == null ?
|
|
11378
|
+
let e = (p = this.metrics.levels[u]) == null ? pS() : p;
|
|
11363
11379
|
Qt(e.activeRanges), d && Qt(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
|
|
11364
11380
|
}
|
|
11365
11381
|
}), e(this, "onMediaDeliveryResumed", () => {
|
|
11366
11382
|
this.lastDeliveryResumeTime = performance.now();
|
|
11367
11383
|
}), e(this, "onBufferFullness", (e) => {
|
|
11368
11384
|
if (this.metrics.bufferFullness = e, this.isSuspended) return;
|
|
11369
|
-
let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e /
|
|
11385
|
+
let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e / hS);
|
|
11370
11386
|
if (n && r(n.time) === r(t)) n.time = t, n.value = e;
|
|
11371
11387
|
else {
|
|
11372
11388
|
var i, a;
|
|
@@ -11374,7 +11390,7 @@ var oS, sS = () => ({
|
|
|
11374
11390
|
time: t,
|
|
11375
11391
|
value: e
|
|
11376
11392
|
});
|
|
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 -
|
|
11393
|
+
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
11394
|
this.bufferFullness.filterPop(({ time: e }) => e >= o);
|
|
11379
11395
|
}
|
|
11380
11396
|
this.bufferFullnessRegression = this.bufferFullness.items().length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression() : void 0;
|
|
@@ -11446,10 +11462,10 @@ var oS, sS = () => ({
|
|
|
11446
11462
|
Qt(this.metrics.general.activeRanges);
|
|
11447
11463
|
}
|
|
11448
11464
|
};
|
|
11449
|
-
|
|
11465
|
+
fS = vS, e(vS, "create", (e, t, n, r) => new fS(e, t, n, r));
|
|
11450
11466
|
//#endregion
|
|
11451
11467
|
//#region ../../libs/web-sdk/src/modules/RenditionsModule.ts
|
|
11452
|
-
var
|
|
11468
|
+
var yS, bS = class {
|
|
11453
11469
|
constructor(t, n) {
|
|
11454
11470
|
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
11471
|
this.emitter.off("renditions", this.onRenditions), this.emitter.off("subscription changed", this.onSubscriptionChanged);
|
|
@@ -11524,10 +11540,10 @@ var pS, mS = class {
|
|
|
11524
11540
|
}), 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
11541
|
}
|
|
11526
11542
|
};
|
|
11527
|
-
|
|
11543
|
+
yS = bS, e(bS, "create", (e, t) => new yS(e, t));
|
|
11528
11544
|
//#endregion
|
|
11529
11545
|
//#region ../../libs/web-sdk/src/BFrameTracker.ts
|
|
11530
|
-
var
|
|
11546
|
+
var xS = class t {
|
|
11531
11547
|
constructor() {
|
|
11532
11548
|
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
11549
|
}
|
|
@@ -11563,7 +11579,7 @@ var hS = class t {
|
|
|
11563
11579
|
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
11580
|
}
|
|
11565
11581
|
remember(e) {
|
|
11566
|
-
this.channelId !== void 0 && this.rememberedRenditions.set(
|
|
11582
|
+
this.channelId !== void 0 && this.rememberedRenditions.set(ix(this.channelId, this.renditionId), e);
|
|
11567
11583
|
}
|
|
11568
11584
|
latchBFrames() {
|
|
11569
11585
|
this.hasBFramesValue = !0, this.hasObservedReordering = !0, this.isAwaitingAssessment = !1, this.remember(!0);
|
|
@@ -11575,18 +11591,18 @@ var hS = class t {
|
|
|
11575
11591
|
this.hasSeenKeyframe && !this.hasObservedReordering && (this.remember(!1), this.hasBFramesValue = !1), this.hasSeenKeyframe = !0, this.omittedBoundaryCrossings = 0;
|
|
11576
11592
|
}
|
|
11577
11593
|
resetOnSwitch(e, t) {
|
|
11578
|
-
if (
|
|
11594
|
+
if (!ax(e, t, this.channelId, this.renditionId)) {
|
|
11579
11595
|
let n = this.channelId !== void 0;
|
|
11580
11596
|
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(
|
|
11597
|
+
let r = this.rememberedRenditions.get(ix(e, t));
|
|
11582
11598
|
this.hasBFramesValue = r == null ? !1 : r, n && (this.isAwaitingAssessment = r === void 0);
|
|
11583
11599
|
}
|
|
11584
11600
|
}
|
|
11585
11601
|
};
|
|
11586
|
-
e(
|
|
11602
|
+
e(xS, "MAX_REMEMBERED_RENDITIONS", 32);
|
|
11587
11603
|
//#endregion
|
|
11588
11604
|
//#region ../../libs/web-sdk/src/modules/SyncModule.ts
|
|
11589
|
-
var
|
|
11605
|
+
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
11606
|
seek: {
|
|
11591
11607
|
toleranceMs: 200,
|
|
11592
11608
|
toleranceMaxMs: 2500,
|
|
@@ -11618,7 +11634,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11618
11634
|
decayCooldownMultiplier: 3,
|
|
11619
11635
|
decayCheckInterval: 15e3
|
|
11620
11636
|
}
|
|
11621
|
-
},
|
|
11637
|
+
}, IS = class {
|
|
11622
11638
|
get driftSamplesToCollect() {
|
|
11623
11639
|
return this._driftSamplesToCollect;
|
|
11624
11640
|
}
|
|
@@ -11626,8 +11642,8 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11626
11642
|
this._driftSamplesToCollect = e, this.driftSamples = new r(e);
|
|
11627
11643
|
}
|
|
11628
11644
|
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" ?
|
|
11645
|
+
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", () => {
|
|
11646
|
+
this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? AS : kS);
|
|
11631
11647
|
}), e(this, "unload", () => {
|
|
11632
11648
|
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
11649
|
}), e(this, "suspend", () => {
|
|
@@ -11669,7 +11685,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11669
11685
|
}), e(this, "processSample", (e) => {
|
|
11670
11686
|
var t;
|
|
11671
11687
|
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 -
|
|
11688
|
+
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - CS);
|
|
11673
11689
|
let n = e.type === "video" && e.isSync;
|
|
11674
11690
|
if (this.bFrameDetector.update(e), this.latchBFramesIfDetected(), this.currentChannelId !== e.channelId) {
|
|
11675
11691
|
let t = 2 ** 53 - 1;
|
|
@@ -11686,7 +11702,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11686
11702
|
this.currentChannelId || (this.currentChannelId = e);
|
|
11687
11703
|
let i = t.mediaType();
|
|
11688
11704
|
if (!i) throw Error("Fragment must have a media type");
|
|
11689
|
-
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 -
|
|
11705
|
+
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - CS);
|
|
11690
11706
|
let a = i === "video" && t.startsWithKeyframe();
|
|
11691
11707
|
if (i === "video" && (this.bFrameDetector.updateFromFragment({
|
|
11692
11708
|
type: i,
|
|
@@ -11811,7 +11827,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11811
11827
|
this.timeshiftDeferralStartedAt = void 0;
|
|
11812
11828
|
return;
|
|
11813
11829
|
}
|
|
11814
|
-
let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(
|
|
11830
|
+
let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(OS(i)).length;
|
|
11815
11831
|
if (a && this.state.timeshiftToleranceMultiplier > 2) {
|
|
11816
11832
|
this.logger.debug("Too many timeshifts within sliding window", {
|
|
11817
11833
|
timeshiftCooldownThreshold: i,
|
|
@@ -11822,12 +11838,12 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11822
11838
|
if (e) {
|
|
11823
11839
|
var o, s;
|
|
11824
11840
|
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() *
|
|
11841
|
+
if (n - r < this.bufferSource.getTargetBufferTime() * wS) {
|
|
11826
11842
|
let e = performance.now();
|
|
11827
11843
|
if (this.timeshiftDeferralStartedAt === void 0 && (this.timeshiftDeferralStartedAt = e, this.logger.debug("Deferring timeshift while buffered ahead is thin", {
|
|
11828
11844
|
drift: r,
|
|
11829
11845
|
bufferedAhead: n
|
|
11830
|
-
})), e - this.timeshiftDeferralStartedAt <
|
|
11846
|
+
})), e - this.timeshiftDeferralStartedAt < TS) return;
|
|
11831
11847
|
}
|
|
11832
11848
|
this.timeshiftDeferralStartedAt !== void 0 && this.logger.debug("Releasing timeshift deferral", { deferredMs: performance.now() - this.timeshiftDeferralStartedAt });
|
|
11833
11849
|
}
|
|
@@ -11847,20 +11863,20 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11847
11863
|
let n = (e = (t = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : e.call(t, this.playbackSource.currentTime);
|
|
11848
11864
|
return this.shouldSeekAfterBuffering = n !== void 0, n;
|
|
11849
11865
|
}), e(this, "observePlayheadProgress", () => {
|
|
11850
|
-
let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek >
|
|
11866
|
+
let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > PS);
|
|
11851
11867
|
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
11868
|
}), e(this, "isPlayheadStuckInBuffer", () => {
|
|
11853
11869
|
var e, t;
|
|
11854
|
-
if (performance.now() - this.lastPlayheadProgressAt <
|
|
11870
|
+
if (performance.now() - this.lastPlayheadProgressAt < jS) return !1;
|
|
11855
11871
|
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 >=
|
|
11872
|
+
return r !== void 0 && r - n >= MS;
|
|
11857
11873
|
}), e(this, "getRecoverySeekReason", () => {
|
|
11858
11874
|
if (this.needsMediaSourceRecovery) return "media source reopen";
|
|
11859
11875
|
if (this.shouldSeekWhileStuck) return "stuck in buffer";
|
|
11860
11876
|
if (this.shouldSeekAfterBuffering) return "buffering";
|
|
11861
11877
|
}), 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
11878
|
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,
|
|
11879
|
+
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
11880
|
if (r === void 0 || i >= r) return;
|
|
11865
11881
|
let a = this.findKeyframeCloseToTimestamp(i);
|
|
11866
11882
|
return {
|
|
@@ -11941,7 +11957,7 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11941
11957
|
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
11958
|
let i = r ? t : vt(this.driftSamples.items());
|
|
11943
11959
|
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(
|
|
11960
|
+
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
11961
|
if (o && this.state.seekToleranceMultiplier > 2 && !r && !c) {
|
|
11946
11962
|
this.logger.debug("Too many seek adjustments within sliding window", {
|
|
11947
11963
|
seekCooldownThreshold: a,
|
|
@@ -11970,9 +11986,9 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11970
11986
|
return;
|
|
11971
11987
|
}
|
|
11972
11988
|
}), e(this, "onPageActive", (e) => {
|
|
11973
|
-
this.setSyncInterval(e ?
|
|
11989
|
+
this.setSyncInterval(e ? kS : AS), e && this.onSync();
|
|
11974
11990
|
}), e(this, "onPageShow", (e) => {
|
|
11975
|
-
e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ?
|
|
11991
|
+
e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? AS : kS), this.onSync());
|
|
11976
11992
|
}), e(this, "setSyncInterval", (e) => {
|
|
11977
11993
|
this.syncInterval !== void 0 && this.currentSyncIntervalMs === e || (this.clearSyncInterval(), this.currentSyncIntervalMs = e, this.syncInterval = this.timers.setInterval(this.onSync, e));
|
|
11978
11994
|
}), e(this, "clearSyncInterval", () => {
|
|
@@ -11983,11 +11999,11 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
11983
11999
|
let t = n >= e - this.config.seek.keyframeSearchBeforeMs, r = n <= e + this.config.seek.keyframeSearchAfterMs;
|
|
11984
12000
|
if (t && r) return n;
|
|
11985
12001
|
}
|
|
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({},
|
|
12002
|
+
}), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot = DS(s), this.config = {
|
|
12003
|
+
seek: x({}, FS.seek),
|
|
12004
|
+
timeshift: x({}, FS.timeshift),
|
|
12005
|
+
playbackRate: x({}, FS.playbackRate),
|
|
12006
|
+
backoff: x({}, FS.backoff)
|
|
11991
12007
|
}, this.config.timeshift.enabled = o, s || (this.config.seek.toleranceMs = 50, this.config.timeshift.toleranceMs = 20, this.config.seek.aheadToleranceMs = 40), this.state = {
|
|
11992
12008
|
seekToleranceMultiplier: 1,
|
|
11993
12009
|
timeshiftToleranceMultiplier: 1
|
|
@@ -12049,10 +12065,10 @@ var gS, _S = 5e3, vS = .5, yS = 3e3, bS = () => Ne() || Ae(), xS = (e) => e && b
|
|
|
12049
12065
|
return this.serverCurrentTime - this.playbackSource.currentTime;
|
|
12050
12066
|
}
|
|
12051
12067
|
};
|
|
12052
|
-
|
|
12068
|
+
SS = IS, e(IS, "create", (e, t, n, r, i, a = !0) => new SS(e, t, n, r, i, a));
|
|
12053
12069
|
//#endregion
|
|
12054
12070
|
//#region ../../libs/web-sdk/src/modules/TelemetryModule.ts
|
|
12055
|
-
var
|
|
12071
|
+
var LS, RS = {
|
|
12056
12072
|
enabled: !0,
|
|
12057
12073
|
interval: 3e4,
|
|
12058
12074
|
includeErrors: !0,
|
|
@@ -12061,11 +12077,11 @@ var jS, MS = {
|
|
|
12061
12077
|
maxRetries: 10,
|
|
12062
12078
|
maxErrorReports: 50,
|
|
12063
12079
|
maxEvents: 50
|
|
12064
|
-
},
|
|
12080
|
+
}, zS = (e, t) => x(x({}, t), {}, {
|
|
12065
12081
|
type: e,
|
|
12066
12082
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12067
12083
|
discriminator: "web"
|
|
12068
|
-
}),
|
|
12084
|
+
}), BS = class {
|
|
12069
12085
|
constructor(n, i, a, o) {
|
|
12070
12086
|
var s = this;
|
|
12071
12087
|
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 +12098,7 @@ var jS, MS = {
|
|
|
12082
12098
|
initiator: "interval"
|
|
12083
12099
|
}, n = {}) => {
|
|
12084
12100
|
if (!this.options.includeStats) return;
|
|
12085
|
-
let r = this.parentContext.getStatistics(), i =
|
|
12101
|
+
let r = this.parentContext.getStatistics(), i = zS("stats", x(x(x({}, n), r), {}, {
|
|
12086
12102
|
isFinal: e,
|
|
12087
12103
|
initiator: t,
|
|
12088
12104
|
count: this.statsCount++
|
|
@@ -12090,7 +12106,7 @@ var jS, MS = {
|
|
|
12090
12106
|
this.unsentLines.push(i);
|
|
12091
12107
|
}), e(this, "addEvent", (e) => {
|
|
12092
12108
|
if (!this.options.includeEvents || this.eventCount > this.options.maxEvents) return;
|
|
12093
|
-
let t =
|
|
12109
|
+
let t = zS("event", x(x({}, this.parentContext.getStatistics()), e));
|
|
12094
12110
|
this.eventCount++, this.unsentLines.push(t);
|
|
12095
12111
|
}), e(this, "getStatistics", () => ({ errorCount: this.errorCount })), e(this, "send", function() {
|
|
12096
12112
|
var e = t(function* (e) {
|
|
@@ -12135,14 +12151,14 @@ var jS, MS = {
|
|
|
12135
12151
|
let { includeErrors: t, maxErrorReports: n } = this.options;
|
|
12136
12152
|
if (!(e instanceof A) || e.code() === "channel_not_live" || !t || (this.errorCount++, this.errorCount > n)) return;
|
|
12137
12153
|
let r = this.parentContext.getStatistics();
|
|
12138
|
-
this.unsentLines.push(
|
|
12139
|
-
}), this.logger = n, this.emitter = i, this.options = x(x({},
|
|
12154
|
+
this.unsentLines.push(zS("error", x(x({}, r), e.toStringifiable())));
|
|
12155
|
+
}), this.logger = n, this.emitter = i, this.options = x(x({}, RS), a), this.parentContext = o;
|
|
12140
12156
|
}
|
|
12141
12157
|
};
|
|
12142
|
-
|
|
12158
|
+
LS = BS, e(BS, "create", (e, t, n, r) => new LS(e, t, n, r));
|
|
12143
12159
|
//#endregion
|
|
12144
12160
|
//#region ../../libs/web-sdk/src/modules/UnpauseModule.ts
|
|
12145
|
-
var
|
|
12161
|
+
var VS, HS = class {
|
|
12146
12162
|
constructor(t, n, r) {
|
|
12147
12163
|
e(this, "logger", void 0), e(this, "elements", void 0), e(this, "documentState", void 0), e(this, "timers", new k()), e(this, "unload", () => {
|
|
12148
12164
|
this.timers.unload();
|
|
@@ -12151,10 +12167,10 @@ var FS, IS = class {
|
|
|
12151
12167
|
}), this.logger = t, this.elements = n, this.documentState = r, this.timers.setInterval(this.unpause, 100);
|
|
12152
12168
|
}
|
|
12153
12169
|
};
|
|
12154
|
-
|
|
12170
|
+
VS = HS, e(HS, "create", (e, t, n) => new VS(e, t, n));
|
|
12155
12171
|
//#endregion
|
|
12156
12172
|
//#region ../../libs/web-sdk/src/OptionsProvider.ts
|
|
12157
|
-
var
|
|
12173
|
+
var US = [
|
|
12158
12174
|
"minBufferTime",
|
|
12159
12175
|
"maxBufferTime",
|
|
12160
12176
|
"burstEnabled",
|
|
@@ -12163,10 +12179,10 @@ var LS = [
|
|
|
12163
12179
|
"offscreenCanvasEnabled",
|
|
12164
12180
|
"videoCodecs"
|
|
12165
12181
|
];
|
|
12166
|
-
function
|
|
12167
|
-
return
|
|
12182
|
+
function WS(e) {
|
|
12183
|
+
return US.includes(e);
|
|
12168
12184
|
}
|
|
12169
|
-
var
|
|
12185
|
+
var GS = class {
|
|
12170
12186
|
constructor(t) {
|
|
12171
12187
|
e(this, "options", void 0), e(this, "overrides", /* @__PURE__ */ new Map()), this.options = t;
|
|
12172
12188
|
}
|
|
@@ -12180,7 +12196,7 @@ var zS = class {
|
|
|
12180
12196
|
this.options[e] = t;
|
|
12181
12197
|
}
|
|
12182
12198
|
get(e, t) {
|
|
12183
|
-
if (t &&
|
|
12199
|
+
if (t && WS(e)) {
|
|
12184
12200
|
var n;
|
|
12185
12201
|
let r = (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
12186
12202
|
if (r !== void 0) return r;
|
|
@@ -12191,7 +12207,7 @@ var zS = class {
|
|
|
12191
12207
|
var n;
|
|
12192
12208
|
return (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
12193
12209
|
}
|
|
12194
|
-
},
|
|
12210
|
+
}, KS = 6, qS = (e) => {
|
|
12195
12211
|
let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
|
|
12196
12212
|
var i, a;
|
|
12197
12213
|
if (e.flags && Is(e.flags)) {
|
|
@@ -12203,7 +12219,7 @@ var zS = class {
|
|
|
12203
12219
|
return u > 0 && (r = u), x(x({}, e), {}, { duration: u > 0 ? u : r });
|
|
12204
12220
|
};
|
|
12205
12221
|
return (e, n = !1) => {
|
|
12206
|
-
if (e.flags && Is(e.flags) && n && (i = !i), !(n && t.length <
|
|
12222
|
+
if (e.flags && Is(e.flags) && n && (i = !i), !(n && t.length < KS && i) && t.length > 0) {
|
|
12207
12223
|
i = !1;
|
|
12208
12224
|
let n = e;
|
|
12209
12225
|
for (let e = t.length - 1; e > 0; e--) {
|
|
@@ -12216,13 +12232,13 @@ var zS = class {
|
|
|
12216
12232
|
}
|
|
12217
12233
|
return t.push(e), [];
|
|
12218
12234
|
};
|
|
12219
|
-
},
|
|
12235
|
+
}, JS = ["mse", "wasm"], YS = (e) => e == null ? JS : e, XS = (e) => {
|
|
12220
12236
|
if (!e) return !1;
|
|
12221
12237
|
let t = e.headers && Object.keys(e.headers).length > 0, n = e.queryParams && Object.keys(e.queryParams).length > 0;
|
|
12222
12238
|
return !!(t || n);
|
|
12223
|
-
},
|
|
12224
|
-
if (
|
|
12225
|
-
let r =
|
|
12239
|
+
}, ZS = (e, t, n) => {
|
|
12240
|
+
if (XS(n)) return "mse";
|
|
12241
|
+
let r = YS(e);
|
|
12226
12242
|
for (let e of r) switch (e) {
|
|
12227
12243
|
case "mse":
|
|
12228
12244
|
if (t) return "mse";
|
|
@@ -12233,7 +12249,7 @@ var zS = class {
|
|
|
12233
12249
|
case "wasm": return "wasm";
|
|
12234
12250
|
}
|
|
12235
12251
|
return "wasm";
|
|
12236
|
-
},
|
|
12252
|
+
}, QS = (e, t, n) => {
|
|
12237
12253
|
if (un(t)) return x(x({}, e), {}, {
|
|
12238
12254
|
type: "video",
|
|
12239
12255
|
codec: t.codec,
|
|
@@ -12254,12 +12270,12 @@ var zS = class {
|
|
|
12254
12270
|
data: e.payload,
|
|
12255
12271
|
duration: 0
|
|
12256
12272
|
});
|
|
12257
|
-
},
|
|
12273
|
+
}, $S = ({ average: e, last: t, max: n, min: r }) => ({
|
|
12258
12274
|
average: Math.round(e),
|
|
12259
12275
|
last: Math.round(t),
|
|
12260
12276
|
max: Math.round(n),
|
|
12261
12277
|
min: Math.round(r)
|
|
12262
|
-
}),
|
|
12278
|
+
}), eC = [
|
|
12263
12279
|
"timeSpentBuffering",
|
|
12264
12280
|
"timePerBufferingEvent",
|
|
12265
12281
|
"drift",
|
|
@@ -12271,24 +12287,24 @@ var zS = class {
|
|
|
12271
12287
|
"videoKeyframeIntervalMs",
|
|
12272
12288
|
"timeToConnected",
|
|
12273
12289
|
"mediaSourceOpenTime"
|
|
12274
|
-
],
|
|
12290
|
+
], tC = [
|
|
12275
12291
|
"videoDecodeTime",
|
|
12276
12292
|
"audioDecodeTime",
|
|
12277
12293
|
"videoTransportTime",
|
|
12278
12294
|
"rtt"
|
|
12279
|
-
],
|
|
12295
|
+
], nC = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, rC = (e) => {
|
|
12280
12296
|
let t = x({}, e);
|
|
12281
|
-
for (let e of
|
|
12297
|
+
for (let e of eC) {
|
|
12282
12298
|
let n = t[e];
|
|
12283
12299
|
typeof n == "number" && (t[e] = Math.round(n));
|
|
12284
12300
|
}
|
|
12285
|
-
for (let e of
|
|
12301
|
+
for (let e of tC) {
|
|
12286
12302
|
let n = t[e];
|
|
12287
|
-
|
|
12303
|
+
nC(n) && (t[e] = $S(n));
|
|
12288
12304
|
}
|
|
12289
12305
|
return t;
|
|
12290
|
-
},
|
|
12291
|
-
if (
|
|
12306
|
+
}, 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) => {
|
|
12307
|
+
if (!aC(e)) throw new A("Invalid options", {
|
|
12292
12308
|
isFatal: !0,
|
|
12293
12309
|
code: "invalid_options"
|
|
12294
12310
|
});
|
|
@@ -12297,13 +12313,13 @@ var zS = class {
|
|
|
12297
12313
|
let n = t;
|
|
12298
12314
|
n[e] === void 0 && delete n[e];
|
|
12299
12315
|
}), t;
|
|
12300
|
-
},
|
|
12316
|
+
}, sC = (e) => {
|
|
12301
12317
|
if (typeof e != "object" || !e) throw Error("not an object");
|
|
12302
12318
|
if (!("video" in e)) throw Error("missing video in subscription");
|
|
12303
12319
|
if (!("audio" in e)) throw Error("missing audio in subscription");
|
|
12304
12320
|
if (!("channelId" in e)) throw Error("missing channelId");
|
|
12305
12321
|
return !0;
|
|
12306
|
-
},
|
|
12322
|
+
}, cC = class {
|
|
12307
12323
|
constructor(n) {
|
|
12308
12324
|
var r = this;
|
|
12309
12325
|
e(this, "cache", /* @__PURE__ */ new Map()), e(this, "inFlight", /* @__PURE__ */ new Map()), e(this, "checkVideoSupport", function() {
|
|
@@ -12364,10 +12380,10 @@ var zS = class {
|
|
|
12364
12380
|
return this.inFlight.set(e, o), o;
|
|
12365
12381
|
}), this.logger = n;
|
|
12366
12382
|
}
|
|
12367
|
-
},
|
|
12383
|
+
}, 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
12384
|
constructor(r) {
|
|
12369
12385
|
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,
|
|
12386
|
+
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
12387
|
var t;
|
|
12372
12388
|
(t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
|
|
12373
12389
|
}), e(this, "setElement", (e) => {
|
|
@@ -12467,20 +12483,20 @@ var zS = class {
|
|
|
12467
12483
|
}), e(this, "updateTextTracks", (e) => {
|
|
12468
12484
|
let t = e.filter((e) => e.codec === "webvtt");
|
|
12469
12485
|
t.forEach((e) => {
|
|
12470
|
-
if (!s(
|
|
12486
|
+
if (!s(hC, this).find((t) => t.language === e.language)) {
|
|
12471
12487
|
if (this.modules.canvasModule) {
|
|
12472
12488
|
let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
|
|
12473
|
-
s(
|
|
12489
|
+
s(hC, this).push(t);
|
|
12474
12490
|
} else if (this.mediaElement instanceof HTMLVideoElement) {
|
|
12475
12491
|
let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
|
|
12476
|
-
s(
|
|
12492
|
+
s(hC, this).push(t);
|
|
12477
12493
|
}
|
|
12478
12494
|
}
|
|
12479
12495
|
});
|
|
12480
|
-
for (let e of s(
|
|
12496
|
+
for (let e of s(hC, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
|
|
12481
12497
|
this.emit("text tracks", this.textTracks);
|
|
12482
12498
|
}), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
|
|
12483
|
-
s(
|
|
12499
|
+
s(hC, this).forEach((t) => {
|
|
12484
12500
|
if (t.cues) for (let n of Array.from(t.cues)) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
|
|
12485
12501
|
});
|
|
12486
12502
|
}), e(this, "filterRenditions", function() {
|
|
@@ -12540,7 +12556,7 @@ var zS = class {
|
|
|
12540
12556
|
var e;
|
|
12541
12557
|
let t = this.modules.connection.linkQueue;
|
|
12542
12558
|
if (!t) return !1;
|
|
12543
|
-
let n = Math.max(this.targetBufferTime,
|
|
12559
|
+
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
12560
|
return a && !this.upgradeHeld && this.logger.debug("Holding the upgrade while the link queues", {
|
|
12545
12561
|
linkQueuePeakMs: r === void 0 ? void 0 : Math.round(r),
|
|
12546
12562
|
windowMs: n
|
|
@@ -12645,8 +12661,8 @@ var zS = class {
|
|
|
12645
12661
|
u = void 0, d = void 0, o.logger.warn("Failed to enable OffscreenCanvas; falling back to main thread rendering", { error: e });
|
|
12646
12662
|
}
|
|
12647
12663
|
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
|
|
12664
|
+
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;
|
|
12665
|
+
if (h instanceof Bx) if (m === "OffscreenCanvas" && d) {
|
|
12650
12666
|
h.setVideoRenderingEnabled(!1);
|
|
12651
12667
|
let e = o.element;
|
|
12652
12668
|
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 +12674,11 @@ var zS = class {
|
|
|
12658
12674
|
t.parentElement && t.parentElement.replaceChild(e, t), o.setElement(e);
|
|
12659
12675
|
}
|
|
12660
12676
|
}
|
|
12661
|
-
else h instanceof
|
|
12677
|
+
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
12678
|
(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
|
|
12679
|
+
})), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof qx), e(this, "connectWebKitVideoOutput", (e, t) => {
|
|
12664
12680
|
let n = () => {
|
|
12665
|
-
t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(
|
|
12681
|
+
t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(pC);
|
|
12666
12682
|
};
|
|
12667
12683
|
e.onVideoTrackLost((e) => {
|
|
12668
12684
|
this.logger.warn("Worker video track lost, falling back to canvas capture", { error: e }), n();
|
|
@@ -12670,7 +12686,7 @@ var zS = class {
|
|
|
12670
12686
|
let r = e.videoTrack;
|
|
12671
12687
|
r ? t.setVideoTrack(r) : n();
|
|
12672
12688
|
}), 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
|
|
12689
|
+
if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof qx) return;
|
|
12674
12690
|
let e = this.modules.decoder, t = this.modules.canvasModule;
|
|
12675
12691
|
if (!t) return;
|
|
12676
12692
|
let n = !1;
|
|
@@ -12712,7 +12728,7 @@ var zS = class {
|
|
|
12712
12728
|
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
12729
|
}), e(this, "getStatistics", () => {
|
|
12714
12730
|
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
|
|
12731
|
+
return rC(x(x({}, e), {}, {
|
|
12716
12732
|
averageBitRate: t,
|
|
12717
12733
|
reconnectsPerHour: i,
|
|
12718
12734
|
seekAdjustmentsPerMinute: s,
|
|
@@ -12721,7 +12737,7 @@ var zS = class {
|
|
|
12721
12737
|
}), e(this, "resetModules", () => {
|
|
12722
12738
|
Object.values(this.modules).forEach((e) => {
|
|
12723
12739
|
e && "reset" in e && e.reset();
|
|
12724
|
-
}), this.playbackSource instanceof uc && this.modules.adaptivity.holdReconnect(
|
|
12740
|
+
}), this.playbackSource instanceof uc && this.modules.adaptivity.holdReconnect(lC), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
|
|
12725
12741
|
}), e(this, "disconnectForInactivePage", (e) => {
|
|
12726
12742
|
if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
|
|
12727
12743
|
var t;
|
|
@@ -12752,10 +12768,10 @@ var zS = class {
|
|
|
12752
12768
|
e && "unsuspend" in e && e.unsuspend();
|
|
12753
12769
|
});
|
|
12754
12770
|
}), e(this, "getRuntimeInfo", () => {
|
|
12755
|
-
let e = this.modules.canvasModule instanceof
|
|
12771
|
+
let e = this.modules.canvasModule instanceof qx ? !0 : void 0;
|
|
12756
12772
|
return x({
|
|
12757
12773
|
uptime: this.uptime,
|
|
12758
|
-
version: "4.8.0-
|
|
12774
|
+
version: "4.8.0-2-g31d0f7c0",
|
|
12759
12775
|
clientId: this.clientId,
|
|
12760
12776
|
sessionId: this.sessionId,
|
|
12761
12777
|
channelId: this.channelId,
|
|
@@ -12800,7 +12816,7 @@ var zS = class {
|
|
|
12800
12816
|
if (this.browser.platform.isWebKit || !this.browser.isMobile) return !1;
|
|
12801
12817
|
let t = (e = this.modules) == null ? void 0 : e.decoder;
|
|
12802
12818
|
return t ? t.audioWebCodecsInUse : this.isWebCodecsAudioAvailable(this.channelId);
|
|
12803
|
-
}), this.options = new
|
|
12819
|
+
}), 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
12820
|
let d = {
|
|
12805
12821
|
channelId: this.options.get("channelId"),
|
|
12806
12822
|
audio: {
|
|
@@ -12813,14 +12829,14 @@ var zS = class {
|
|
|
12813
12829
|
height: this.options.get("maxSize").height
|
|
12814
12830
|
}
|
|
12815
12831
|
}, f = S.get();
|
|
12816
|
-
f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new
|
|
12832
|
+
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
12833
|
let p = (c = r.streamToMediaElementEnabled) == null ? r.iosMediaElementEnabled : c;
|
|
12818
12834
|
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
12835
|
let m = (u = r.backgroundPlayEnabled) == null ? r.iosBackgroundPlayEnabled : u;
|
|
12820
12836
|
m !== void 0 && (this.options.set("backgroundPlayEnabled", m), this.options.set("iosBackgroundPlayEnabled", m));
|
|
12821
12837
|
let g = r.mseEnabled !== void 0, _ = r.decoders !== void 0;
|
|
12822
12838
|
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 =
|
|
12839
|
+
let v = lS.create(this.emitter, this.logger.createContext("PictureInPictureModule")), y = this.options.get("mediaSessionEnabled") ? Gx.create(this.emitter, this.logger.createContext("MediaSessionModule"), {
|
|
12824
12840
|
metadata: this.options.get("mediaSessionMetadata"),
|
|
12825
12841
|
decoy: this.willUseMediaSource() || this.usesSplitCanvasAudio() ? void 0 : kc.create(this.logger.createContext("AudioFocusDecoy"), this.yieldToInterruption),
|
|
12826
12842
|
isMuted: () => this.playbackSource.userMuted,
|
|
@@ -12831,12 +12847,12 @@ var zS = class {
|
|
|
12831
12847
|
holdDecoyWhilePaused: this.holdsDecoyWhilePaused(),
|
|
12832
12848
|
keepDecoyWhenMuted: this.isWebKitCanvasPath(),
|
|
12833
12849
|
pauseMeansMute: !this.options.get("pauseSupportEnabled")
|
|
12834
|
-
}) : void 0, b = k.create(), te =
|
|
12850
|
+
}) : void 0, b = k.create(), te = yx.create(this.emitter), re = Qb.create(this.emitter, this.logger.createContext("ConnectionModule"), {
|
|
12835
12851
|
reconnectHandler: this.options.get("reconnectHandler"),
|
|
12836
12852
|
options: this.options,
|
|
12837
12853
|
onConnectInfo: this.onConnectInfo,
|
|
12838
12854
|
documentState: te
|
|
12839
|
-
}), C = Mv.create(this.logger.createContext("SubscriptionModule"), this.emitter, d), w =
|
|
12855
|
+
}), 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
12856
|
this.encryptedMediaExtensions = new Si(this.emitter, this.logger.createContext("EncryptedMediaExtensions"), r.drm), this.drm = {
|
|
12841
12857
|
setHeaders: (e) => {
|
|
12842
12858
|
this.encryptedMediaExtensions.headers = e;
|
|
@@ -12855,9 +12871,9 @@ var zS = class {
|
|
|
12855
12871
|
logger: this.logger.createContext("MediaElement"),
|
|
12856
12872
|
poster: ce
|
|
12857
12873
|
});
|
|
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 =
|
|
12874
|
+
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
12875
|
} else if (this.streamsToMediaElement()) {
|
|
12860
|
-
let e =
|
|
12876
|
+
let e = qx.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
|
|
12861
12877
|
type: this.options.get("media") === "audio" ? "audio" : "video",
|
|
12862
12878
|
muted: this.options.get("muted") || this.options.get("media") === "video",
|
|
12863
12879
|
volume: this.options.get("volume"),
|
|
@@ -12869,10 +12885,10 @@ var zS = class {
|
|
|
12869
12885
|
});
|
|
12870
12886
|
this.element = e.element().element, this.playbackSource = e, ue = e;
|
|
12871
12887
|
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 =
|
|
12888
|
+
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
12889
|
} else {
|
|
12874
12890
|
let e;
|
|
12875
|
-
e =
|
|
12891
|
+
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
12892
|
this.setElement(e.element());
|
|
12877
12893
|
}, this.options.get("minBufferTime")), this.element = e.element(), this.playbackSource = e, ue = e, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new Zs());
|
|
12878
12894
|
}
|
|
@@ -12890,9 +12906,9 @@ var zS = class {
|
|
|
12890
12906
|
getTargetBufferTime: () => ae.getTargetBufferTime(),
|
|
12891
12907
|
getNextBufferedRangeStart: T ? (e) => T.getNextBufferedRangeStart(e) : void 0,
|
|
12892
12908
|
getBufferedEndAt: T ? (e) => T.getBufferedEndAt(e) : void 0
|
|
12893
|
-
}, me =
|
|
12909
|
+
}, 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
12910
|
this.modules = {
|
|
12895
|
-
telemetry:
|
|
12911
|
+
telemetry: BS.create(this.logger.createContext("TelemetryModule"), this.emitter, {
|
|
12896
12912
|
url: E,
|
|
12897
12913
|
enabled: this.options.get("telemetryEnabled"),
|
|
12898
12914
|
includeStats: !1,
|
|
@@ -12904,8 +12920,8 @@ var zS = class {
|
|
|
12904
12920
|
}),
|
|
12905
12921
|
incomingData: ge,
|
|
12906
12922
|
adaptivity: Cc.create(this.emitter, this.logger.createContext("AdaptivityModule"), oe, ge, { cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3) }),
|
|
12907
|
-
constraintCap:
|
|
12908
|
-
event:
|
|
12923
|
+
constraintCap: rx.create(this.emitter, this.element, w, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
|
|
12924
|
+
event: Sx.create(this.emitter, this.logger.createContext("EventModule"), me),
|
|
12909
12925
|
sync: me,
|
|
12910
12926
|
jitter: he,
|
|
12911
12927
|
documentState: te,
|
|
@@ -12977,7 +12993,7 @@ var zS = class {
|
|
|
12977
12993
|
let r = ((t = (n = e.telemetry) == null ? void 0 : n.probability) == null ? 1 : t) >= Math.random();
|
|
12978
12994
|
if (e.telemetry) {
|
|
12979
12995
|
var i;
|
|
12980
|
-
(i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry =
|
|
12996
|
+
(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
12997
|
}
|
|
12982
12998
|
}), this.emitter.on("adapt level", (e) => {
|
|
12983
12999
|
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 +13036,8 @@ var zS = class {
|
|
|
13020
13036
|
audio: x(x({}, this.targetSubscription.audio), f == null ? void 0 : f.audio)
|
|
13021
13037
|
})), this.emitter.emit("adapted level");
|
|
13022
13038
|
}), this.emitter.on("ping timeout", this.onPingTimeout), this.emitter.on("text track data", (e) => {
|
|
13023
|
-
let t = s(
|
|
13024
|
-
if (a(
|
|
13039
|
+
let t = s(hC, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(mC, this);
|
|
13040
|
+
if (a(mC, this, n), t) {
|
|
13025
13041
|
if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
|
|
13026
13042
|
for (let r of e.cues) {
|
|
13027
13043
|
let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
|
|
@@ -13037,19 +13053,19 @@ var zS = class {
|
|
|
13037
13053
|
this.clientIp = t.ip;
|
|
13038
13054
|
break;
|
|
13039
13055
|
case "renditions":
|
|
13040
|
-
this.updateTextTracks(t.renditions), a(
|
|
13056
|
+
this.updateTextTracks(t.renditions), a(gC, this, this.filterRenditions(t.renditions, n.channelId).then((e) => {
|
|
13041
13057
|
r === this.sessionId && (this.emitter.emit("renditions", {
|
|
13042
13058
|
renditions: e,
|
|
13043
13059
|
channelId: n.channelId
|
|
13044
13060
|
}), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged());
|
|
13045
13061
|
}).finally(() => {
|
|
13046
|
-
a(
|
|
13062
|
+
a(gC, this, void 0);
|
|
13047
13063
|
}));
|
|
13048
13064
|
break;
|
|
13049
13065
|
case "subscription changed":
|
|
13050
13066
|
var i;
|
|
13051
13067
|
try {
|
|
13052
|
-
|
|
13068
|
+
sC(t.subscription);
|
|
13053
13069
|
} catch (e) {
|
|
13054
13070
|
this.emitter.emit("error", new A("Subscription failed validation", {
|
|
13055
13071
|
source: e instanceof Error ? e : void 0,
|
|
@@ -13180,7 +13196,7 @@ var zS = class {
|
|
|
13180
13196
|
let ye = function() {
|
|
13181
13197
|
var e = t(function* (e) {
|
|
13182
13198
|
let t = e.channelId;
|
|
13183
|
-
s(
|
|
13199
|
+
s(gC, o) && (yield s(gC, o));
|
|
13184
13200
|
let n = o.modules.renditions.getRendition(e.renditionId, t);
|
|
13185
13201
|
if (!Rs(e.flags)) {
|
|
13186
13202
|
if (zs(e.flags)) {
|
|
@@ -13194,8 +13210,8 @@ var zS = class {
|
|
|
13194
13210
|
} catch (e) {
|
|
13195
13211
|
o.logger.warn("failed to parse WebVTT segment, dropping it", e);
|
|
13196
13212
|
}
|
|
13197
|
-
let i = n / 1e3, c = s(
|
|
13198
|
-
if (a(
|
|
13213
|
+
let i = n / 1e3, c = s(hC, o).find((t) => t.language === e.language), l = i - s(mC, o);
|
|
13214
|
+
if (a(mC, o, i), c) {
|
|
13199
13215
|
if (c.cues) for (let e of c.cues) e.startTime -= l, e.endTime -= l;
|
|
13200
13216
|
for (let e of r) {
|
|
13201
13217
|
let t = new VTTCue(e.startTime - i, e.endTime - i, e.text);
|
|
@@ -13231,10 +13247,10 @@ var zS = class {
|
|
|
13231
13247
|
mimeType: s
|
|
13232
13248
|
}), o.emit("initialized media");
|
|
13233
13249
|
} else {
|
|
13234
|
-
let t =
|
|
13250
|
+
let t = QS(e, n, o.sizes.get(e.renditionId));
|
|
13235
13251
|
o.modules.jitter.recordSample(t);
|
|
13236
13252
|
let i = o.sampleProcessingSesssions.get(r);
|
|
13237
|
-
if (!i) i =
|
|
13253
|
+
if (!i) i = qS(o.modules.sync.processSample(t)), o.sampleProcessingSesssions.set(r, i);
|
|
13238
13254
|
else {
|
|
13239
13255
|
let e = o.willUseMediaSource() && o.isSwitchingRenditionLevel && t.type === "video", n = i(o.modules.sync.processSample(t), e), r = t;
|
|
13240
13256
|
n.forEach((e) => {
|
|
@@ -13341,7 +13357,7 @@ var zS = class {
|
|
|
13341
13357
|
this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
|
|
13342
13358
|
}
|
|
13343
13359
|
set textTrack(e) {
|
|
13344
|
-
e !== this.textTrack && (s(
|
|
13360
|
+
e !== this.textTrack && (s(hC, this).forEach((t) => {
|
|
13345
13361
|
if (t.label === e) t.mode = "showing";
|
|
13346
13362
|
else {
|
|
13347
13363
|
if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
|
|
@@ -13350,11 +13366,11 @@ var zS = class {
|
|
|
13350
13366
|
}), this.emitter.emit("text track", e));
|
|
13351
13367
|
}
|
|
13352
13368
|
get textTracks() {
|
|
13353
|
-
return s(
|
|
13369
|
+
return s(hC, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
|
|
13354
13370
|
}
|
|
13355
13371
|
get textTrack() {
|
|
13356
13372
|
var e;
|
|
13357
|
-
return (e = s(
|
|
13373
|
+
return (e = s(hC, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
|
|
13358
13374
|
}
|
|
13359
13375
|
get channelId() {
|
|
13360
13376
|
var e, t;
|
|
@@ -13492,7 +13508,7 @@ var zS = class {
|
|
|
13492
13508
|
return this.modules.subscription.getTargetSubscription();
|
|
13493
13509
|
}
|
|
13494
13510
|
resolvedDecoder(e) {
|
|
13495
|
-
return
|
|
13511
|
+
return ZS(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
|
|
13496
13512
|
}
|
|
13497
13513
|
usesSplitCanvasAudio() {
|
|
13498
13514
|
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 +13548,6 @@ var zS = class {
|
|
|
13532
13548
|
return this.hasCalledConnect && this.isBackgroundPlayEnabled(e) && !this.isUserPaused;
|
|
13533
13549
|
}
|
|
13534
13550
|
};
|
|
13535
|
-
e(
|
|
13551
|
+
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
13552
|
//#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,
|
|
13553
|
+
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 };
|