@vindral/web-sdk 4.7.2-2-g7c061564 → 4.7.2-20-g80a09629
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/{pQmTZTh_.js → BDEmxn27.js} +811 -622
- package/{6fUfml-Z.js → C2hzXxnL.js} +1 -1
- package/{BK-84KPi.js → CoLAnqGB.js} +3 -0
- package/DY9SkiUz.js +5087 -0
- package/{XEQIIc9P.js → ZUbKTiOB.js} +1 -1
- package/core.d.ts +29 -9
- package/core.js +1 -1
- package/legacy.d.ts +29 -9
- package/legacy.es.js +975 -783
- package/legacy.umd.js +10 -10
- package/package.json +1 -1
- package/player.d.ts +29 -6
- package/player.js +3 -3
- package/react.d.ts +29 -6
- package/vindral-player-component.js +2 -2
- package/Cwircrld.js +0 -4783
|
@@ -4043,7 +4043,7 @@ var gc, _c = .15, vc = .2, yc = .4, bc = .5, xc = .6, Sc = 1800, Cc = {
|
|
|
4043
4043
|
maxCooldownRatio: 2
|
|
4044
4044
|
}, wc = (e) => (t) => t > e, Tc = class {
|
|
4045
4045
|
constructor(t, n, r, i, a) {
|
|
4046
|
-
e(this, "qualityOfServiceSource", void 0), e(this, "incomingDataSource", void 0), e(this, "config", void 0), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "isSuspended", !1), e(this, "lastAdaptTime", performance.now()), e(this, "isEnabled", !0), e(this, "load", () => {
|
|
4046
|
+
e(this, "qualityOfServiceSource", void 0), e(this, "incomingDataSource", void 0), e(this, "config", void 0), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "isSuspended", !1), e(this, "lastAdaptTime", performance.now()), e(this, "reconnectHoldUntil", -Infinity), e(this, "isEnabled", !0), e(this, "load", () => {
|
|
4047
4047
|
this.emitter.on("buffer state", this.onBufferState), this.emitter.on("adapted level", this.onAdaptedLevel);
|
|
4048
4048
|
}), e(this, "unload", () => {
|
|
4049
4049
|
this.emitter.off("buffer state", this.onBufferState), this.emitter.off("adapted level", this.onAdaptedLevel);
|
|
@@ -4053,6 +4053,8 @@ var gc, _c = .15, vc = .2, yc = .4, bc = .5, xc = .6, Sc = 1800, Cc = {
|
|
|
4053
4053
|
this.reset(), this.isSuspended = !1;
|
|
4054
4054
|
}), e(this, "reset", (e = 0) => {
|
|
4055
4055
|
this.lastAdaptTime = performance.now() + e;
|
|
4056
|
+
}), e(this, "holdReconnect", (e) => {
|
|
4057
|
+
this.reconnectHoldUntil = performance.now() + e;
|
|
4056
4058
|
}), e(this, "getStatistics", () => ({ isAbrEnabled: this.isEnabled })), e(this, "isQoSOk", (e) => {
|
|
4057
4059
|
let t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: n, downgradesFromLevel: r } = t == null ? {
|
|
4058
4060
|
upgradesFromLevel: [],
|
|
@@ -4079,7 +4081,7 @@ var gc, _c = .15, vc = .2, yc = .4, bc = .5, xc = .6, Sc = 1800, Cc = {
|
|
|
4079
4081
|
}), e(this, "onBufferState", (e) => {
|
|
4080
4082
|
if (!this.isEnabled || this.isSuspended || this.lastAdaptTime + this.config.cooldownTime > performance.now()) return;
|
|
4081
4083
|
let { bufferFullness: t, general: n } = this.qualityOfServiceSource.getMetrics(), r = this.qualityOfServiceSource.getBufferFullnessRegression(), i = 10 * 1e3, a = 30 * 1e3, o = this.qualityOfServiceSource.timeSpentBufferingLast(a), s = this.qualityOfServiceSource.timeSpentActiveLast(a), c = this.qualityOfServiceSource.bufferingEventsLast(a), l = s > 0 ? o / s : 0, u = this.qualityOfServiceSource.getTargetBufferTime();
|
|
4082
|
-
if (t < .15 && l > .8) {
|
|
4084
|
+
if (t < .15 && l > .8 && performance.now() >= this.reconnectHoldUntil) {
|
|
4083
4085
|
this.adaptLevel("reconnect");
|
|
4084
4086
|
return;
|
|
4085
4087
|
}
|
|
@@ -4104,6 +4106,9 @@ var gc, _c = .15, vc = .2, yc = .4, bc = .5, xc = .6, Sc = 1800, Cc = {
|
|
|
4104
4106
|
this.reset();
|
|
4105
4107
|
}), e(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e)), this.qualityOfServiceSource = r, this.incomingDataSource = i, this.config = y(y({}, Cc), a), this.emitter = t, this.logger = n;
|
|
4106
4108
|
}
|
|
4109
|
+
updateConfig(e) {
|
|
4110
|
+
this.config = y(y({}, this.config), e);
|
|
4111
|
+
}
|
|
4107
4112
|
tooMuchTimeBuffering(e) {
|
|
4108
4113
|
let t = this.qualityOfServiceSource.timeSpentActiveLast(e);
|
|
4109
4114
|
return (t ? this.qualityOfServiceSource.timeSpentBufferingLast(e) / t : 0) > this.config.maxBufferingRatio.last10Seconds;
|
|
@@ -7991,42 +7996,42 @@ function J_(e) {
|
|
|
7991
7996
|
return n;
|
|
7992
7997
|
}
|
|
7993
7998
|
var Y_ = /* @__PURE__ */ new WeakMap(), X_ = /* @__PURE__ */ new WeakSet(), Z_ = class r {
|
|
7994
|
-
constructor(t, r, s) {
|
|
7995
|
-
x(this, X_), e(this, "ip", void 0), e(this, "value", void 0), i(this, Y_, void 0), this.ip = s, this.value = new Kt(r), a(Y_, this, o(X_, this, Q_).call(this, t)), this.closed().catch(n);
|
|
7999
|
+
constructor(t, r, s, c) {
|
|
8000
|
+
x(this, X_), e(this, "ip", void 0), e(this, "value", void 0), i(this, Y_, void 0), this.ip = s, this.value = new Kt(r), a(Y_, this, o(X_, this, Q_).call(this, t, c)), this.closed().catch(n);
|
|
7996
8001
|
}
|
|
7997
8002
|
closed() {
|
|
7998
8003
|
return s(Y_, this);
|
|
7999
8004
|
}
|
|
8000
|
-
static start(e) {
|
|
8005
|
+
static start(e, n) {
|
|
8001
8006
|
return t(function* () {
|
|
8002
|
-
let t = (yield e.subscribe(new Sh().name("stats").groupOrder("ascending").build())).objects(),
|
|
8003
|
-
if (
|
|
8004
|
-
let
|
|
8005
|
-
if (!
|
|
8006
|
-
return new r(t,
|
|
8007
|
+
let t = (yield e.subscribe(new Sh().name("stats").groupOrder("ascending").build())).objects(), i = yield t.next(), a = performance.now();
|
|
8008
|
+
if (i.done) throw Error("No stats object received");
|
|
8009
|
+
let o = J_(i.value.payload);
|
|
8010
|
+
if (!o.ip) throw Error("Expected IP in initial stats object");
|
|
8011
|
+
return n == null || n(o, a), new r(t, o, o.ip, n);
|
|
8007
8012
|
})();
|
|
8008
8013
|
}
|
|
8009
8014
|
};
|
|
8010
|
-
function Q_(e) {
|
|
8011
|
-
var
|
|
8015
|
+
function Q_(e, n) {
|
|
8016
|
+
var r = this;
|
|
8012
8017
|
return t(function* () {
|
|
8013
|
-
var t = !1,
|
|
8018
|
+
var t = !1, i = !1, a;
|
|
8014
8019
|
try {
|
|
8015
|
-
for (var
|
|
8016
|
-
let e =
|
|
8020
|
+
for (var o = B(e), s; t = !(s = yield o.next()).done; t = !1) {
|
|
8021
|
+
let e = s.value;
|
|
8017
8022
|
{
|
|
8018
8023
|
if (e.objectStatus !== z.Normal) continue;
|
|
8019
|
-
let t = J_(e.payload);
|
|
8020
|
-
n.value.update(
|
|
8024
|
+
let t = performance.now(), i = J_(e.payload);
|
|
8025
|
+
n == null || n(i, t), r.value.update(i);
|
|
8021
8026
|
}
|
|
8022
8027
|
}
|
|
8023
8028
|
} catch (e) {
|
|
8024
|
-
|
|
8029
|
+
i = !0, a = e;
|
|
8025
8030
|
} finally {
|
|
8026
8031
|
try {
|
|
8027
|
-
t &&
|
|
8032
|
+
t && o.return != null && (yield o.return());
|
|
8028
8033
|
} finally {
|
|
8029
|
-
if (
|
|
8034
|
+
if (i) throw a;
|
|
8030
8035
|
}
|
|
8031
8036
|
}
|
|
8032
8037
|
})();
|
|
@@ -8090,17 +8095,17 @@ var sv = class {
|
|
|
8090
8095
|
s(iv, e).debug("tracks ended", { mediaType: t });
|
|
8091
8096
|
})();
|
|
8092
8097
|
}
|
|
8093
|
-
}, cv = /* @__PURE__ */ new WeakMap(), lv = /* @__PURE__ */ new WeakMap(), uv = /* @__PURE__ */ new WeakMap(), dv = /* @__PURE__ */ new WeakMap(),
|
|
8098
|
+
}, cv = /* @__PURE__ */ new WeakMap(), lv = /* @__PURE__ */ new WeakMap(), uv = /* @__PURE__ */ new WeakMap(), dv = /* @__PURE__ */ new WeakMap(), fv = /* @__PURE__ */ new WeakMap(), pv = /* @__PURE__ */ new WeakMap(), mv = /* @__PURE__ */ new WeakMap(), hv = /* @__PURE__ */ new WeakMap(), gv = /* @__PURE__ */ new WeakMap(), _v = /* @__PURE__ */ new WeakMap(), vv = /* @__PURE__ */ new WeakSet(), yv = class r {
|
|
8094
8099
|
constructor(t, r, c) {
|
|
8095
|
-
x(this,
|
|
8096
|
-
o(
|
|
8097
|
-
o(
|
|
8098
|
-
o(
|
|
8099
|
-
s(
|
|
8100
|
+
x(this, vv), i(this, cv, void 0), i(this, lv, void 0), i(this, uv, void 0), i(this, dv, b.get().createContext("Player")), i(this, fv, void 0), i(this, pv, new Kt(void 0)), i(this, mv, new Kt(void 0)), i(this, hv, new Kt(void 0)), i(this, gv, void 0), i(this, _v, void 0), e(this, "subtitles", new sv(s(hv, this), "subtitles")), e(this, "video", new sv(s(mv, this), "video")), e(this, "audio", new sv(s(pv, this), "audio")), a(cv, this, t), a(lv, this, L_.start(c)), a(uv, this, c), a(fv, this, new Kt(r)), a(gv, this, new tv(r)), a(_v, this, Promise.race([
|
|
8101
|
+
o(vv, this, wv).call(this),
|
|
8102
|
+
o(vv, this, bv).call(this),
|
|
8103
|
+
o(vv, this, Cv).call(this),
|
|
8104
|
+
s(gv, this).closed()
|
|
8100
8105
|
])), s(cv, this).closed().then(() => this.close()).catch(n);
|
|
8101
8106
|
}
|
|
8102
8107
|
closed() {
|
|
8103
|
-
return s(
|
|
8108
|
+
return s(_v, this);
|
|
8104
8109
|
}
|
|
8105
8110
|
static start(e, n) {
|
|
8106
8111
|
return t(function* () {
|
|
@@ -8113,8 +8118,8 @@ var sv = class {
|
|
|
8113
8118
|
Promise.resolve(e),
|
|
8114
8119
|
n.videoTrack ? e.subscribeCmafTrack(n.videoTrack, { params: t }) : void 0,
|
|
8115
8120
|
n.audioTrack ? e.subscribeCmafTrack(n.audioTrack, { params: t }) : void 0
|
|
8116
|
-
])), Z_.start(i)]), u = new r(e, a, l);
|
|
8117
|
-
return c && s(
|
|
8121
|
+
])), Z_.start(i, n.onStats)]), u = new r(e, a, l);
|
|
8122
|
+
return c && s(pv, u).update(c), o && s(mv, u).update(o), u;
|
|
8118
8123
|
})();
|
|
8119
8124
|
}
|
|
8120
8125
|
connectionInfo() {
|
|
@@ -8129,18 +8134,18 @@ var sv = class {
|
|
|
8129
8134
|
return s(uv, this).value;
|
|
8130
8135
|
}
|
|
8131
8136
|
catalog() {
|
|
8132
|
-
return s(
|
|
8137
|
+
return s(fv, this).current().catalog();
|
|
8133
8138
|
}
|
|
8134
8139
|
namespace() {
|
|
8135
|
-
return s(
|
|
8140
|
+
return s(fv, this).current().namespace;
|
|
8136
8141
|
}
|
|
8137
8142
|
videoTrack() {
|
|
8138
8143
|
var e;
|
|
8139
|
-
return (e = s(
|
|
8144
|
+
return (e = s(mv, this).current()) == null ? void 0 : e.trackObject;
|
|
8140
8145
|
}
|
|
8141
8146
|
audioTrack() {
|
|
8142
8147
|
var e;
|
|
8143
|
-
return (e = s(
|
|
8148
|
+
return (e = s(pv, this).current()) == null ? void 0 : e.trackObject;
|
|
8144
8149
|
}
|
|
8145
8150
|
referenceClock() {
|
|
8146
8151
|
return s(lv, this);
|
|
@@ -8149,16 +8154,16 @@ var sv = class {
|
|
|
8149
8154
|
var e = this;
|
|
8150
8155
|
return t(function* () {
|
|
8151
8156
|
var t, n;
|
|
8152
|
-
if (e.catalog().current().tracks.find(({ name: e }) => e === "drm")) return K_.create(s(
|
|
8157
|
+
if (e.catalog().current().tracks.find(({ name: e }) => e === "drm")) return K_.create(s(fv, e).current(), (t = e.videoTrack()) == null ? void 0 : t.codec, (n = e.audioTrack()) == null ? void 0 : n.codec);
|
|
8153
8158
|
})();
|
|
8154
8159
|
}
|
|
8155
8160
|
close() {
|
|
8156
8161
|
return s(dv, this).info("Enter 'close'"), Promise.all([
|
|
8157
|
-
s(
|
|
8158
|
-
s(
|
|
8159
|
-
o(
|
|
8160
|
-
o(
|
|
8161
|
-
o(
|
|
8162
|
+
s(fv, this).current().close(),
|
|
8163
|
+
s(fv, this).close(),
|
|
8164
|
+
o(vv, this, xv).call(this, s(pv, this)),
|
|
8165
|
+
o(vv, this, xv).call(this, s(mv, this)),
|
|
8166
|
+
o(vv, this, xv).call(this, s(hv, this))
|
|
8162
8167
|
]);
|
|
8163
8168
|
}
|
|
8164
8169
|
zap(e, n) {
|
|
@@ -8168,16 +8173,16 @@ var sv = class {
|
|
|
8168
8173
|
config: e,
|
|
8169
8174
|
zapOffsetMs: n
|
|
8170
8175
|
});
|
|
8171
|
-
let t = yield k_.start(s(cv, r), e), i = s(lv, r).wallclock() - n, a = s(
|
|
8172
|
-
s(
|
|
8176
|
+
let t = yield k_.start(s(cv, r), e), i = s(lv, r).wallclock() - n, a = s(fv, r).current(), o = a.timestampWallclockOffset(), c = yield t.waitForWallclockTime(i);
|
|
8177
|
+
s(gv, r).update(t), yield s(fv, r).current().close();
|
|
8173
8178
|
let l = c.toReversed().find((e) => e.wallclock <= i), u = l != null && l.mediaPts ? l.mediaPts - a.timestampOffsetMs() : void 0, d = t.timestampWallclockOffset() - o + a.timestampOffsetMs();
|
|
8174
8179
|
t.setTimestampOffsetMs(d);
|
|
8175
8180
|
let f = (l == null ? void 0 : l.groupId) !== void 0 && !Number.isNaN(l.groupId) ? w(l.groupId) : void 0;
|
|
8176
8181
|
if (u) {
|
|
8177
8182
|
var p, m;
|
|
8178
|
-
(p = s(
|
|
8183
|
+
(p = s(mv, r).current()) == null || p.stopAfterTimestampReached(u), (m = s(pv, r).current()) == null || m.stopAfterTimestampReached(u);
|
|
8179
8184
|
}
|
|
8180
|
-
s(
|
|
8185
|
+
s(fv, r).update(t), yield Promise.all([e.videoTrack ? r.setVideoTrack(e.videoTrack, f) : void 0, e.audioTrack ? r.setAudioTrack(e.audioTrack, f) : void 0]), s(dv, r).info("Return 'zap'");
|
|
8181
8186
|
})();
|
|
8182
8187
|
}
|
|
8183
8188
|
setSubtitleTrack(e) {
|
|
@@ -8186,29 +8191,29 @@ var sv = class {
|
|
|
8186
8191
|
var t;
|
|
8187
8192
|
if (!e) {
|
|
8188
8193
|
var r;
|
|
8189
|
-
yield (r = s(
|
|
8194
|
+
yield (r = s(hv, n).current()) == null ? void 0 : r.unsubscribe();
|
|
8190
8195
|
return;
|
|
8191
8196
|
}
|
|
8192
|
-
let [i] = yield Promise.all([s(
|
|
8193
|
-
s(
|
|
8197
|
+
let [i] = yield Promise.all([s(fv, n).current().subscribeWebVttTrack(e), (t = s(hv, n).current()) == null ? void 0 : t.unsubscribe()]);
|
|
8198
|
+
s(hv, n).update(i);
|
|
8194
8199
|
})();
|
|
8195
8200
|
}
|
|
8196
8201
|
setVideoTrack(e, n) {
|
|
8197
8202
|
var r = this;
|
|
8198
8203
|
return t(function* () {
|
|
8199
|
-
let t = yield o(
|
|
8200
|
-
s(
|
|
8204
|
+
let t = yield o(vv, r, Sv).call(r, s(fv, r).current(), e, s(mv, r).current(), n);
|
|
8205
|
+
s(mv, r).update(t);
|
|
8201
8206
|
})();
|
|
8202
8207
|
}
|
|
8203
8208
|
setAudioTrack(e, n) {
|
|
8204
8209
|
var r = this;
|
|
8205
8210
|
return t(function* () {
|
|
8206
|
-
let t = yield o(
|
|
8207
|
-
s(
|
|
8211
|
+
let t = yield o(vv, r, Sv).call(r, s(fv, r).current(), e, s(pv, r).current(), n);
|
|
8212
|
+
s(pv, r).update(t);
|
|
8208
8213
|
})();
|
|
8209
8214
|
}
|
|
8210
8215
|
};
|
|
8211
|
-
function
|
|
8216
|
+
function bv() {
|
|
8212
8217
|
var e = this;
|
|
8213
8218
|
return t(function* () {
|
|
8214
8219
|
let t = !1;
|
|
@@ -8221,11 +8226,11 @@ function yv() {
|
|
|
8221
8226
|
}
|
|
8222
8227
|
})();
|
|
8223
8228
|
}
|
|
8224
|
-
function
|
|
8229
|
+
function xv(e) {
|
|
8225
8230
|
let t = e.current(), n = t == null ? void 0 : t.largestGroupId();
|
|
8226
8231
|
return e.isClosed() || e.update(void 0), e.close(), n === void 0 ? t == null ? void 0 : t.unsubscribe() : t == null ? void 0 : t.update(n, n);
|
|
8227
8232
|
}
|
|
8228
|
-
function
|
|
8233
|
+
function Sv(e, n, r, i) {
|
|
8229
8234
|
var a = this;
|
|
8230
8235
|
return t(function* () {
|
|
8231
8236
|
s(dv, a).info("Enter '#replaceTrack'", {
|
|
@@ -8236,18 +8241,18 @@ function xv(e, n, r, i) {
|
|
|
8236
8241
|
return o;
|
|
8237
8242
|
})();
|
|
8238
8243
|
}
|
|
8239
|
-
function
|
|
8244
|
+
function Cv() {
|
|
8240
8245
|
var e = this;
|
|
8241
8246
|
return t(function* () {
|
|
8242
8247
|
var t = !1, n = !1, r;
|
|
8243
8248
|
try {
|
|
8244
|
-
for (var i = B(s(
|
|
8249
|
+
for (var i = B(s(fv, e)), a; t = !(a = yield i.next()).done; t = !1) {
|
|
8245
8250
|
let t = a.value;
|
|
8246
8251
|
var c = !1, l = !1, u;
|
|
8247
8252
|
try {
|
|
8248
8253
|
for (var d = B(t.catalog()), f; c = !(f = yield d.next()).done; c = !1) {
|
|
8249
8254
|
let t = f.value;
|
|
8250
|
-
yield Promise.all([o(
|
|
8255
|
+
yield Promise.all([o(vv, e, Tv).call(e, t, s(mv, e)), o(vv, e, Tv).call(e, t, s(pv, e))]);
|
|
8251
8256
|
}
|
|
8252
8257
|
} catch (e) {
|
|
8253
8258
|
l = !0, u = e;
|
|
@@ -8270,7 +8275,7 @@ function Sv() {
|
|
|
8270
8275
|
}
|
|
8271
8276
|
})();
|
|
8272
8277
|
}
|
|
8273
|
-
function
|
|
8278
|
+
function wv() {
|
|
8274
8279
|
var e = this;
|
|
8275
8280
|
return t(function* () {
|
|
8276
8281
|
try {
|
|
@@ -8280,7 +8285,7 @@ function Cv() {
|
|
|
8280
8285
|
}
|
|
8281
8286
|
})();
|
|
8282
8287
|
}
|
|
8283
|
-
function
|
|
8288
|
+
function Tv(e, n) {
|
|
8284
8289
|
var r = this;
|
|
8285
8290
|
return t(function* () {
|
|
8286
8291
|
let t = n.current();
|
|
@@ -8291,30 +8296,149 @@ function wv(e, n) {
|
|
|
8291
8296
|
n.update(void 0);
|
|
8292
8297
|
return;
|
|
8293
8298
|
}
|
|
8294
|
-
n.update(yield s(
|
|
8299
|
+
n.update(yield s(fv, r).current().subscribeCmafTrack(c));
|
|
8295
8300
|
}
|
|
8296
8301
|
})();
|
|
8297
8302
|
}
|
|
8298
8303
|
//#endregion
|
|
8304
|
+
//#region ../../libs/web-sdk/src/modules/SubscriptionModule.ts
|
|
8305
|
+
var Ev, Dv = (e) => JSON.parse(JSON.stringify(e)), Ov = [
|
|
8306
|
+
"burstMs",
|
|
8307
|
+
"meta",
|
|
8308
|
+
"initiator",
|
|
8309
|
+
"channelGroupId"
|
|
8310
|
+
], kv = (e, t) => Et(Jt(e, Ov), Jt(t, Ov)), Av = 1e4, jv = class {
|
|
8311
|
+
constructor(t, n, r) {
|
|
8312
|
+
e(this, "logger", void 0), e(this, "timers", new D()), e(this, "emitter", void 0), e(this, "targetSubscription", void 0), e(this, "currentSubscription", void 0), e(this, "_isSwitchingSubscription", !1), e(this, "pendingSubscriptionTimeoutId", void 0), e(this, "channelSwitchTimeout", void 0), e(this, "requestedSubscription", void 0), e(this, "burstMs", 0), e(this, "unload", () => {
|
|
8313
|
+
this.logger.debug("Unloading module..."), this.timers.unload(), this.emitter.off("subscription changed", this.onSubscriptionChanged), this.logger.debug("Unloaded module");
|
|
8314
|
+
}), e(this, "isSwitchingSubscription", () => this._isSwitchingSubscription), e(this, "getTargetSubscription", () => this.targetSubscription), e(this, "getCurrentSubscription", () => this.currentSubscription), e(this, "enableBurst", (e) => {
|
|
8315
|
+
this.burstMs = e;
|
|
8316
|
+
}), e(this, "setSize", (e) => {
|
|
8317
|
+
this.targetSubscription.video.width = e.width, this.targetSubscription.video.height = e.height, this.scheduleSubscriptionChange();
|
|
8318
|
+
}), e(this, "setVideoConstraint", (e) => {
|
|
8319
|
+
this.targetSubscription.video = e, this.scheduleSubscriptionChange();
|
|
8320
|
+
}), e(this, "setAudioConstraint", (e) => {
|
|
8321
|
+
this.targetSubscription.audio = e, this.scheduleSubscriptionChange();
|
|
8322
|
+
}), e(this, "setVideoBitRate", (e) => {
|
|
8323
|
+
this.targetSubscription.video.bitRate = e, this.scheduleSubscriptionChange();
|
|
8324
|
+
}), e(this, "setAudioBitRate", (e) => {
|
|
8325
|
+
this.targetSubscription.audio.bitRate = e, this.scheduleSubscriptionChange();
|
|
8326
|
+
}), e(this, "setChannelId", (e) => {
|
|
8327
|
+
this.targetSubscription.channelId = e, this.scheduleSubscriptionChange();
|
|
8328
|
+
}), e(this, "setLanguage", (e) => {
|
|
8329
|
+
this.targetSubscription.audio.language = e, this.scheduleSubscriptionChange();
|
|
8330
|
+
}), e(this, "setVideoCodec", (e) => {
|
|
8331
|
+
this.targetSubscription.video.codec = e, this.scheduleSubscriptionChange();
|
|
8332
|
+
}), e(this, "setAudioCodec", (e) => {
|
|
8333
|
+
this.targetSubscription.audio.codec = e, this.scheduleSubscriptionChange();
|
|
8334
|
+
}), e(this, "setBurst", (e) => {
|
|
8335
|
+
e ? this.targetSubscription.burstMs = e : delete this.targetSubscription.burstMs;
|
|
8336
|
+
}), e(this, "isNewSubscription", () => !kv(this.currentSubscription, this.targetSubscription)), e(this, "isRequestOutdated", () => this.requestedSubscription !== void 0 && !kv(this.requestedSubscription, this.targetSubscription)), e(this, "onSubscriptionChanged", ({ to: e, reset: t }) => {
|
|
8337
|
+
var n;
|
|
8338
|
+
this.logger.debug("onSubscriptionChanged", {
|
|
8339
|
+
to: e,
|
|
8340
|
+
reset: t
|
|
8341
|
+
}), t ? (this.targetSubscription = Dv(this.currentSubscription), this.requestedSubscription = void 0) : (this.currentSubscription = Dv(e), this.requestedSubscription && (kv(this.requestedSubscription, e) || kv(this.targetSubscription, e)) && (this.requestedSubscription = void 0)), (t || ((n = this.channelSwitchTimeout) == null ? void 0 : n.channelId) === this.currentSubscription.channelId) && this.clearChannelSwitchTimeout(), this.requestedSubscription && e.initiator !== "edge" && this.armChannelSwitchDeadline(), this._isSwitchingSubscription = this.isSwitching();
|
|
8342
|
+
}), e(this, "armChannelSwitchDeadline", () => {
|
|
8343
|
+
let e = this.targetSubscription.channelId;
|
|
8344
|
+
this.channelSwitchTimeout || this.currentSubscription.channelId === e || (this.channelSwitchTimeout = {
|
|
8345
|
+
id: this.timers.setTimeout(() => {
|
|
8346
|
+
this.channelSwitchTimeout = void 0, this.logger.warn("Channel switch timeout", e);
|
|
8347
|
+
let { video: t, audio: n } = this.targetSubscription;
|
|
8348
|
+
this.targetSubscription = Dv(this.currentSubscription), this.targetSubscription.video.bitRate = Math.min(this.targetSubscription.video.bitRate, t.bitRate), this.targetSubscription.video.width = Math.min(this.targetSubscription.video.width, t.width), this.targetSubscription.video.height = Math.min(this.targetSubscription.video.height, t.height), this.targetSubscription.audio.bitRate = Math.min(this.targetSubscription.audio.bitRate, n.bitRate), this.setBurst(0), this.emitter.emit("channel switch timeout", e), this._isSwitchingSubscription = this.isSwitching(), this.isRequestOutdated() && this.sendTargetSubscription();
|
|
8349
|
+
}, Av),
|
|
8350
|
+
channelId: e
|
|
8351
|
+
});
|
|
8352
|
+
}), e(this, "clearChannelSwitchTimeout", () => {
|
|
8353
|
+
this.channelSwitchTimeout && (this.timers.clearTimeout(this.channelSwitchTimeout.id), this.channelSwitchTimeout = void 0);
|
|
8354
|
+
}), e(this, "isSwitching", () => this.isNewSubscription() || this.isRequestOutdated()), e(this, "scheduleSubscriptionChange", () => {
|
|
8355
|
+
this.targetSubscription = Dv(this.targetSubscription);
|
|
8356
|
+
let e = this.isSwitching();
|
|
8357
|
+
this._isSwitchingSubscription = e || this._isSwitchingSubscription && this.requestedSubscription !== void 0;
|
|
8358
|
+
let t = this.targetSubscription.channelId, n = this.currentSubscription.channelId !== t;
|
|
8359
|
+
this.channelSwitchTimeout && this.channelSwitchTimeout.channelId !== t && this.clearChannelSwitchTimeout(), e && (n && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), this.armChannelSwitchDeadline(), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(this.sendTargetSubscription, 0));
|
|
8360
|
+
}), e(this, "sendTargetSubscription", () => {
|
|
8361
|
+
this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0);
|
|
8362
|
+
let e = Dv(this.targetSubscription);
|
|
8363
|
+
this.requestedSubscription = e, this.armChannelSwitchDeadline(), this.emitter.emit("send signal", {
|
|
8364
|
+
type: "subscribe",
|
|
8365
|
+
subscription: e
|
|
8366
|
+
});
|
|
8367
|
+
}), this.logger = t, this.targetSubscription = n, this.currentSubscription = Dv(n), this.emitter = r, this.emitter.on("subscription changed", this.onSubscriptionChanged);
|
|
8368
|
+
}
|
|
8369
|
+
};
|
|
8370
|
+
Ev = jv, e(jv, "create", (e, t, n) => new Ev(e, n, t));
|
|
8371
|
+
//#endregion
|
|
8299
8372
|
//#region ../../libs/web-sdk/src/resolveEdgeUrl.ts
|
|
8300
|
-
var
|
|
8373
|
+
var Mv = (e, t) => {
|
|
8301
8374
|
var n, r;
|
|
8302
8375
|
let i = new URL("/subscribe", e);
|
|
8303
8376
|
return i.searchParams.append("channelId", t.channelId), i.searchParams.append("sessionId", t.sessionId), i.searchParams.append("clientId", t.clientId), (n = t.audio) != null && n.codec && (i.searchParams.append("audio.bitRate", Math.round(t.audio.bitRate).toString()), i.searchParams.append("audio.codec", t.audio.codec), t.audio.language && i.searchParams.append("audio.language", t.audio.language)), (r = t.video) != null && r.codec && (i.searchParams.append("video.width", t.video.width.toString()), i.searchParams.append("video.height", t.video.height.toString()), i.searchParams.append("video.bitRate", Math.round(t.video.bitRate).toString()), i.searchParams.append("video.codec", t.video.codec)), t.burstMs && i.searchParams.append("burstMs", t.burstMs.toString()), t.channelGroupId && i.searchParams.append("channelGroupId", t.channelGroupId), t.authToken && (i.searchParams.append("auth.token", t.authToken), i.searchParams.append("auth.type", "jwt")), i.toString();
|
|
8304
|
-
},
|
|
8377
|
+
}, Nv = (e) => {
|
|
8305
8378
|
try {
|
|
8306
8379
|
return e ? new URL(e).origin : void 0;
|
|
8307
8380
|
} catch (e) {
|
|
8308
8381
|
return;
|
|
8309
8382
|
}
|
|
8383
|
+
}, Pv = 3e5, Fv = 3, Iv = 1e4, Lv = 1e3, Rv = 250, zv = 200, Bv = /* @__PURE__ */ new WeakMap(), Vv = /* @__PURE__ */ new WeakMap(), Hv = /* @__PURE__ */ new WeakMap(), Uv = /* @__PURE__ */ new WeakMap(), Wv = /* @__PURE__ */ new WeakMap(), Gv = /* @__PURE__ */ new WeakMap(), Kv = /* @__PURE__ */ new WeakMap(), qv = /* @__PURE__ */ new WeakMap(), Jv = /* @__PURE__ */ new WeakSet(), Yv = class {
|
|
8384
|
+
constructor(e = () => performance.timeOrigin + performance.now()) {
|
|
8385
|
+
x(this, Jv), i(this, Bv, void 0), i(this, Vv, []), i(this, Hv, 0), i(this, Uv, void 0), i(this, Wv, void 0), i(this, Gv, void 0), i(this, Kv, 0), i(this, qv, []), a(Bv, this, e);
|
|
8386
|
+
}
|
|
8387
|
+
sample(e, t) {
|
|
8388
|
+
var n;
|
|
8389
|
+
if (!Number.isFinite(e) || !Number.isFinite(t)) return;
|
|
8390
|
+
let r = t - e;
|
|
8391
|
+
if (s(Uv, this) !== void 0) {
|
|
8392
|
+
var i, c;
|
|
8393
|
+
let t = e - s(Uv, this), n = s(qv, this).length >= 2 && r < o(Jv, this, Xv).call(this) - Lv && t > ((i = ey(s(qv, this))) == null ? 0 : i) + Lv, l = ey(s(qv, this)), u = l === void 0 ? 0 : l - t;
|
|
8394
|
+
t < -Lv || u > Lv && r - ((c = s(Gv, this)) == null ? r : c) > u - Rv || n ? (a(Vv, this, []), a(Hv, this, 0), a(qv, this, [])) : t >= zv && a(qv, this, [...s(qv, this).slice(-4), t]);
|
|
8395
|
+
}
|
|
8396
|
+
a(Uv, this, e), a(Wv, this, t), a(Gv, this, r), a(Hv, this, (n = s(Hv, this), n++, n)), a(Vv, this, s(Vv, this).filter((e) => e.arrivedAt > t - Pv)), s(Vv, this).push({
|
|
8397
|
+
arrivedAt: t,
|
|
8398
|
+
delay: r
|
|
8399
|
+
}), a(Kv, this, r - o(Jv, this, Xv).call(this));
|
|
8400
|
+
}
|
|
8401
|
+
level(e = s(Bv, this).call(this)) {
|
|
8402
|
+
if (s(Hv, this) < Fv || s(Wv, this) === void 0) return;
|
|
8403
|
+
let t = o(Jv, this, Zv).call(this, e);
|
|
8404
|
+
if (!(t <= 0 && e - s(Wv, this) > Iv)) return Math.max(s(Kv, this), t);
|
|
8405
|
+
}
|
|
8406
|
+
peak(e, t = s(Bv, this).call(this)) {
|
|
8407
|
+
var n;
|
|
8408
|
+
return (n = this.summary(e, t)) == null ? void 0 : n.max;
|
|
8409
|
+
}
|
|
8410
|
+
summary(e, t = s(Bv, this).call(this)) {
|
|
8411
|
+
let n = this.level(t);
|
|
8412
|
+
if (n === void 0) return;
|
|
8413
|
+
let r = o(Jv, this, Xv).call(this);
|
|
8414
|
+
return xt([...s(Vv, this).filter((n) => n.arrivedAt >= t - e).map((e) => e.delay - r), n]);
|
|
8415
|
+
}
|
|
8416
|
+
};
|
|
8417
|
+
function Xv() {
|
|
8418
|
+
return s(Vv, this).reduce((e, t) => Math.min(e, t.delay), Infinity);
|
|
8419
|
+
}
|
|
8420
|
+
function Zv(e) {
|
|
8421
|
+
let t = ey(s(qv, this));
|
|
8422
|
+
return t === void 0 || s(Wv, this) === void 0 ? 0 : e - (s(Wv, this) - s(Kv, this) + t);
|
|
8423
|
+
}
|
|
8424
|
+
var Qv = 3e3, $v = (e, t) => {
|
|
8425
|
+
let n = t.summary(Qv);
|
|
8426
|
+
n !== void 0 && e.debug("Link queue", {
|
|
8427
|
+
levelMs: Math.round(n.last),
|
|
8428
|
+
peak3sMs: Math.round(n.max)
|
|
8429
|
+
});
|
|
8430
|
+
}, ey = (e) => {
|
|
8431
|
+
if (e.length === 0) return;
|
|
8432
|
+
let t = [...e].sort((e, t) => e - t);
|
|
8433
|
+
return t[Math.floor(t.length / 2)];
|
|
8310
8434
|
};
|
|
8311
8435
|
//#endregion
|
|
8312
8436
|
//#region ../../libs/web-sdk/src/adapters/MoqConnectionAdapter.ts
|
|
8313
|
-
function
|
|
8437
|
+
function ty(e, t, n) {
|
|
8314
8438
|
let r = new URL("/voq/subscribe", e);
|
|
8315
8439
|
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;
|
|
8316
8440
|
}
|
|
8317
|
-
function
|
|
8441
|
+
function ny(e, t) {
|
|
8318
8442
|
let n = [];
|
|
8319
8443
|
for (let r of e == null ? [] : e) try {
|
|
8320
8444
|
n.push({
|
|
@@ -8329,73 +8453,80 @@ function Ov(e, t) {
|
|
|
8329
8453
|
}
|
|
8330
8454
|
return n.length > 0 ? n : void 0;
|
|
8331
8455
|
}
|
|
8332
|
-
function
|
|
8456
|
+
function ry(e, t, n) {
|
|
8333
8457
|
return n !== void 0 && e.get("webtransportEnabled") && !e.get("unstableWebtransportEnabled") && !!self.WebTransport && t.protocol.startsWith("https") && Le();
|
|
8334
8458
|
}
|
|
8335
|
-
var
|
|
8459
|
+
var iy = 1e4, ay = 5e3, oy = 500, Z = /* @__PURE__ */ new WeakMap(), sy = /* @__PURE__ */ new WeakMap(), cy = /* @__PURE__ */ new WeakMap(), ly = /* @__PURE__ */ new WeakMap(), Q = /* @__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 WeakMap(), gy = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakSet(), _y = /* @__PURE__ */ new WeakMap(), vy = /* @__PURE__ */ new WeakMap(), yy = /* @__PURE__ */ new WeakMap(), by = /* @__PURE__ */ new WeakMap(), xy = /* @__PURE__ */ new WeakMap(), Sy = /* @__PURE__ */ new WeakMap(), Cy = class r {
|
|
8336
8460
|
get estimatedBandwidth() {
|
|
8337
|
-
return s(
|
|
8461
|
+
return s(py, this);
|
|
8338
8462
|
}
|
|
8339
8463
|
unload() {
|
|
8340
|
-
s(
|
|
8464
|
+
s(Z, this).off("send signal", s(vy, this)), s(Z, this).off("disconnect", this.disconnect), s(Z, this).off("text track", s(_y, this)), this.disconnect();
|
|
8341
8465
|
}
|
|
8342
8466
|
suspend() {}
|
|
8343
8467
|
unsuspend() {}
|
|
8344
8468
|
getStatistics() {
|
|
8345
|
-
let e = s(
|
|
8469
|
+
let e = s(cy, this).transportType() === "webtransport" ? "moq" : "moq_ws";
|
|
8346
8470
|
return {
|
|
8347
|
-
edgeUrl:
|
|
8471
|
+
edgeUrl: Nv(s(cy, this).url()),
|
|
8348
8472
|
connectionProtocol: e,
|
|
8349
|
-
transportSelectionReason: s(
|
|
8473
|
+
transportSelectionReason: s(my, this)
|
|
8350
8474
|
};
|
|
8351
8475
|
}
|
|
8352
|
-
constructor(t, r, c, l, u, d, f, p) {
|
|
8353
|
-
x(this,
|
|
8476
|
+
constructor(t, r, c, l, u, d, f, p, h) {
|
|
8477
|
+
x(this, $), i(this, Z, void 0), i(this, sy, void 0), i(this, cy, void 0), i(this, ly, "disconnected"), i(this, Q, void 0), i(this, uy, /* @__PURE__ */ new Map()), i(this, dy, void 0), i(this, fy, void 0), i(this, py, void 0), i(this, my, void 0), i(this, hy, /* @__PURE__ */ new Map()), e(this, "linkQueue", void 0), i(this, gy, void 0), e(this, "closedForBacklog", !1), i(this, _y, (e) => {
|
|
8354
8478
|
if (!e) {
|
|
8355
|
-
s(
|
|
8479
|
+
s(Q, this).setSubtitleTrack(void 0).catch(n);
|
|
8356
8480
|
return;
|
|
8357
8481
|
}
|
|
8358
|
-
let t = s(
|
|
8359
|
-
r && s(
|
|
8360
|
-
}), i(this,
|
|
8482
|
+
let t = s(uy, this).get(Dh(s(Q, this).namespace())), r = t == null ? void 0 : t.getTextTrack(e);
|
|
8483
|
+
r && s(Q, this).setSubtitleTrack(r).catch(n);
|
|
8484
|
+
}), i(this, vy, (e) => {
|
|
8361
8485
|
switch (e.type) {
|
|
8362
8486
|
case "subscribe":
|
|
8363
|
-
|
|
8364
|
-
s(
|
|
8365
|
-
|
|
8487
|
+
{
|
|
8488
|
+
if (s(yy, this)) return;
|
|
8489
|
+
let t = s(xy, this);
|
|
8490
|
+
if (t) {
|
|
8491
|
+
if (kv(t, e.subscription)) {
|
|
8492
|
+
a(by, this, void 0);
|
|
8493
|
+
return;
|
|
8494
|
+
}
|
|
8495
|
+
s(sy, this).info("Queueing - we are already switching"), a(by, this, e.subscription);
|
|
8496
|
+
return;
|
|
8497
|
+
}
|
|
8498
|
+
o($, this, Ey).call(this, e.subscription);
|
|
8366
8499
|
}
|
|
8367
|
-
a(Uv, this, !0), o(Bv, this, qv).call(this, e.subscription).catch((t) => {
|
|
8368
|
-
s(jv, this).error("error handling subscription", t), s(Q, this).emit("received signal", {
|
|
8369
|
-
type: "subscription changed",
|
|
8370
|
-
subscription: e.subscription,
|
|
8371
|
-
reset: !0
|
|
8372
|
-
});
|
|
8373
|
-
}).finally(() => a(Uv, this, !1));
|
|
8374
8500
|
break;
|
|
8375
8501
|
case "telemetry":
|
|
8376
|
-
m(new URL("/api/telemetry", s(
|
|
8502
|
+
m(new URL("/api/telemetry", s(cy, this).url().replace("wss://", "https://")), {
|
|
8377
8503
|
body: e.body,
|
|
8378
8504
|
headers: { "Content-Type": "text/plain" }
|
|
8379
8505
|
}).catch(n);
|
|
8380
8506
|
break;
|
|
8381
8507
|
case "refresh auth":
|
|
8382
|
-
s(
|
|
8508
|
+
s(cy, this).updateAuthToken(e.token);
|
|
8383
8509
|
break;
|
|
8384
8510
|
}
|
|
8385
|
-
}), i(this,
|
|
8386
|
-
s(
|
|
8387
|
-
}),
|
|
8511
|
+
}), i(this, yy, !1), i(this, by, void 0), i(this, xy, void 0), e(this, "disconnect", (e = "Disconnect Requested") => {
|
|
8512
|
+
s(sy, this).info("Disconnecting", e), o($, this, ky).call(this), o($, this, Ty).call(this), s(cy, this).close(), s(Q, this).close().catch(n), a(hy, this, /* @__PURE__ */ new Map()), o($, this, Ay).call(this, "disconnected");
|
|
8513
|
+
}), i(this, Sy, () => {
|
|
8514
|
+
var e;
|
|
8515
|
+
if (s(gy, this) === void 0 || s(ly, this) !== "connected") return;
|
|
8516
|
+
let t = (e = this.linkQueue) == null ? void 0 : e.level();
|
|
8517
|
+
t === void 0 || t <= ay || (o($, this, ky).call(this), o($, this, Ty).call(this), this.closedForBacklog = !0, s(sy, this).info("Link queue over the breaker, reconnecting", { levelMs: Math.round(t) }), s(cy, this).close(), s(Z, this).emit("ping timeout"));
|
|
8518
|
+
}), a(Z, this, t), a(sy, this, r), a(cy, this, c), a(Q, this, l), a(uy, this, u), a(dy, this, d), a(fy, this, f), a(my, this, p), this.linkQueue = h, s(Z, this).on("send signal", s(vy, this)), s(Z, this).on("disconnect", this.disconnect), s(Z, this).on("text track", s(_y, this)), o($, this, wy).call(this).catch(n), o($, this, jy).call(this).catch(n), h && a(gy, this, setInterval(s(Sy, this), oy));
|
|
8388
8519
|
}
|
|
8389
8520
|
static start(e, n, i, a, o) {
|
|
8390
8521
|
return t(function* () {
|
|
8391
8522
|
var t, c, l, u;
|
|
8392
|
-
let f = new Map(a.connectInfo.channels.map((e) => [Dh(e.catalog.namespace), new
|
|
8523
|
+
let f = new Map(a.connectInfo.channels.map((e) => [Dh(e.catalog.namespace), new Ry(new Kt(e.catalog))])), p = yield a.onConnectInfo(a.connectInfo), m = a.options.get("authenticationToken"), h, g, ee;
|
|
8393
8524
|
switch (typeof a.edgeUrl) {
|
|
8394
8525
|
case "string":
|
|
8395
|
-
h =
|
|
8526
|
+
h = ty(a.edgeUrl, p, m);
|
|
8396
8527
|
break;
|
|
8397
8528
|
default:
|
|
8398
|
-
h =
|
|
8529
|
+
h = ty(a.edgeUrl.moqUrl || a.edgeUrl.moqWsUrl, p, m), g = ty(a.edgeUrl.moqWsUrl, p, m), ee = ny(a.edgeUrl.serverCertificateHashes, n);
|
|
8399
8530
|
break;
|
|
8400
8531
|
}
|
|
8401
8532
|
let _ = (t = a.connectInfo.channels.find((e) => e.channelId === p.channelId)) == null ? void 0 : t.catalog;
|
|
@@ -8403,7 +8534,7 @@ var Av = 1e4, Q = /* @__PURE__ */ new WeakMap(), jv = /* @__PURE__ */ new WeakMa
|
|
|
8403
8534
|
edgeUrl: h,
|
|
8404
8535
|
edgeWsUrl: g
|
|
8405
8536
|
}), d(_, "no catalog found");
|
|
8406
|
-
let te = (c = f.get(Dh(_.namespace))) == null ? void 0 : c.getVideoTrack(p.video), v = (l = f.get(Dh(_.namespace))) == null ? void 0 : l.getAudioTrack(p.audio), ne =
|
|
8537
|
+
let te = (c = f.get(Dh(_.namespace))) == null ? void 0 : c.getVideoTrack(p.video), v = (l = f.get(Dh(_.namespace))) == null ? void 0 : l.getAudioTrack(p.audio), ne = ry(a.options, h, g), re;
|
|
8407
8538
|
try {
|
|
8408
8539
|
re = yield yh({
|
|
8409
8540
|
url: h,
|
|
@@ -8422,54 +8553,57 @@ var Av = 1e4, Q = /* @__PURE__ */ new WeakMap(), jv = /* @__PURE__ */ new WeakMa
|
|
|
8422
8553
|
(u = a.onTransportConnected) == null || u.call(a);
|
|
8423
8554
|
let ie = y.closed().then((e) => {
|
|
8424
8555
|
throw e instanceof Error ? e : Error(e ? `Session closed before player started: ${String(e)}` : "Session closed before player started");
|
|
8425
|
-
}), ae;
|
|
8556
|
+
}), ae = y.transportType() === "websocket" ? new Yv() : void 0, x, oe;
|
|
8426
8557
|
try {
|
|
8427
|
-
|
|
8428
|
-
|
|
8558
|
+
oe = yield Promise.race([
|
|
8559
|
+
yv.start(y.subscriber, {
|
|
8429
8560
|
namespace: _.namespace,
|
|
8430
8561
|
catalog: _,
|
|
8431
8562
|
videoTrack: te == null ? void 0 : te.track,
|
|
8432
8563
|
audioTrack: v == null ? void 0 : v.track,
|
|
8433
|
-
burstMs: p.burstMs || 0
|
|
8564
|
+
burstMs: p.burstMs || 0,
|
|
8565
|
+
onStats: ae && ((e, t) => {
|
|
8566
|
+
ae.sample(e.ntpTimestamp, performance.timeOrigin + t), $v(n, ae), x == null || x();
|
|
8567
|
+
})
|
|
8434
8568
|
}),
|
|
8435
|
-
dn(
|
|
8569
|
+
dn(iy, /* @__PURE__ */ Error("Timeout waiting for player to start")),
|
|
8436
8570
|
ie
|
|
8437
8571
|
]);
|
|
8438
8572
|
} catch (e) {
|
|
8439
8573
|
throw y.close(), e;
|
|
8440
8574
|
}
|
|
8441
|
-
let
|
|
8442
|
-
f.set(Dh(_.namespace),
|
|
8575
|
+
let S = new Ry(oe.catalog());
|
|
8576
|
+
f.set(Dh(_.namespace), S), e.emit("received signal", {
|
|
8443
8577
|
type: "client ip",
|
|
8444
|
-
ip:
|
|
8445
|
-
}),
|
|
8578
|
+
ip: oe.connectionInfo().ip
|
|
8579
|
+
}), oe.drm().then((t) => {
|
|
8446
8580
|
t && e.emit("received drm data", t.value);
|
|
8447
8581
|
}).catch((e) => {
|
|
8448
8582
|
n.error("Error getting DRM data", e);
|
|
8449
8583
|
});
|
|
8450
|
-
let
|
|
8451
|
-
return p.textTrack && s(
|
|
8584
|
+
let se = new r(e, n, y, oe, f, i, o, b, ae);
|
|
8585
|
+
return x = s(Sy, se), p.textTrack && s(_y, se).call(se, p.textTrack), se;
|
|
8452
8586
|
})();
|
|
8453
8587
|
}
|
|
8454
8588
|
getState() {
|
|
8455
|
-
return s(
|
|
8589
|
+
return s(ly, this);
|
|
8456
8590
|
}
|
|
8457
8591
|
close() {
|
|
8458
|
-
s(
|
|
8592
|
+
o($, this, ky).call(this), o($, this, Ty).call(this), s(cy, this).close();
|
|
8459
8593
|
}
|
|
8460
8594
|
closed() {
|
|
8461
|
-
return Promise.race([s(
|
|
8595
|
+
return Promise.race([s(cy, this).closed(), s(Q, this).closed()]);
|
|
8462
8596
|
}
|
|
8463
8597
|
};
|
|
8464
|
-
function
|
|
8598
|
+
function wy() {
|
|
8465
8599
|
var e = this;
|
|
8466
8600
|
return t(function* () {
|
|
8467
|
-
s(
|
|
8601
|
+
s(cy, e).transportType() === "websocket" && (yield un(5e3));
|
|
8468
8602
|
var t = !1, n = !1, r;
|
|
8469
8603
|
try {
|
|
8470
|
-
for (var i = B(s(
|
|
8604
|
+
for (var i = B(s(Q, e).stats()), o; t = !(o = yield i.next()).done; t = !1) {
|
|
8471
8605
|
let { rtt: t, estimatedBandwidth: n } = o.value;
|
|
8472
|
-
a(
|
|
8606
|
+
a(py, e, n), s(fy, e).push(t), s(Z, e).emit("rtt", vt(s(fy, e).items()));
|
|
8473
8607
|
}
|
|
8474
8608
|
} catch (e) {
|
|
8475
8609
|
n = !0, r = e;
|
|
@@ -8482,76 +8616,99 @@ function Gv() {
|
|
|
8482
8616
|
}
|
|
8483
8617
|
})();
|
|
8484
8618
|
}
|
|
8485
|
-
function
|
|
8619
|
+
function Ty() {
|
|
8620
|
+
a(yy, this, !0), a(by, this, void 0);
|
|
8621
|
+
}
|
|
8622
|
+
function Ey(e) {
|
|
8623
|
+
a(xy, this, e), o($, this, Oy).call(this, e).catch((t) => {
|
|
8624
|
+
if (this.closedForBacklog) return;
|
|
8625
|
+
s(sy, this).error("error handling subscription", t);
|
|
8626
|
+
let n = s(by, this);
|
|
8627
|
+
a(by, this, void 0), s(Z, this).emit("received signal", {
|
|
8628
|
+
type: "subscription changed",
|
|
8629
|
+
subscription: n == null ? e : n,
|
|
8630
|
+
reset: !0
|
|
8631
|
+
});
|
|
8632
|
+
}).finally(() => {
|
|
8633
|
+
a(xy, this, void 0);
|
|
8634
|
+
let e = s(by, this);
|
|
8635
|
+
a(by, this, void 0), e && !s(yy, this) && o($, this, Ey).call(this, e);
|
|
8636
|
+
});
|
|
8637
|
+
}
|
|
8638
|
+
function Dy(e) {
|
|
8486
8639
|
var n = this;
|
|
8487
8640
|
return t(function* () {
|
|
8488
8641
|
var t;
|
|
8489
|
-
let r = yield s(
|
|
8642
|
+
let r = yield s(dy, n).connect({ channelId: e });
|
|
8490
8643
|
if (!c(r)) throw Error("no moq connect info found");
|
|
8491
8644
|
let i = (t = r.channels.find((t) => t.channelId === e)) == null ? void 0 : t.catalog;
|
|
8492
8645
|
if (!i) throw Error("no catalog found");
|
|
8493
8646
|
return i;
|
|
8494
8647
|
})();
|
|
8495
8648
|
}
|
|
8496
|
-
function
|
|
8649
|
+
function Oy(e) {
|
|
8497
8650
|
var n = this;
|
|
8498
8651
|
return t(function* () {
|
|
8499
8652
|
var t, r;
|
|
8500
|
-
s(
|
|
8501
|
-
let i = s(
|
|
8502
|
-
if (a || (a = new
|
|
8653
|
+
s(sy, n).info("handle subscription", e);
|
|
8654
|
+
let i = s(Q, n), a = s(uy, n).get(e.channelId);
|
|
8655
|
+
if (a || (a = new Ry(new Kt(yield o($, n, Dy).call(n, e.channelId))), s(uy, n).set(e.channelId, a)), i.namespace().join("/") !== a.namespace().join("/")) {
|
|
8503
8656
|
var c;
|
|
8504
|
-
s(
|
|
8657
|
+
s(sy, n).info("changing channel", e.channelId);
|
|
8505
8658
|
let t = a.getVideoTrack(e.video), r = a.getAudioTrack(e.audio);
|
|
8506
|
-
yield i.zap({
|
|
8659
|
+
if (yield i.zap({
|
|
8507
8660
|
namespace: a.namespace(),
|
|
8508
8661
|
catalog: a.catalog(),
|
|
8509
8662
|
videoTrack: t == null ? void 0 : t.track,
|
|
8510
8663
|
audioTrack: r == null ? void 0 : r.track
|
|
8511
8664
|
}, 500), i.drm().then((e) => {
|
|
8512
|
-
e && s(
|
|
8665
|
+
e && s(Z, n).emit("received drm data", e.value);
|
|
8513
8666
|
}).catch((e) => {
|
|
8514
|
-
s(
|
|
8515
|
-
}), s(
|
|
8667
|
+
s(sy, n).error("Error getting DRM data", e);
|
|
8668
|
+
}), s(sy, n).info("switched channel", e.channelId), (c = s(uy, n).get(Dh(i.namespace()))) == null || c.updateCatalog(i.catalog()), s(yy, n)) return;
|
|
8669
|
+
s(Z, n).emit("received signal", {
|
|
8516
8670
|
type: "subscription changed",
|
|
8517
8671
|
subscription: e
|
|
8518
8672
|
});
|
|
8519
8673
|
return;
|
|
8520
8674
|
}
|
|
8521
8675
|
let l = a.getVideoTrack(e.video), u = a.getAudioTrack(e.audio);
|
|
8522
|
-
yield Promise.all([l && l.track.name !== ((t = s(
|
|
8676
|
+
yield Promise.all([l && l.track.name !== ((t = s(Q, n).videoTrack()) == null ? void 0 : t.name) ? s(Q, n).setVideoTrack(l.track) : void 0, u && u.track.name !== ((r = s(Q, n).audioTrack()) == null ? void 0 : r.name) ? s(Q, n).setAudioTrack(u.track) : void 0]), !s(yy, n) && s(Z, n).emit("received signal", {
|
|
8523
8677
|
type: "subscription changed",
|
|
8524
8678
|
subscription: e
|
|
8525
8679
|
});
|
|
8526
8680
|
})();
|
|
8527
8681
|
}
|
|
8528
|
-
function
|
|
8529
|
-
|
|
8682
|
+
function ky() {
|
|
8683
|
+
clearInterval(s(gy, this)), a(gy, this, void 0);
|
|
8684
|
+
}
|
|
8685
|
+
function Ay(e) {
|
|
8686
|
+
a(ly, this, e), s(Z, this).emit("connection state", e);
|
|
8530
8687
|
}
|
|
8531
|
-
function
|
|
8688
|
+
function jy() {
|
|
8532
8689
|
var e = this;
|
|
8533
8690
|
return t(function* () {
|
|
8534
8691
|
try {
|
|
8535
|
-
o(
|
|
8536
|
-
o(
|
|
8537
|
-
o(
|
|
8538
|
-
o(
|
|
8539
|
-
]), yield s(
|
|
8692
|
+
o($, e, Ay).call(e, "connecting"), s(sy, e).info("Connecting..."), o($, e, Ay).call(e, "connected"), yield Promise.all([
|
|
8693
|
+
o($, e, Ny).call(e, s(Q, e).referenceClock(), s(Q, e).audio),
|
|
8694
|
+
o($, e, Ny).call(e, s(Q, e).referenceClock(), s(Q, e).video),
|
|
8695
|
+
o($, e, My).call(e, s(Q, e).subtitles)
|
|
8696
|
+
]), yield s(Q, e).closed(), s(cy, e).close(), s(sy, e).info("Session closed");
|
|
8540
8697
|
} catch (t) {
|
|
8541
|
-
s(
|
|
8698
|
+
s(sy, e).warn("Session error", t), s(cy, e).close();
|
|
8542
8699
|
} finally {
|
|
8543
|
-
o(
|
|
8700
|
+
o($, e, Ay).call(e, "disconnected");
|
|
8544
8701
|
}
|
|
8545
8702
|
})();
|
|
8546
8703
|
}
|
|
8547
|
-
function
|
|
8704
|
+
function My(e) {
|
|
8548
8705
|
var n = this;
|
|
8549
8706
|
return t(function* () {
|
|
8550
8707
|
var t = !1, r = !1, i;
|
|
8551
8708
|
try {
|
|
8552
8709
|
for (var a = B(e), o; t = !(o = yield a.next()).done; t = !1) {
|
|
8553
8710
|
let e = o.value;
|
|
8554
|
-
s(
|
|
8711
|
+
s(Z, n).emit("text track data", e);
|
|
8555
8712
|
}
|
|
8556
8713
|
} catch (e) {
|
|
8557
8714
|
r = !0, i = e;
|
|
@@ -8564,10 +8721,10 @@ function Xv(e) {
|
|
|
8564
8721
|
}
|
|
8565
8722
|
})();
|
|
8566
8723
|
}
|
|
8567
|
-
function
|
|
8724
|
+
function Ny(e, n) {
|
|
8568
8725
|
var r = this;
|
|
8569
8726
|
return t(function* () {
|
|
8570
|
-
let t = "", i = "", a, o = s(
|
|
8727
|
+
let t = "", i = "", a, o = s(Q, r).videoTrack() === void 0;
|
|
8571
8728
|
var c = !1, l = !1, u;
|
|
8572
8729
|
try {
|
|
8573
8730
|
for (var d = B(n), f; c = !(f = yield d.next()).done; c = !1) {
|
|
@@ -8589,18 +8746,18 @@ function Zv(e, n) {
|
|
|
8589
8746
|
drmTransition: a !== void 0 && a !== v
|
|
8590
8747
|
};
|
|
8591
8748
|
t = c, i = l, a = v;
|
|
8592
|
-
let g = m.producerReferenceTime(), ee = s(
|
|
8749
|
+
let g = m.producerReferenceTime(), ee = s(hy, r).get(n.track.namespace), _ = performance.now();
|
|
8593
8750
|
if (g && (ee === void 0 || _ - ee > 1e3)) {
|
|
8594
|
-
s(
|
|
8751
|
+
s(hy, r).set(n.track.namespace, _);
|
|
8595
8752
|
let t = e.wallclock() - g.getTime();
|
|
8596
|
-
s(
|
|
8753
|
+
s(sy, r).debug("timing-info", {
|
|
8597
8754
|
mediaType: m.mediaType(),
|
|
8598
8755
|
referenceClock: e,
|
|
8599
8756
|
delta: t,
|
|
8600
8757
|
groupId: p,
|
|
8601
8758
|
timestamp: m.baseMediaDecodeTime() / m.timescale() * 1e3 + t,
|
|
8602
8759
|
wallclockTime: g.getTime()
|
|
8603
|
-
}), s(
|
|
8760
|
+
}), s(Z, r).emit("received signal", {
|
|
8604
8761
|
type: "timing info",
|
|
8605
8762
|
timingInfo: {
|
|
8606
8763
|
channelId: c,
|
|
@@ -8609,7 +8766,7 @@ function Zv(e, n) {
|
|
|
8609
8766
|
}
|
|
8610
8767
|
});
|
|
8611
8768
|
}
|
|
8612
|
-
s(
|
|
8769
|
+
s(Z, r).emit("received moq data", {
|
|
8613
8770
|
payload: m,
|
|
8614
8771
|
channelId: c,
|
|
8615
8772
|
groupId: p,
|
|
@@ -8617,7 +8774,7 @@ function Zv(e, n) {
|
|
|
8617
8774
|
codec: u,
|
|
8618
8775
|
codecString: d,
|
|
8619
8776
|
switchInfo: h,
|
|
8620
|
-
renditionId:
|
|
8777
|
+
renditionId: Py(n.track.trackObject.name)
|
|
8621
8778
|
});
|
|
8622
8779
|
}
|
|
8623
8780
|
}
|
|
@@ -8643,48 +8800,48 @@ function Zv(e, n) {
|
|
|
8643
8800
|
}
|
|
8644
8801
|
})();
|
|
8645
8802
|
}
|
|
8646
|
-
function
|
|
8803
|
+
function Py(e) {
|
|
8647
8804
|
return e.split("").reduce((e, t) => e = t.charCodeAt(0) + (e << 6) + (e << 16) - e, 0);
|
|
8648
8805
|
}
|
|
8649
|
-
var
|
|
8806
|
+
var Fy = /* @__PURE__ */ new WeakMap(), Iy = /* @__PURE__ */ new WeakMap(), Ly = /* @__PURE__ */ new WeakSet(), Ry = class {
|
|
8650
8807
|
constructor(e) {
|
|
8651
|
-
x(this,
|
|
8808
|
+
x(this, Ly), i(this, Fy, void 0), i(this, Iy, void 0), a(Fy, this, e), a(Iy, this, o(Ly, this, zy).call(this));
|
|
8652
8809
|
}
|
|
8653
8810
|
catalog() {
|
|
8654
|
-
return s(
|
|
8811
|
+
return s(Fy, this).current();
|
|
8655
8812
|
}
|
|
8656
8813
|
namespace() {
|
|
8657
|
-
return s(
|
|
8814
|
+
return s(Fy, this).current().namespace;
|
|
8658
8815
|
}
|
|
8659
8816
|
updateCatalog(e) {
|
|
8660
|
-
a(
|
|
8817
|
+
a(Fy, this, e);
|
|
8661
8818
|
}
|
|
8662
8819
|
getTextTrack(e) {
|
|
8663
|
-
return s(
|
|
8820
|
+
return s(Fy, this).current().tracks.find((t) => t.label === e);
|
|
8664
8821
|
}
|
|
8665
8822
|
getAudioTrack(e) {
|
|
8666
8823
|
if (!e.codec) return;
|
|
8667
|
-
let t = s(
|
|
8824
|
+
let t = s(Iy, this).filter((t) => !(!pn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec || e.language && t.language !== e.language));
|
|
8668
8825
|
return t[t.length - 1];
|
|
8669
8826
|
}
|
|
8670
8827
|
getVideoTrack(e) {
|
|
8671
8828
|
if (!e.codec) return;
|
|
8672
|
-
let t = s(
|
|
8829
|
+
let t = s(Iy, this).filter((t) => !(!fn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec));
|
|
8673
8830
|
return t[t.length - 1];
|
|
8674
8831
|
}
|
|
8675
8832
|
renditions() {
|
|
8676
|
-
return s(
|
|
8833
|
+
return s(Iy, this);
|
|
8677
8834
|
}
|
|
8678
8835
|
};
|
|
8679
|
-
function
|
|
8680
|
-
let [e, t] = s(
|
|
8836
|
+
function zy() {
|
|
8837
|
+
let [e, t] = s(Fy, this).value();
|
|
8681
8838
|
return u(e);
|
|
8682
8839
|
}
|
|
8683
8840
|
//#endregion
|
|
8684
8841
|
//#region ../../libs/web-sdk/src/transports/WebSocket.ts
|
|
8685
|
-
var
|
|
8842
|
+
var By = /* @__PURE__ */ function(e) {
|
|
8686
8843
|
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;
|
|
8687
|
-
}({}),
|
|
8844
|
+
}({}), Vy = class extends ie {
|
|
8688
8845
|
constructor(r, i) {
|
|
8689
8846
|
var a;
|
|
8690
8847
|
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", () => {
|
|
@@ -8722,19 +8879,19 @@ var iy = /* @__PURE__ */ function(e) {
|
|
|
8722
8879
|
})), this.close("websocket was closed");
|
|
8723
8880
|
let n;
|
|
8724
8881
|
switch (e.code) {
|
|
8725
|
-
case
|
|
8882
|
+
case By.AuthenticationFailed:
|
|
8726
8883
|
n = Jn(qn());
|
|
8727
8884
|
break;
|
|
8728
|
-
case
|
|
8885
|
+
case By.AuthenticationRefreshFailed:
|
|
8729
8886
|
n = Jn(qn());
|
|
8730
8887
|
break;
|
|
8731
|
-
case
|
|
8888
|
+
case By.AuthenticationExpired:
|
|
8732
8889
|
n = Yn(qn());
|
|
8733
8890
|
break;
|
|
8734
|
-
case
|
|
8891
|
+
case By.ChannelNotFound:
|
|
8735
8892
|
n = Zn("internal", qn());
|
|
8736
8893
|
break;
|
|
8737
|
-
case
|
|
8894
|
+
case By.Inactivity:
|
|
8738
8895
|
n = Xn("internal", qn());
|
|
8739
8896
|
break;
|
|
8740
8897
|
default: t && (n = er(/* @__PURE__ */ Error("WebSocket closed before open")));
|
|
@@ -8785,13 +8942,13 @@ var iy = /* @__PURE__ */ function(e) {
|
|
|
8785
8942
|
get connectTime() {
|
|
8786
8943
|
return this._connectTime;
|
|
8787
8944
|
}
|
|
8788
|
-
},
|
|
8789
|
-
let t = e ||
|
|
8790
|
-
return
|
|
8791
|
-
},
|
|
8945
|
+
}, Hy, Uy = 65536 * 8, Wy = .9, Gy = 40, Ky = (e) => {
|
|
8946
|
+
let t = e || Gy;
|
|
8947
|
+
return Uy * Wy * 1e3 / t;
|
|
8948
|
+
}, qy = class r {
|
|
8792
8949
|
constructor(i, a, o, s) {
|
|
8793
8950
|
var c = this;
|
|
8794
|
-
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, "isContextSwitchInProgress", !1), e(this, "signalBuffer", []), e(this, "dataBuffer", []), e(this, "disconnected", new S()), e(this, "unload", () => {
|
|
8951
|
+
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 S()), e(this, "linkQueue", new Yv()), e(this, "unload", () => {
|
|
8795
8952
|
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");
|
|
8796
8953
|
}), e(this, "suspend", () => {
|
|
8797
8954
|
this.resetPingState(), this.transport.suspend();
|
|
@@ -8810,11 +8967,13 @@ var iy = /* @__PURE__ */ function(e) {
|
|
|
8810
8967
|
}
|
|
8811
8968
|
this.transport.send(JSON.stringify(e));
|
|
8812
8969
|
}), e(this, "getStatistics", () => ({
|
|
8813
|
-
edgeUrl:
|
|
8970
|
+
edgeUrl: Nv(this.config.edgeUrl),
|
|
8814
8971
|
connectionProtocol: "vindral_ws",
|
|
8815
8972
|
transportSelectionReason: void 0
|
|
8816
8973
|
})), e(this, "onMessage", (e) => {
|
|
8817
|
-
|
|
8974
|
+
typeof e == "string" && this.sampleLinkQueue(e), this.routeMessage(e), this.pingCooldownExpired() && this.sendPing();
|
|
8975
|
+
}), e(this, "routeMessage", (e) => {
|
|
8976
|
+
if (this.isContextSwitchInProgress) {
|
|
8818
8977
|
if (e instanceof ArrayBuffer) {
|
|
8819
8978
|
this.dataBuffer.push(e);
|
|
8820
8979
|
return;
|
|
@@ -8835,7 +8994,7 @@ var iy = /* @__PURE__ */ function(e) {
|
|
|
8835
8994
|
}
|
|
8836
8995
|
this.handleMessage(e);
|
|
8837
8996
|
}), e(this, "resolveEdgeUrl", t(function* () {
|
|
8838
|
-
let e = c.config.connectInfo, t = yield c.config.onConnectInfo(e), n =
|
|
8997
|
+
let e = c.config.connectInfo, t = yield c.config.onConnectInfo(e), n = Mv(c.config.edgeUrl, {
|
|
8839
8998
|
video: t.video,
|
|
8840
8999
|
audio: t.audio,
|
|
8841
9000
|
burstMs: t.burstMs,
|
|
@@ -8872,7 +9031,7 @@ var iy = /* @__PURE__ */ function(e) {
|
|
|
8872
9031
|
}
|
|
8873
9032
|
}
|
|
8874
9033
|
}), e(this, "connectWebSocketTransport", () => {
|
|
8875
|
-
let e = new
|
|
9034
|
+
let e = new Vy({
|
|
8876
9035
|
reconnectDelay: 1e3,
|
|
8877
9036
|
onMessage: this.onMessage,
|
|
8878
9037
|
reconnectHandler: this.config.reconnectHandler,
|
|
@@ -8892,16 +9051,16 @@ var iy = /* @__PURE__ */ function(e) {
|
|
|
8892
9051
|
}
|
|
8893
9052
|
this.emitter.emit("connection state", this.getState());
|
|
8894
9053
|
}), e(this, "reconnect", (e) => {
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
this.
|
|
9054
|
+
this.closeUnlessConnecting(e);
|
|
9055
|
+
}), e(this, "closeUnlessConnecting", (e) => this.transport.isConnectInProgress ? (this.logger.debug("Stopping reconnect, already mid-connection"), !1) : (this.close(e), !0)), e(this, "sampleLinkQueue", (e) => {
|
|
9056
|
+
if (this.isContextSwitchInProgress || !e.includes("\"timing info\"")) return;
|
|
9057
|
+
let t = JSON.parse(e);
|
|
9058
|
+
_n(t) && t.type === "timing info" && (this.linkQueue.sample(t.timingInfo.wallclockTime, performance.timeOrigin + performance.now()), $v(this.logger, this.linkQueue));
|
|
8900
9059
|
}), e(this, "resetPingState", () => {
|
|
8901
9060
|
this.missedPings = 0, this.isPingInFlight = !1;
|
|
8902
9061
|
}), e(this, "pingCooldownExpired", () => performance.now() - this.lastPingSentTime > r.PING_INTERVAL), e(this, "sendPing", () => {
|
|
8903
9062
|
if (this.isPingInFlight) {
|
|
8904
|
-
this.missedPings++, this.missedPings > r.MAX_MISSED_PINGS && this.
|
|
9063
|
+
this.missedPings++, this.missedPings > r.MAX_MISSED_PINGS && this.closeUnlessConnecting("missed pings") && (this.closedForBacklog = !0, this.emitter.emit("ping timeout"));
|
|
8905
9064
|
return;
|
|
8906
9065
|
}
|
|
8907
9066
|
this.isPingInFlight = !0, this.lastPingSentTime = performance.now(), this.missedPings = 0, this.sendSignal({ type: "ping" });
|
|
@@ -8911,8 +9070,8 @@ var iy = /* @__PURE__ */ function(e) {
|
|
|
8911
9070
|
return this.disconnected.promise;
|
|
8912
9071
|
}
|
|
8913
9072
|
};
|
|
8914
|
-
|
|
8915
|
-
let o = new
|
|
9073
|
+
Hy = qy, e(qy, "PING_INTERVAL", 5e3), e(qy, "MAX_MISSED_PINGS", 4), e(qy, "TLS_ROUNDTRIPS", 3), e(qy, "start", (e, t, n, r) => new Promise((i, a) => {
|
|
9074
|
+
let o = new Hy(e, t, n, r);
|
|
8916
9075
|
o.transport.once("error", (e) => a(e)), o.transport.once("open", () => {
|
|
8917
9076
|
var e;
|
|
8918
9077
|
(e = n.onTransportConnected) == null || e.call(n), i(o);
|
|
@@ -8920,51 +9079,52 @@ oy = dy, e(dy, "PING_INTERVAL", 5e3), e(dy, "MAX_MISSED_PINGS", 4), e(dy, "TLS_R
|
|
|
8920
9079
|
}));
|
|
8921
9080
|
//#endregion
|
|
8922
9081
|
//#region ../../libs/web-sdk/src/EdgeSelector.ts
|
|
8923
|
-
var
|
|
9082
|
+
var Jy = (e) => {
|
|
8924
9083
|
var t;
|
|
8925
9084
|
return typeof e == "string" ? e : `${e.moqWsUrl}|${(t = e.moqUrl) == null ? "" : t}`;
|
|
8926
|
-
},
|
|
9085
|
+
}, Yy = (e) => typeof e == "string" ? e : e.moqUrl || e.moqWsUrl, Xy = /* @__PURE__ */ new WeakMap(), Zy = /* @__PURE__ */ new WeakMap(), Qy = /* @__PURE__ */ new WeakMap(), $y = /* @__PURE__ */ new WeakMap(), eb = class {
|
|
8927
9086
|
constructor(e) {
|
|
8928
|
-
i(this,
|
|
9087
|
+
i(this, Xy, void 0), i(this, Zy, []), i(this, Qy, /* @__PURE__ */ new Set()), i(this, $y, void 0), a(Xy, this, e);
|
|
8929
9088
|
}
|
|
8930
9089
|
select(e) {
|
|
8931
|
-
if (s(
|
|
9090
|
+
if (s(Xy, this).edgeUrl) return s(Xy, this).edgeUrl;
|
|
8932
9091
|
if (e.length > 0) {
|
|
8933
|
-
a(
|
|
8934
|
-
let t = new Set(s(
|
|
8935
|
-
for (let e of s(
|
|
9092
|
+
a(Zy, this, [...e]);
|
|
9093
|
+
let t = new Set(s(Zy, this).map((e) => Jy(e)));
|
|
9094
|
+
for (let e of s(Qy, this)) t.has(e) || s(Qy, this).delete(e);
|
|
8936
9095
|
}
|
|
8937
|
-
if (s(
|
|
8938
|
-
let t = s(
|
|
8939
|
-
t.length === 0 && (s(
|
|
9096
|
+
if (s(Zy, this).length === 0) return;
|
|
9097
|
+
let t = s(Zy, this).filter((e) => !s(Qy, this).has(Jy(e)));
|
|
9098
|
+
t.length === 0 && (s(Qy, this).clear(), t = s(Zy, this));
|
|
8940
9099
|
let n = t[0];
|
|
8941
|
-
if (n) return s(
|
|
9100
|
+
if (n) return s(Qy, this).add(Jy(n)), a($y, this, n), n;
|
|
8942
9101
|
}
|
|
8943
9102
|
shiftedEdge() {
|
|
8944
|
-
return s(
|
|
9103
|
+
return s($y, this);
|
|
8945
9104
|
}
|
|
8946
9105
|
hasRemainingEdges() {
|
|
8947
|
-
return s(
|
|
9106
|
+
return s(Zy, this).some((e) => !s(Qy, this).has(Jy(e)));
|
|
8948
9107
|
}
|
|
8949
9108
|
reset() {
|
|
8950
|
-
a(
|
|
9109
|
+
a($y, this, void 0), a(Zy, this, []), s(Qy, this).clear();
|
|
8951
9110
|
}
|
|
8952
|
-
},
|
|
9111
|
+
}, tb, nb = 3e4, rb = /* @__PURE__ */ new WeakMap(), ib = /* @__PURE__ */ new WeakMap(), ab = /* @__PURE__ */ new WeakMap(), ob = /* @__PURE__ */ new WeakMap(), sb = /* @__PURE__ */ new WeakMap(), cb = /* @__PURE__ */ new WeakMap(), lb = /* @__PURE__ */ new WeakMap(), ub = /* @__PURE__ */ new WeakMap(), db = /* @__PURE__ */ new WeakMap(), fb = /* @__PURE__ */ new WeakMap(), pb = /* @__PURE__ */ new WeakMap(), mb = /* @__PURE__ */ new WeakMap(), hb = /* @__PURE__ */ new WeakMap(), gb = /* @__PURE__ */ new WeakMap(), _b = /* @__PURE__ */ new WeakMap(), vb = /* @__PURE__ */ new WeakMap(), yb = /* @__PURE__ */ new WeakMap(), bb = /* @__PURE__ */ new WeakMap(), xb = /* @__PURE__ */ new WeakMap(), Sb = /* @__PURE__ */ new WeakMap(), Cb = /* @__PURE__ */ new WeakSet(), 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 = class n {
|
|
8953
9112
|
constructor(c, l, u) {
|
|
8954
9113
|
var d = this;
|
|
8955
|
-
x(this,
|
|
9114
|
+
x(this, Cb), 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, rb, new r(10)), i(this, ib, !0), i(this, ab, void 0), i(this, ob, 0), i(this, sb, 0), i(this, cb, 0), i(this, lb, 0), i(this, ub, void 0), i(this, db, void 0), i(this, fb, void 0), i(this, pb, void 0), i(this, mb, void 0), i(this, hb, void 0), i(this, gb, void 0), i(this, _b, []), i(this, vb, void 0), e(this, "unload", () => {
|
|
8956
9115
|
var e;
|
|
8957
|
-
this.logger.debug("Unloading module..."), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), a(
|
|
9116
|
+
this.logger.debug("Unloading module..."), this.disconnect("Unloading"), (e = this.connectionImpl) == null || e.unload(), a(gb, this, void 0), this.logger.debug("Unloaded module");
|
|
8958
9117
|
}), e(this, "suspend", () => {
|
|
8959
9118
|
var e;
|
|
8960
|
-
a(
|
|
9119
|
+
a(ib, this, !1), (e = this.connectionImpl) == null || e.suspend();
|
|
8961
9120
|
}), e(this, "unsuspend", () => {
|
|
8962
9121
|
var e;
|
|
8963
|
-
a(
|
|
9122
|
+
a(ib, this, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
|
|
8964
9123
|
}), e(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected"), e(this, "getStatistics", () => {
|
|
8965
|
-
|
|
9124
|
+
var e;
|
|
9125
|
+
let t = s(sb, this) > 0 ? s(cb, this) / s(sb, this) : 0;
|
|
8966
9126
|
if (!this.connectionImpl) {
|
|
8967
|
-
let
|
|
9127
|
+
let e = s(yb, this).call(this);
|
|
8968
9128
|
return {
|
|
8969
9129
|
rtt: {
|
|
8970
9130
|
min: 0,
|
|
@@ -8973,35 +9133,44 @@ var fy = (e) => {
|
|
|
8973
9133
|
last: 0
|
|
8974
9134
|
},
|
|
8975
9135
|
estimatedBandwidth: 0,
|
|
8976
|
-
connectCount: s(
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
9136
|
+
connectCount: s(cb, this),
|
|
9137
|
+
backlogReconnectCount: s(lb, this),
|
|
9138
|
+
connectionAttemptCount: s(sb, this),
|
|
9139
|
+
connectionSuccessRatio: t,
|
|
9140
|
+
timeToConnected: s(pb, this),
|
|
9141
|
+
edgeUrl: e == null ? void 0 : e.edgeUrl,
|
|
9142
|
+
connectionProtocol: e == null ? void 0 : e.connectionProtocol,
|
|
9143
|
+
transportSelectionReason: e == null ? void 0 : e.transportSelectionReason
|
|
8983
9144
|
};
|
|
8984
9145
|
}
|
|
8985
|
-
|
|
8986
|
-
|
|
9146
|
+
let n = this.connectionImpl.getStatistics(), r = (e = this.linkQueue) == null ? void 0 : e.summary(nb);
|
|
9147
|
+
return y(y({}, n), {}, {
|
|
9148
|
+
linkQueue: r && {
|
|
9149
|
+
last: Math.round(r.last),
|
|
9150
|
+
average: Math.round(r.average),
|
|
9151
|
+
max: Math.round(r.max),
|
|
9152
|
+
min: Math.round(r.min)
|
|
9153
|
+
},
|
|
9154
|
+
rtt: xt(s(rb, this).items()),
|
|
8987
9155
|
estimatedBandwidth: this.estimatedBandwidth,
|
|
8988
|
-
connectCount: s(
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
9156
|
+
connectCount: s(cb, this),
|
|
9157
|
+
backlogReconnectCount: s(lb, this),
|
|
9158
|
+
connectionAttemptCount: s(sb, this),
|
|
9159
|
+
connectionSuccessRatio: t,
|
|
9160
|
+
timeToConnected: s(pb, this)
|
|
8992
9161
|
});
|
|
8993
|
-
}), i(this,
|
|
8994
|
-
if (a(
|
|
9162
|
+
}), i(this, yb, () => s(ib, this) && s(hb, this) ? s(hb, this) : s(mb, this)), e(this, "connect", () => {
|
|
9163
|
+
if (a(ib, this, !0), s(ab, this)) return;
|
|
8995
9164
|
let e = performance.now();
|
|
8996
|
-
s(
|
|
8997
|
-
}), i(this,
|
|
8998
|
-
s(
|
|
9165
|
+
s(pb, this) === void 0 && a(ub, this, e), s(db, this) === void 0 && a(db, this, e), a(ab, this, o(Cb, this, jb).call(this));
|
|
9166
|
+
}), i(this, bb, () => {
|
|
9167
|
+
s(pb, this) !== void 0 || s(ub, this) === void 0 || !s(ib, this) || (a(pb, this, performance.now() - s(ub, this)), a(ub, this, void 0));
|
|
8999
9168
|
}), e(this, "disconnect", (e = "Disconnect Requested") => {
|
|
9000
9169
|
var t;
|
|
9001
|
-
a(
|
|
9170
|
+
a(ib, this, !1), s(Tb, this).call(this), (t = this.connectionImpl) == null || t.close(e);
|
|
9002
9171
|
}), e(this, "reconnect", (e) => {
|
|
9003
9172
|
this.disconnect(e), this.connect();
|
|
9004
|
-
}), i(this,
|
|
9173
|
+
}), i(this, xb, t(function* () {
|
|
9005
9174
|
try {
|
|
9006
9175
|
return yield d.apiClient.connect(d.config.options.getOptions());
|
|
9007
9176
|
} catch (e) {
|
|
@@ -9012,7 +9181,7 @@ var fy = (e) => {
|
|
|
9012
9181
|
}
|
|
9013
9182
|
throw d.emitter.emit("error", er(e instanceof Error ? e : void 0)), e;
|
|
9014
9183
|
}
|
|
9015
|
-
})), i(this,
|
|
9184
|
+
})), i(this, Sb, t(function* () {
|
|
9016
9185
|
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);
|
|
9017
9186
|
try {
|
|
9018
9187
|
return yield fetch(new URL("/api/v4/connect/ping", d.config.options.get("url")).toString(), {
|
|
@@ -9024,27 +9193,27 @@ var fy = (e) => {
|
|
|
9024
9193
|
} finally {
|
|
9025
9194
|
clearTimeout(i);
|
|
9026
9195
|
}
|
|
9027
|
-
})), i(this,
|
|
9028
|
-
s(
|
|
9196
|
+
})), i(this, wb, () => {
|
|
9197
|
+
s(Tb, this).call(this), a(vb, this, setTimeout(() => {
|
|
9029
9198
|
var e;
|
|
9030
|
-
!s(
|
|
9199
|
+
!s(gb, this) || ((e = this.connectionImpl) == null ? void 0 : e.getState()) !== "connected" || (this.logger.debug("Connection remained stable for long enough, clearing cached fallback edges"), s(gb, this).reset(), a(vb, this, void 0));
|
|
9031
9200
|
}, n.EDGE_SELECTOR_RESET_TIMEOUT));
|
|
9032
|
-
}), i(this,
|
|
9033
|
-
s(
|
|
9034
|
-
}), i(this,
|
|
9201
|
+
}), i(this, Tb, () => {
|
|
9202
|
+
s(vb, this) !== void 0 && (clearTimeout(s(vb, this)), a(vb, this, void 0));
|
|
9203
|
+
}), i(this, Eb, function() {
|
|
9035
9204
|
var e = t(function* (e) {
|
|
9036
|
-
return (yield d.config.reconnectHandler({ reconnectRetries: s(
|
|
9205
|
+
return (yield d.config.reconnectHandler({ reconnectRetries: s(ob, d) })) ? (s(Ob, d).call(d) ? (d.logger.info("Reconnect burst detected, applying backoff before retrying"), yield un(n.RECONNECT_BACKOFF_MS)) : d.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), s(ib, d)) : (a(ib, d, !1), d.emitter.emit("error", tr()), !1);
|
|
9037
9206
|
});
|
|
9038
9207
|
return function(t) {
|
|
9039
9208
|
return e.apply(this, arguments);
|
|
9040
9209
|
};
|
|
9041
|
-
}()), i(this,
|
|
9042
|
-
s(
|
|
9043
|
-
}), i(this,
|
|
9044
|
-
for (; s(
|
|
9045
|
-
let t = s(
|
|
9210
|
+
}()), i(this, Db, (e = performance.now()) => {
|
|
9211
|
+
s(kb, this).call(this, e), s(_b, this).push(e);
|
|
9212
|
+
}), i(this, Ob, (e = performance.now()) => (s(kb, this).call(this, e), s(_b, this).length >= n.RECONNECT_BACKOFF_BURST_THRESHOLD)), i(this, kb, (e) => {
|
|
9213
|
+
for (; s(_b, this).length > 0;) {
|
|
9214
|
+
let t = s(_b, this)[0];
|
|
9046
9215
|
if (t === void 0 || t > e - n.RECONNECT_BACKOFF_BURST_WINDOW_MS) return;
|
|
9047
|
-
s(
|
|
9216
|
+
s(_b, this).shift();
|
|
9048
9217
|
}
|
|
9049
9218
|
}), this.logger = l, this.emitter = c, this.config = u, this.apiClient = new g({
|
|
9050
9219
|
publicEndpoint: this.config.options.get("url").toString(),
|
|
@@ -9052,90 +9221,97 @@ var fy = (e) => {
|
|
|
9052
9221
|
});
|
|
9053
9222
|
}
|
|
9054
9223
|
get rtt() {
|
|
9055
|
-
return s(
|
|
9224
|
+
return s(rb, this).items().length > 0 ? vt(s(rb, this).items()) : 0;
|
|
9225
|
+
}
|
|
9226
|
+
get isMoq() {
|
|
9227
|
+
return this.connectionImpl instanceof Cy;
|
|
9056
9228
|
}
|
|
9057
9229
|
get estimatedBandwidth() {
|
|
9058
9230
|
if (this.connectionImpl && "estimatedBandwidth" in this.connectionImpl) {
|
|
9059
9231
|
let e = this.connectionImpl.estimatedBandwidth;
|
|
9060
9232
|
if (e && Number.isFinite(e)) return e;
|
|
9061
9233
|
}
|
|
9062
|
-
return
|
|
9234
|
+
return Ky(this.rtt);
|
|
9235
|
+
}
|
|
9236
|
+
get linkQueue() {
|
|
9237
|
+
var e;
|
|
9238
|
+
return (e = this.connectionImpl) == null ? void 0 : e.linkQueue;
|
|
9063
9239
|
}
|
|
9064
9240
|
get firstConnectStartTime() {
|
|
9065
|
-
return s(
|
|
9241
|
+
return s(db, this);
|
|
9066
9242
|
}
|
|
9067
9243
|
get lastConnectionTime() {
|
|
9068
|
-
return s(
|
|
9244
|
+
return s(fb, this);
|
|
9069
9245
|
}
|
|
9070
9246
|
};
|
|
9071
|
-
|
|
9072
|
-
function
|
|
9247
|
+
tb = Ab;
|
|
9248
|
+
function jb() {
|
|
9073
9249
|
var e = this;
|
|
9074
9250
|
return t(function* () {
|
|
9075
|
-
let t = new
|
|
9076
|
-
for (a(
|
|
9251
|
+
let t = new eb({ edgeUrl: e.config.options.get("edgeUrl") });
|
|
9252
|
+
for (a(gb, e, t), s(Tb, e).call(e), a(ob, e, 0), a(_b, e, []);;) {
|
|
9077
9253
|
var n, r, i;
|
|
9078
|
-
let
|
|
9079
|
-
a(
|
|
9080
|
-
let
|
|
9081
|
-
a(
|
|
9254
|
+
let u = "standard";
|
|
9255
|
+
a(ob, e, (n = s(ob, e), n++, n)), a(sb, e, (r = s(sb, e), r++, r)), s(Db, e).call(e);
|
|
9256
|
+
let f = !1;
|
|
9257
|
+
a(hb, e, {});
|
|
9082
9258
|
try {
|
|
9083
|
-
var o;
|
|
9084
|
-
let [n, r] = yield Promise.all([s(
|
|
9085
|
-
if (s(
|
|
9259
|
+
var o, l;
|
|
9260
|
+
let [n, r] = yield Promise.all([s(xb, e).call(e), s(Sb, e).call(e)]);
|
|
9261
|
+
if (s(rb, e).clear(), r !== void 0 && s(rb, e).push(r / 2), !s(ib, e)) break;
|
|
9086
9262
|
let i = t.select(n.edges);
|
|
9087
9263
|
if (!i) throw new O("Failed to resolve edge url", {
|
|
9088
9264
|
isFatal: !0,
|
|
9089
9265
|
code: "failed_to_resolve_edge_url"
|
|
9090
9266
|
});
|
|
9091
|
-
a(
|
|
9267
|
+
a(hb, e, { edgeUrl: Nv(Yy(i)) });
|
|
9092
9268
|
try {
|
|
9093
|
-
c(n) ? e.connectionImpl = yield
|
|
9269
|
+
c(n) ? e.connectionImpl = yield Cy.start(e.emitter, e.logger, e.apiClient, y(y({}, e.config), {}, {
|
|
9094
9270
|
connectInfo: n,
|
|
9095
9271
|
edgeUrl: i,
|
|
9096
|
-
onTransportConnected: s(
|
|
9097
|
-
}), s(
|
|
9272
|
+
onTransportConnected: s(bb, e)
|
|
9273
|
+
}), s(rb, e)) : (d(typeof i == "string", "Edge URL is expected to be a string"), e.connectionImpl = yield qy.start(e.emitter, e.logger, y(y({}, e.config), {}, {
|
|
9098
9274
|
connectInfo: n,
|
|
9099
9275
|
edgeUrl: i,
|
|
9100
|
-
onTransportConnected: s(
|
|
9101
|
-
}), s(
|
|
9276
|
+
onTransportConnected: s(bb, e)
|
|
9277
|
+
}), s(rb, e)));
|
|
9102
9278
|
} catch (e) {
|
|
9103
|
-
throw
|
|
9279
|
+
throw u = "cached_edge", e;
|
|
9104
9280
|
}
|
|
9105
|
-
a(
|
|
9106
|
-
let
|
|
9107
|
-
e.logger.info("Connection closed", { reason:
|
|
9281
|
+
a(mb, e, e.connectionImpl.getStatistics()), a(hb, e, void 0), s(ib, e) || e.connectionImpl.close("Disconnected during connect"), s(wb, e).call(e), a(cb, e, (o = s(cb, e), o++, o)), a(ob, e, 0), a(fb, e, performance.now()), s(bb, e).call(e);
|
|
9282
|
+
let f = yield e.connectionImpl.closed();
|
|
9283
|
+
e.connectionImpl.closedForBacklog && a(lb, e, (l = s(lb, e), l++, l)), e.logger.info("Connection closed", { reason: f instanceof Error ? f.message : f }), u = "cached_edge";
|
|
9108
9284
|
} catch (n) {
|
|
9109
9285
|
e.logger.warn("Failed to connect", n);
|
|
9110
9286
|
let r = t.shiftedEdge();
|
|
9111
9287
|
r && e.emitter.emit("telemetry event", {
|
|
9112
9288
|
code: "shifted_edge",
|
|
9113
|
-
edgeUrl:
|
|
9114
|
-
}), n instanceof O ? (e.emitter.emit("error", n),
|
|
9289
|
+
edgeUrl: Yy(r)
|
|
9290
|
+
}), n instanceof O ? (e.emitter.emit("error", n), f = n.isFatal()) : n instanceof Error && e.emitter.emit("error", new O(n.message, {
|
|
9115
9291
|
code: "start_failed",
|
|
9116
9292
|
isFatal: !1
|
|
9117
9293
|
}));
|
|
9118
9294
|
}
|
|
9119
|
-
if ((i = e.connectionImpl) == null || i.unload(), e.connectionImpl = void 0, s(
|
|
9120
|
-
a(
|
|
9295
|
+
if ((i = e.connectionImpl) == null || i.unload(), e.connectionImpl = void 0, s(Tb, e).call(e), f) {
|
|
9296
|
+
a(ib, e, !1);
|
|
9121
9297
|
break;
|
|
9122
9298
|
}
|
|
9123
|
-
if (!s(
|
|
9299
|
+
if (!s(ib, e) || !(yield s(Eb, e).call(e, u === "cached_edge" && t.hasRemainingEdges() ? "cached_edge" : "standard"))) break;
|
|
9124
9300
|
}
|
|
9125
|
-
a(
|
|
9301
|
+
a(hb, e, void 0), a(gb, e, void 0), s(Tb, e).call(e), a(ab, e, void 0);
|
|
9126
9302
|
})();
|
|
9127
9303
|
}
|
|
9128
|
-
e(
|
|
9304
|
+
e(Ab, "PING_TIMEOUT", 1e3), e(Ab, "RECONNECT_BACKOFF_MS", 1e3), e(Ab, "RECONNECT_BACKOFF_BURST_WINDOW_MS", 5e3), e(Ab, "RECONNECT_BACKOFF_BURST_THRESHOLD", 3), e(Ab, "EDGE_SELECTOR_RESET_TIMEOUT", 60 * 1e3), e(Ab, "create", (e, t, n) => new tb(e, t, n));
|
|
9129
9305
|
//#endregion
|
|
9130
9306
|
//#region ../../libs/web-sdk/src/modules/ConstraintCapModule.ts
|
|
9131
|
-
var
|
|
9307
|
+
var Mb, Nb = () => ({
|
|
9132
9308
|
video: y(y({}, gn()), {}, { bitRate: hn() }),
|
|
9133
9309
|
audio: { bitRate: hn() }
|
|
9134
|
-
}),
|
|
9310
|
+
}), Pb = () => ({
|
|
9135
9311
|
width: window.innerWidth,
|
|
9136
9312
|
height: window.innerHeight,
|
|
9137
9313
|
bitRate: hn()
|
|
9138
|
-
}),
|
|
9314
|
+
}), Fb = class t {
|
|
9139
9315
|
constructor(n, r, i, a) {
|
|
9140
9316
|
e(this, "emitter", void 0), e(this, "timers", new D()), 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", () => {
|
|
9141
9317
|
var e;
|
|
@@ -9157,7 +9333,7 @@ var Jy, Yy = () => ({
|
|
|
9157
9333
|
this.timers.unload();
|
|
9158
9334
|
}), e(this, "setUserSpecifiedCap", (e) => {
|
|
9159
9335
|
var t;
|
|
9160
|
-
let n = (t = this.getUserSpecifiedCap()) == null ?
|
|
9336
|
+
let n = (t = this.getUserSpecifiedCap()) == null ? Nb() : t;
|
|
9161
9337
|
this.userSpecifiedCap = y(y({}, n), {}, {
|
|
9162
9338
|
video: y(y({}, n.video), e.video),
|
|
9163
9339
|
audio: y(y({}, n.audio), e.audio)
|
|
@@ -9181,7 +9357,7 @@ var Jy, Yy = () => ({
|
|
|
9181
9357
|
});
|
|
9182
9358
|
}), e(this, "evaluateConstraintCap", () => {
|
|
9183
9359
|
var e, t, n, r;
|
|
9184
|
-
let i = this.sizeBasedResolutionCapEnabled ? y(y({},
|
|
9360
|
+
let i = this.sizeBasedResolutionCapEnabled ? y(y({}, Nb()), {}, { video: Pb() }) : Nb();
|
|
9185
9361
|
if (!this.resizeObserver) {
|
|
9186
9362
|
let e = this.element.getBoundingClientRect();
|
|
9187
9363
|
this.elementSize = {
|
|
@@ -9218,20 +9394,20 @@ var Jy, Yy = () => ({
|
|
|
9218
9394
|
this._sizeBasedResolutionCapEnabled = e, this.evaluateConstraintCap();
|
|
9219
9395
|
}
|
|
9220
9396
|
};
|
|
9221
|
-
|
|
9397
|
+
Mb = Fb, e(Fb, "CHECK_SIZE_INTERVAL", 1e3), e(Fb, "create", (e, t, n, r) => new Mb(e, t, n, r));
|
|
9222
9398
|
//#endregion
|
|
9223
9399
|
//#region ../../libs/web-sdk/src/renditionKey.ts
|
|
9224
|
-
var
|
|
9400
|
+
var Ib = (e, t) => `${e}\u0000${t == null ? "" : t}`, Lb = (e, t, n, r) => e === n && t === r, Rb = class {
|
|
9225
9401
|
constructor() {
|
|
9226
9402
|
e(this, "lastKey", void 0), e(this, "shouldNotify", (e, t) => {
|
|
9227
|
-
let n =
|
|
9403
|
+
let n = Ib(e, t);
|
|
9228
9404
|
return this.lastKey === n ? !1 : (this.lastKey = n, !0);
|
|
9229
9405
|
});
|
|
9230
9406
|
}
|
|
9231
|
-
},
|
|
9407
|
+
}, zb = 5, Bb = 40, Vb = 1, Hb = 3e4, Ub = 5, Wb = (e) => {
|
|
9232
9408
|
var t, n;
|
|
9233
9409
|
return ((t = e.maxCompositionOffsetMs) == null ? 0 : t) - ((n = e.minCompositionOffsetMs) == null ? 0 : n);
|
|
9234
|
-
},
|
|
9410
|
+
}, Gb = (e, t, n) => {
|
|
9235
9411
|
let r = [];
|
|
9236
9412
|
for (let i of e) {
|
|
9237
9413
|
let e = r[r.length - 1];
|
|
@@ -9245,10 +9421,10 @@ var Qy = (e, t) => `${e}\u0000${t == null ? "" : t}`, $y = (e, t, n, r) => e ===
|
|
|
9245
9421
|
});
|
|
9246
9422
|
}
|
|
9247
9423
|
return r;
|
|
9248
|
-
},
|
|
9424
|
+
}, Kb = (e, t) => {
|
|
9249
9425
|
let n = e[e.length - 1];
|
|
9250
9426
|
n && n.end > t && n.start < t && (n.end = t);
|
|
9251
|
-
},
|
|
9427
|
+
}, qb = 100, Jb = 1e3, Yb = class n {
|
|
9252
9428
|
constructor(t, n, r, i, a = !1, o = !1, s = !1) {
|
|
9253
9429
|
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", () => {
|
|
9254
9430
|
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);
|
|
@@ -9266,8 +9442,8 @@ var Qy = (e, t) => `${e}\u0000${t == null ? "" : t}`, $y = (e, t, n, r) => e ===
|
|
|
9266
9442
|
}), e(this, "unsuspend", () => {
|
|
9267
9443
|
this.isSuspended = !1, this.emitDecodedFrames(), this._audioWebCodecsInUse && this.scheduleAudioEmitRetry();
|
|
9268
9444
|
}), e(this, "armTimers", () => {
|
|
9269
|
-
let e = this._audioWebCodecsInUse ? 20 :
|
|
9270
|
-
this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate,
|
|
9445
|
+
let e = this._audioWebCodecsInUse ? 20 : qb;
|
|
9446
|
+
this.timers.setInterval(this.emitDecodedFrames, e), this.timers.setInterval(this.emitDecodeRate, Jb);
|
|
9271
9447
|
}), e(this, "replaceTimers", () => {
|
|
9272
9448
|
let e = this.isAudioEmitRetryScheduled;
|
|
9273
9449
|
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());
|
|
@@ -9336,27 +9512,27 @@ var Qy = (e, t) => `${e}\u0000${t == null ? "" : t}`, $y = (e, t, n, r) => e ===
|
|
|
9336
9512
|
i.stream = `${e.channelId}/${e.renditionId}`;
|
|
9337
9513
|
let c = (e.timestamp + a) / e.timescale * 1e3, l = e.duration / e.timescale * 1e3;
|
|
9338
9514
|
l > 0 && (i.sampleDuration = l);
|
|
9339
|
-
let u = i.sampleDuration ||
|
|
9515
|
+
let u = i.sampleDuration || Bb, d = e.timestamp / e.timescale * 1e3, f = a / e.timescale * 1e3, p = Wb(i), m = (t = s[s.length - 1]) == null ? void 0 : t.end, h = Math.max(u * Ub, p + ((n = i.frontierSampleDurationMs) == null ? u : n)), g = m !== void 0 && c + h < m;
|
|
9340
9516
|
i.lastDecodeTimestampMs = g ? d : Math.max((r = i.lastDecodeTimestampMs) == null ? d : r, d);
|
|
9341
|
-
let ee = i.channelId !== void 0 &&
|
|
9517
|
+
let ee = i.channelId !== void 0 && !Lb(i.channelId, i.renditionId, e.channelId, e.renditionId);
|
|
9342
9518
|
i.channelId = e.channelId, i.renditionId = e.renditionId, (g || ee) && (i.minCompositionOffsetMs = void 0, i.maxCompositionOffsetMs = void 0, i.hasAnchoredGop = !1, i.isReorderStructureStale = !0);
|
|
9343
9519
|
let _ = i.hasAnchoredGop === !0;
|
|
9344
9520
|
if (e.isSync && (i.hasAnchoredGop = !0), !g && i.hasAnchoredGop) {
|
|
9345
9521
|
var te, v;
|
|
9346
9522
|
i.minCompositionOffsetMs = Math.min((te = i.minCompositionOffsetMs) == null ? f : te, f), i.maxCompositionOffsetMs = Math.max((v = i.maxCompositionOffsetMs) == null ? f : v, f), _ && (i.isReorderStructureStale = !1);
|
|
9347
9523
|
}
|
|
9348
|
-
let ne =
|
|
9524
|
+
let ne = Wb(i) > 0;
|
|
9349
9525
|
if (g) i.buffer = [{
|
|
9350
9526
|
start: c,
|
|
9351
9527
|
end: c + u
|
|
9352
9528
|
}], i.frontierSampleDurationMs = u, e.type === "video" && (this.videoKeyframeTimestamps = []);
|
|
9353
9529
|
else {
|
|
9354
9530
|
var re;
|
|
9355
|
-
!ne && !i.isReorderStructureStale &&
|
|
9531
|
+
!ne && !i.isReorderStructureStale && Kb(s, c + u);
|
|
9356
9532
|
let e = (re = s[s.length - 1]) == null ? void 0 : re.end;
|
|
9357
|
-
(e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), rn(s, c, c + u,
|
|
9533
|
+
(e === void 0 || c + u >= e) && (i.frontierSampleDurationMs = u), rn(s, c, c + u, zb);
|
|
9358
9534
|
}
|
|
9359
|
-
if (on(i.buffer, this.playbackSource.currentTime -
|
|
9535
|
+
if (on(i.buffer, this.playbackSource.currentTime - Hb), i.playableRangesCache = void 0, e.type === "video" && e.isSync) {
|
|
9360
9536
|
let e = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
|
|
9361
9537
|
e !== void 0 && c < e && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(c), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
|
|
9362
9538
|
}
|
|
@@ -9393,11 +9569,11 @@ var Qy = (e, t) => `${e}\u0000${t == null ? "" : t}`, $y = (e, t, n, r) => e ===
|
|
|
9393
9569
|
}
|
|
9394
9570
|
this.currentVideoDecodeRate = this.calculateVideoDecodeRate(), this.emitter.emit("video decode rate", this.currentVideoDecodeRate);
|
|
9395
9571
|
}), e(this, "playableRanges", (e) => {
|
|
9396
|
-
let t =
|
|
9572
|
+
let t = Wb(e);
|
|
9397
9573
|
if (t <= 0) return e.buffer;
|
|
9398
9574
|
if (e.playableRangesCache === void 0) {
|
|
9399
9575
|
var n, r;
|
|
9400
|
-
e.playableRangesCache =
|
|
9576
|
+
e.playableRangesCache = Gb(e.buffer, ((n = e.lastDecodeTimestampMs) == null ? Infinity : n) - Math.max(0, -((r = e.minCompositionOffsetMs) == null ? 0 : r)) - Vb, t + (e.sampleDuration || Bb) + Vb);
|
|
9401
9577
|
}
|
|
9402
9578
|
return e.playableRangesCache;
|
|
9403
9579
|
}), e(this, "updateBufferState", () => {
|
|
@@ -9463,7 +9639,7 @@ var Qy = (e, t) => `${e}\u0000${t == null ? "" : t}`, $y = (e, t, n, r) => e ===
|
|
|
9463
9639
|
break;
|
|
9464
9640
|
}
|
|
9465
9641
|
case "video": {
|
|
9466
|
-
let { VideoDecoderWorkerContext: n } = yield import("./
|
|
9642
|
+
let { VideoDecoderWorkerContext: n } = yield import("./C2hzXxnL.js"), o = yield n.create(i.createContext("VideoDecoderWorker"), a, c, l, u, d, () => s.currentTime, f, p);
|
|
9467
9643
|
h = o.isWebCodecs, ee = o.usingOffscreenCanvas, t.set(e.type, {
|
|
9468
9644
|
buffer: [],
|
|
9469
9645
|
decoderContext: o,
|
|
@@ -9484,7 +9660,7 @@ var Qy = (e, t) => `${e}\u0000${t == null ? "" : t}`, $y = (e, t, n, r) => e ===
|
|
|
9484
9660
|
var e;
|
|
9485
9661
|
if (this._offscreenCanvasInUse) return (e = this.trackContexts.get("video")) == null ? void 0 : e.decoderContext.videoTrack;
|
|
9486
9662
|
}
|
|
9487
|
-
},
|
|
9663
|
+
}, Xb, Zb = class {
|
|
9488
9664
|
constructor(t) {
|
|
9489
9665
|
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", () => {
|
|
9490
9666
|
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);
|
|
@@ -9514,12 +9690,12 @@ var Qy = (e, t) => `${e}\u0000${t == null ? "" : t}`, $y = (e, t, n, r) => e ===
|
|
|
9514
9690
|
return document.visibilityState === "visible" && !this.isBehindAnotherApp;
|
|
9515
9691
|
}
|
|
9516
9692
|
};
|
|
9517
|
-
|
|
9693
|
+
Xb = Zb, e(Zb, "create", (e) => new Xb(e));
|
|
9518
9694
|
//#endregion
|
|
9519
9695
|
//#region ../../libs/web-sdk/src/modules/EventModule.ts
|
|
9520
|
-
var
|
|
9696
|
+
var Qb, $b = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e, ex = class t {
|
|
9521
9697
|
constructor(n, r, i) {
|
|
9522
|
-
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered",
|
|
9698
|
+
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "waitingEvents", []), e(this, "isTriggered", $b(t.EVENT_TIMEOUT)), e(this, "timeSource", void 0), e(this, "timers", new D()), e(this, "load", () => {
|
|
9523
9699
|
this.timers.setInterval(this.onBufferedStateChanged, t.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
|
|
9524
9700
|
}), e(this, "unload", () => {
|
|
9525
9701
|
this.timers.unload(), this.emitter.off("add event", this.addEvent);
|
|
@@ -9546,10 +9722,10 @@ var mb, hb = (e) => (t, n, r) => t.timestamp <= n || t.timestampAdded <= r - e,
|
|
|
9546
9722
|
}), this.logger = r, this.emitter = n, this.timeSource = i;
|
|
9547
9723
|
}
|
|
9548
9724
|
};
|
|
9549
|
-
|
|
9725
|
+
Qb = ex, e(ex, "EVENT_TIMEOUT", 5e3), e(ex, "EVENT_CHECK_INTERVAL", 20), e(ex, "create", (e, t, n) => new Qb(e, t, n));
|
|
9550
9726
|
//#endregion
|
|
9551
9727
|
//#region ../../libs/web-sdk/src/modules/JitterModule.ts
|
|
9552
|
-
var
|
|
9728
|
+
var tx = 1e3, nx = 50, rx = class t {
|
|
9553
9729
|
constructor(t) {
|
|
9554
9730
|
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", () => {
|
|
9555
9731
|
this.logger.debug("JitterModule loaded");
|
|
@@ -9570,9 +9746,9 @@ var _b = 1e3, vb = 50, yb = class t {
|
|
|
9570
9746
|
this.trackingState.set(n, {
|
|
9571
9747
|
lastArrivalTime: i,
|
|
9572
9748
|
lastTimestampMs: a,
|
|
9573
|
-
jitterSamples: new r(
|
|
9574
|
-
interArrivalTimes: new r(
|
|
9575
|
-
}), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(
|
|
9749
|
+
jitterSamples: new r(tx),
|
|
9750
|
+
interArrivalTimes: new r(tx)
|
|
9751
|
+
}), this.runningJitter.set(n, 0), this.recentJitterSamples.set(n, new r(nx));
|
|
9576
9752
|
return;
|
|
9577
9753
|
}
|
|
9578
9754
|
let s = a - o.lastTimestampMs;
|
|
@@ -9585,7 +9761,7 @@ var _b = 1e3, vb = 50, yb = class t {
|
|
|
9585
9761
|
let u = (t = this.runningJitter.get(n)) == null ? 0 : t, d = u + (l - u) / 16;
|
|
9586
9762
|
this.runningJitter.set(n, d);
|
|
9587
9763
|
let f = this.recentJitterSamples.get(n);
|
|
9588
|
-
f || (f = new r(
|
|
9764
|
+
f || (f = new r(nx), this.recentJitterSamples.set(n, f)), f.push(l), o.lastArrivalTime = i, o.lastTimestampMs = a;
|
|
9589
9765
|
}
|
|
9590
9766
|
getJitterForType(e) {
|
|
9591
9767
|
for (let [i, a] of this.trackingState) if (i.startsWith(e)) {
|
|
@@ -9616,10 +9792,10 @@ var _b = 1e3, vb = 50, yb = class t {
|
|
|
9616
9792
|
videoJitter: this.getJitterForType("video")
|
|
9617
9793
|
};
|
|
9618
9794
|
}
|
|
9619
|
-
},
|
|
9795
|
+
}, ix = () => window.AudioContext || window.webkitAudioContext, ax = class r extends ie {
|
|
9620
9796
|
constructor() {
|
|
9621
9797
|
var i;
|
|
9622
|
-
super(), i = this, e(this, "context", new (
|
|
9798
|
+
super(), i = this, e(this, "context", new (ix())()), e(this, "timers", D.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* () {
|
|
9623
9799
|
let e = !0, t = i.context.resume();
|
|
9624
9800
|
t.then(() => {
|
|
9625
9801
|
e = !1;
|
|
@@ -9654,10 +9830,10 @@ var _b = 1e3, vb = 50, yb = class t {
|
|
|
9654
9830
|
return this.context.state;
|
|
9655
9831
|
}
|
|
9656
9832
|
};
|
|
9657
|
-
e(
|
|
9833
|
+
e(ax, "CHECK_INTERVAL", 1e3);
|
|
9658
9834
|
//#endregion
|
|
9659
9835
|
//#region ../../libs/web-audio-player/src/AudioPlayer.ts
|
|
9660
|
-
var
|
|
9836
|
+
var ox, sx = 150, cx = 400, lx = (e) => e === void 0 ? 5 : e <= sx ? 1 : e <= cx ? 2 : 5, ux = class extends ie {
|
|
9661
9837
|
get isContextRunning() {
|
|
9662
9838
|
var e;
|
|
9663
9839
|
return ((e = this.audio) == null ? void 0 : e.state) === "running";
|
|
@@ -9704,7 +9880,7 @@ var Sb, Cb = 150, wb = 400, Tb = (e) => e === void 0 ? 5 : e <= Cb ? 1 : e <= wb
|
|
|
9704
9880
|
return this._bufferTime;
|
|
9705
9881
|
}
|
|
9706
9882
|
set bufferTime(e) {
|
|
9707
|
-
this._bufferTime = e, this.audioBufferMultiplier =
|
|
9883
|
+
this._bufferTime = e, this.audioBufferMultiplier = lx(e);
|
|
9708
9884
|
}
|
|
9709
9885
|
get sinkPaused() {
|
|
9710
9886
|
return this._sinkPaused;
|
|
@@ -9810,7 +9986,7 @@ var Sb, Cb = 150, wb = 400, Tb = (e) => e === void 0 ? 5 : e <= Cb ? 1 : e <= wb
|
|
|
9810
9986
|
this.ignoreSuspendCalls = !1, this.emit("state change", "suspended");
|
|
9811
9987
|
}), e(this, "getAudioContext", () => this.audio ? this.audio : this.setupContext()), e(this, "setupContext", () => {
|
|
9812
9988
|
var e, t, r;
|
|
9813
|
-
return (e = this.audio) == null || e.unload(), this.audio = new
|
|
9989
|
+
return (e = this.audio) == null || e.unload(), this.audio = new ax(), this.audio.on("state", (e) => {
|
|
9814
9990
|
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);
|
|
9815
9991
|
}), this.audio.on("stuck", () => {
|
|
9816
9992
|
if (!this.reInitWhenStuck) {
|
|
@@ -9821,7 +9997,7 @@ var Sb, Cb = 150, wb = 400, Tb = (e) => e === void 0 ? 5 : e <= Cb ? 1 : e <= wb
|
|
|
9821
9997
|
}), (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;
|
|
9822
9998
|
}), e(this, "setGain", (e) => {
|
|
9823
9999
|
this.gainNode && (this.gainNode.gain.value = this._muted ? 0 : e);
|
|
9824
|
-
}), this._muted = o, this._userProvidedMuted = o, this.logger = i, this.clockSource = a, this.reInitWhenStuck = s, this._bufferTime = c, this.audioBufferMultiplier =
|
|
10000
|
+
}), this._muted = o, this._userProvidedMuted = o, this.logger = i, this.clockSource = a, this.reInitWhenStuck = s, this._bufferTime = c, this.audioBufferMultiplier = lx(c);
|
|
9825
10001
|
}
|
|
9826
10002
|
useMediaStreamDestination() {
|
|
9827
10003
|
var e;
|
|
@@ -9834,10 +10010,10 @@ var Sb, Cb = 150, wb = 400, Tb = (e) => e === void 0 ? 5 : e <= Cb ? 1 : e <= wb
|
|
|
9834
10010
|
return (e = this.gainNode) == null || e.connect(t), t;
|
|
9835
10011
|
}
|
|
9836
10012
|
};
|
|
9837
|
-
|
|
10013
|
+
ox = ux, e(ux, "create", (e, t, n) => new ox(e, t, n));
|
|
9838
10014
|
//#endregion
|
|
9839
10015
|
//#region ../../libs/web-sdk/src/players/VideoPlayer.ts
|
|
9840
|
-
var
|
|
10016
|
+
var dx, fx = class {
|
|
9841
10017
|
constructor(t, n, r, i, a, o) {
|
|
9842
10018
|
e(this, "staleFrameThresholdMs", 400), e(this, "pool", void 0), e(this, "logger", void 0), e(this, "videoRenderer", new Ur()), 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", () => {
|
|
9843
10019
|
this.videoRenderer.load(), this.subscribeToContextLost(this.videoRenderer);
|
|
@@ -9927,12 +10103,12 @@ var Db, Ob = class {
|
|
|
9927
10103
|
}), this.logger = t, this.clockSource = n, this.pool = r, this.renderTargetSize = i || this.videoRenderer.canvas, this.onCanvasChangeCallback = a, this.onRendererErrorCallback = o;
|
|
9928
10104
|
}
|
|
9929
10105
|
};
|
|
9930
|
-
|
|
10106
|
+
dx = fx, e(fx, "create", (e, t, n, r, i, a) => new dx(e, t, n, r, i, a));
|
|
9931
10107
|
//#endregion
|
|
9932
10108
|
//#region ../../libs/web-sdk/src/TextTracks.ts
|
|
9933
|
-
var
|
|
10109
|
+
var px = /* @__PURE__ */ new WeakMap(), mx = class {
|
|
9934
10110
|
constructor() {
|
|
9935
|
-
i(this,
|
|
10111
|
+
i(this, px, []), a(px, this, []);
|
|
9936
10112
|
}
|
|
9937
10113
|
addTextTrack(e, t, n) {
|
|
9938
10114
|
let r = [], i = {
|
|
@@ -9949,43 +10125,43 @@ var kb = /* @__PURE__ */ new WeakMap(), Ab = class {
|
|
|
9949
10125
|
t !== -1 && r.splice(t, 1);
|
|
9950
10126
|
}
|
|
9951
10127
|
};
|
|
9952
|
-
return s(
|
|
10128
|
+
return s(px, this).push(i), i;
|
|
9953
10129
|
}
|
|
9954
10130
|
set language(e) {
|
|
9955
|
-
s(
|
|
10131
|
+
s(px, this).forEach((t) => {
|
|
9956
10132
|
t.language === e ? t.mode = "showing" : t.mode = "hidden";
|
|
9957
10133
|
});
|
|
9958
10134
|
}
|
|
9959
10135
|
get language() {
|
|
9960
10136
|
var e;
|
|
9961
|
-
return (e = s(
|
|
10137
|
+
return (e = s(px, this).find((e) => e.mode === "showing")) == null ? void 0 : e.language;
|
|
9962
10138
|
}
|
|
9963
10139
|
get tracks() {
|
|
9964
|
-
return s(
|
|
10140
|
+
return s(px, this);
|
|
9965
10141
|
}
|
|
9966
10142
|
get activeTrack() {
|
|
9967
|
-
return s(
|
|
10143
|
+
return s(px, this).find((e) => e.mode === "showing");
|
|
9968
10144
|
}
|
|
9969
10145
|
getActiveCues(e) {
|
|
9970
|
-
let t = s(
|
|
10146
|
+
let t = s(px, this).find((e) => e.mode === "showing");
|
|
9971
10147
|
return t ? t.cues.filter(({ startTime: t, endTime: n }) => e >= t && e < n) : [];
|
|
9972
10148
|
}
|
|
9973
|
-
},
|
|
10149
|
+
}, hx = (e, t) => {
|
|
9974
10150
|
let n;
|
|
9975
10151
|
for (n = t; e > 1; e--) n += t;
|
|
9976
10152
|
return n;
|
|
9977
|
-
},
|
|
10153
|
+
}, gx = class {
|
|
9978
10154
|
constructor() {
|
|
9979
10155
|
e(this, "audio", void 0), e(this, "unmute", () => this.audio.play().catch(n));
|
|
9980
10156
|
let t = document.createElement("div");
|
|
9981
10157
|
t.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
|
|
9982
10158
|
let r = t.children.item(0);
|
|
9983
|
-
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" +
|
|
10159
|
+
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" + hx(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + hx(16, "gICA") + hx(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + hx(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + hx(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + hx(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + hx(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
|
|
9984
10160
|
else throw Error("Failed to create audio tag");
|
|
9985
10161
|
}
|
|
9986
|
-
},
|
|
10162
|
+
}, _x, vx = class {
|
|
9987
10163
|
constructor(t, n, r, i, a, o, s, c) {
|
|
9988
|
-
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
|
|
10164
|
+
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 gx()), e(this, "_isPaused", !1), e(this, "isDisconnected", !1), e(this, "timers", new D()), 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 mx()), e(this, "playbackRate", void 0), e(this, "emitVolumeState", () => {
|
|
9989
10165
|
let e = {
|
|
9990
10166
|
volume: this.volume,
|
|
9991
10167
|
isMuted: this.userMuted
|
|
@@ -10027,13 +10203,13 @@ var kb = /* @__PURE__ */ new WeakMap(), Ab = class {
|
|
|
10027
10203
|
e instanceof Error && this.emitter.emit("error", Vn(!1, e));
|
|
10028
10204
|
}
|
|
10029
10205
|
this.isVideoRenderingEnabled && this.videoPlayer.onDecodedFrame(e);
|
|
10030
|
-
}), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer =
|
|
10206
|
+
}), this.logger = n, this.emitter = t, this.pool = r, this.emitter.on("target buffer time", this.onTargetBufferTime), this.audioPlayer = ux.create(this.logger.createContext("AudioPlayerModule"), i, {
|
|
10031
10207
|
muted: a,
|
|
10032
10208
|
reInitWhenStuck: !0,
|
|
10033
10209
|
bufferTime: c
|
|
10034
10210
|
}), o !== void 0 && (this.audioPlayer.volume = o), this.audioPlayer.on("stuck", () => {
|
|
10035
10211
|
this.isDisconnected = !0;
|
|
10036
|
-
}), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer =
|
|
10212
|
+
}), this.audioPlayer.on("state change", this.emitVolumeState), this.videoPlayer = fx.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, void 0, s);
|
|
10037
10213
|
}
|
|
10038
10214
|
get volume() {
|
|
10039
10215
|
return this.audioPlayer.volume;
|
|
@@ -10092,29 +10268,29 @@ var kb = /* @__PURE__ */ new WeakMap(), Ab = class {
|
|
|
10092
10268
|
this._isPaused = !0, this.audioPlayer.pause(), this.emitter.emit("media element state", "paused");
|
|
10093
10269
|
}
|
|
10094
10270
|
};
|
|
10095
|
-
|
|
10271
|
+
_x = vx, e(vx, "create", (e, t, n, r, i, a, o, s) => new _x(e, t, n, r, i, a, o, s));
|
|
10096
10272
|
//#endregion
|
|
10097
10273
|
//#region ../../libs/web-sdk/src/modules/MediaSessionModule.ts
|
|
10098
|
-
var
|
|
10274
|
+
var yx, bx = [
|
|
10099
10275
|
"play",
|
|
10100
10276
|
"pause",
|
|
10101
10277
|
"stop"
|
|
10102
|
-
],
|
|
10278
|
+
], xx, Sx = /* @__PURE__ */ new Set(), Cx = class t {
|
|
10103
10279
|
constructor(n, r, i) {
|
|
10104
10280
|
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", () => {
|
|
10105
|
-
this.isLoaded || !t.isSupported() || (this.isLoaded = !0,
|
|
10281
|
+
this.isLoaded || !t.isSupported() || (this.isLoaded = !0, Sx.add(this), this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("volume state", this.update));
|
|
10106
10282
|
}), e(this, "unload", () => {
|
|
10107
10283
|
var e;
|
|
10108
|
-
this.isLoaded && (this.isLoaded = !1,
|
|
10284
|
+
this.isLoaded && (this.isLoaded = !1, Sx.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());
|
|
10109
10285
|
}), e(this, "stop", () => {
|
|
10110
10286
|
var e;
|
|
10111
|
-
this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(),
|
|
10287
|
+
this.playbackState = void 0, (e = this.options.decoy) == null || e.unload(), xx === this && this.handOverOwnership("on stop");
|
|
10112
10288
|
}), e(this, "getStatistics", () => {
|
|
10113
10289
|
var e;
|
|
10114
10290
|
return {
|
|
10115
10291
|
mediaSessionSupported: t.isSupported(),
|
|
10116
|
-
mediaSessionOwner:
|
|
10117
|
-
mediaSessionPlaybackState:
|
|
10292
|
+
mediaSessionOwner: xx === this,
|
|
10293
|
+
mediaSessionPlaybackState: xx === this ? this.isPaused ? "paused" : "playing" : "none",
|
|
10118
10294
|
decoyState: (e = this.options.decoy) == null ? void 0 : e.getStatistics().decoyState
|
|
10119
10295
|
};
|
|
10120
10296
|
}), e(this, "onPlaybackState", (e) => {
|
|
@@ -10123,23 +10299,23 @@ var Fb, Ib = [
|
|
|
10123
10299
|
this.update();
|
|
10124
10300
|
}), e(this, "update", () => {
|
|
10125
10301
|
if (this.isLoaded) {
|
|
10126
|
-
if (this.isEligibleToOwn &&
|
|
10302
|
+
if (this.isEligibleToOwn && xx !== this) {
|
|
10127
10303
|
this.claimOwnership();
|
|
10128
10304
|
return;
|
|
10129
10305
|
}
|
|
10130
10306
|
this.sync();
|
|
10131
10307
|
}
|
|
10132
10308
|
}), e(this, "handOverOwnership", (e) => {
|
|
10133
|
-
if (
|
|
10309
|
+
if (xx === this) {
|
|
10134
10310
|
this.logger.debug(`Handing over the media session ${e}`), this.releaseOwnership();
|
|
10135
|
-
for (let e of
|
|
10311
|
+
for (let e of Sx) if (e !== this && e.isEligibleToOwn) {
|
|
10136
10312
|
e.claimOwnership();
|
|
10137
10313
|
return;
|
|
10138
10314
|
}
|
|
10139
10315
|
}
|
|
10140
10316
|
}), e(this, "sync", () => {
|
|
10141
10317
|
var e, t, n, r, i, a;
|
|
10142
|
-
if (
|
|
10318
|
+
if (xx !== this) return;
|
|
10143
10319
|
if ((e = (t = this.options).isSuppressed) != null && e.call(t)) {
|
|
10144
10320
|
var o;
|
|
10145
10321
|
(o = this.options.decoy) == null || o.unload(), this.handOverOwnership("as suppressed");
|
|
@@ -10172,8 +10348,8 @@ var Fb, Ib = [
|
|
|
10172
10348
|
(f = this.options.decoy) == null || f.play();
|
|
10173
10349
|
}
|
|
10174
10350
|
}), e(this, "claimOwnership", () => {
|
|
10175
|
-
|
|
10176
|
-
for (let e of
|
|
10351
|
+
xx == null || xx.releaseOwnership(), xx = this, this.pageMetadata = navigator.mediaSession.metadata, this.applyMetadata();
|
|
10352
|
+
for (let e of bx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, this.onAction[e]));
|
|
10177
10353
|
this.safely("position state", () => {
|
|
10178
10354
|
var e, t;
|
|
10179
10355
|
return (e = (t = navigator.mediaSession).setPositionState) == null ? void 0 : e.call(t, {
|
|
@@ -10189,9 +10365,9 @@ var Fb, Ib = [
|
|
|
10189
10365
|
});
|
|
10190
10366
|
}), e(this, "releaseOwnership", () => {
|
|
10191
10367
|
var e;
|
|
10192
|
-
if (
|
|
10193
|
-
|
|
10194
|
-
for (let e of
|
|
10368
|
+
if (xx === this) {
|
|
10369
|
+
xx = void 0, (e = this.options.decoy) == null || e.pause();
|
|
10370
|
+
for (let e of bx) this.safely(e, () => navigator.mediaSession.setActionHandler(e, null));
|
|
10195
10371
|
this.options.metadata && this.safely("metadata restore", () => {
|
|
10196
10372
|
navigator.mediaSession.metadata = this.pageMetadata;
|
|
10197
10373
|
}), this.safely("release", () => {
|
|
@@ -10225,15 +10401,15 @@ var Fb, Ib = [
|
|
|
10225
10401
|
return this.playbackState !== void 0 && !this.isPaused && !this.options.isMuted() && ((e = (t = this.options).isSuppressed) == null ? void 0 : e.call(t)) !== !0;
|
|
10226
10402
|
}
|
|
10227
10403
|
};
|
|
10228
|
-
|
|
10404
|
+
yx = Cx, e(Cx, "create", (e, t, n) => new yx(e, t, n)), e(Cx, "isSupported", () => typeof navigator < "u" && "mediaSession" in navigator && typeof MediaMetadata < "u");
|
|
10229
10405
|
//#endregion
|
|
10230
10406
|
//#region ../../libs/web-sdk/src/modules/ModernCanvasModule.ts
|
|
10231
|
-
var
|
|
10407
|
+
var wx, Tx = class {
|
|
10232
10408
|
constructor(t, r, i, a, { muted: o, volume: s, type: c, poster: l, offscreenCanvas: u, bufferTime: d, backgroundPlaybackEnabled: f, splitAudio: p }) {
|
|
10233
10409
|
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 D()), 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", (() => {
|
|
10234
10410
|
let e = qe().platform;
|
|
10235
10411
|
return e.isIOS && e.iosVersion <= 16;
|
|
10236
|
-
})()), e(this, "volumeState", void 0), e(this, "textTracks", new
|
|
10412
|
+
})()), e(this, "volumeState", void 0), e(this, "textTracks", new mx()), e(this, "reset", () => {}), e(this, "load", () => {
|
|
10237
10413
|
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);
|
|
10238
10414
|
}), e(this, "unload", () => {
|
|
10239
10415
|
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);
|
|
@@ -10386,13 +10562,13 @@ var Bb, Vb = class {
|
|
|
10386
10562
|
}), this.soundElement.on("media element state", (e) => {
|
|
10387
10563
|
e === "paused" && this.audioPlayer.flushBuffer(), this.audioPlayer.sinkPaused = e === "paused", this.emitPlaybackState();
|
|
10388
10564
|
}), 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));
|
|
10389
|
-
this.audioPlayer =
|
|
10565
|
+
this.audioPlayer = ux.create(this.logger.createContext("AudioPlayerModule"), a, {
|
|
10390
10566
|
muted: !1,
|
|
10391
10567
|
reInitWhenStuck: !1,
|
|
10392
10568
|
bufferTime: d
|
|
10393
10569
|
}), this.audioPlayer.on("state change", (e) => {
|
|
10394
10570
|
e === "suspended" || e === "interrupted" ? this.soundElement.muted = !0 : e === "running" && this.applyVisibilityMutePolicy(), this.updateVolumeState();
|
|
10395
|
-
}), this.videoPlayer =
|
|
10571
|
+
}), this.videoPlayer = fx.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool, this.mediaElement.element, () => this.reconnectCanvasStream(), this.onVideoPlayerError);
|
|
10396
10572
|
}
|
|
10397
10573
|
get volume() {
|
|
10398
10574
|
return this.soundElement.volume;
|
|
@@ -10464,10 +10640,10 @@ var Bb, Vb = class {
|
|
|
10464
10640
|
return this.renderCanvasSubtitlesInNativeFullscreen && !this.offscreenCanvas;
|
|
10465
10641
|
}
|
|
10466
10642
|
};
|
|
10467
|
-
|
|
10643
|
+
wx = Tx, e(Tx, "create", (e, t, n, r, i) => new wx(e, t, n, r, i));
|
|
10468
10644
|
//#endregion
|
|
10469
10645
|
//#region ../../libs/web-sdk/src/modules/MseModule.ts
|
|
10470
|
-
var
|
|
10646
|
+
var Ex, Dx = class {
|
|
10471
10647
|
constructor() {
|
|
10472
10648
|
e(this, "initSegments", /* @__PURE__ */ new Map()), e(this, "set", (e, t, n) => {
|
|
10473
10649
|
var r;
|
|
@@ -10479,7 +10655,7 @@ var Hb, Ub = class {
|
|
|
10479
10655
|
});
|
|
10480
10656
|
}
|
|
10481
10657
|
};
|
|
10482
|
-
function
|
|
10658
|
+
function Ox(e, { mediaSource: t, mimeType: n, codec: r }) {
|
|
10483
10659
|
return y(y({}, e), {}, {
|
|
10484
10660
|
state: "initialized",
|
|
10485
10661
|
mimeType: n,
|
|
@@ -10491,10 +10667,10 @@ function Wb(e, { mediaSource: t, mimeType: n, codec: r }) {
|
|
|
10491
10667
|
lastBufferCleanupTime: performance.now()
|
|
10492
10668
|
});
|
|
10493
10669
|
}
|
|
10494
|
-
function
|
|
10670
|
+
function kx({ initSegments: e, pendingSamples: t }) {
|
|
10495
10671
|
return {
|
|
10496
10672
|
state: "uninitialized",
|
|
10497
|
-
initSegments: e == null ? new
|
|
10673
|
+
initSegments: e == null ? new Dx() : e,
|
|
10498
10674
|
sequenceNumber: 0,
|
|
10499
10675
|
isWorkingOnPendingSamples: !1,
|
|
10500
10676
|
hasFirstSync: t.some((e) => e.isSync),
|
|
@@ -10504,7 +10680,7 @@ function Gb({ initSegments: e, pendingSamples: t }) {
|
|
|
10504
10680
|
successfulAppendCalls: 0
|
|
10505
10681
|
};
|
|
10506
10682
|
}
|
|
10507
|
-
var
|
|
10683
|
+
var Ax = class {
|
|
10508
10684
|
constructor(r, i, a) {
|
|
10509
10685
|
var o = this;
|
|
10510
10686
|
e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", D.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new Xs()), 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", () => {
|
|
@@ -10550,7 +10726,7 @@ var Kb = class {
|
|
|
10550
10726
|
var n, r, i;
|
|
10551
10727
|
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;
|
|
10552
10728
|
for (; c < o.length && !((i = o[c]) != null && i.isSync);) c++;
|
|
10553
|
-
let l =
|
|
10729
|
+
let l = kx({
|
|
10554
10730
|
pendingSamples: o,
|
|
10555
10731
|
initSegments: s
|
|
10556
10732
|
});
|
|
@@ -10561,14 +10737,14 @@ var Kb = class {
|
|
|
10561
10737
|
this.trackContexts.forEach((e, n) => {
|
|
10562
10738
|
if (t.has(n)) return;
|
|
10563
10739
|
e.state === "initialized" && this.mediaSource.isOpen() && this.mediaSource.removeSourceBuffer(e.sourceBuffer);
|
|
10564
|
-
let r =
|
|
10740
|
+
let r = kx({
|
|
10565
10741
|
pendingSamples: [],
|
|
10566
10742
|
initSegments: e.initSegments
|
|
10567
10743
|
});
|
|
10568
10744
|
this.trackContexts.set(n, r);
|
|
10569
10745
|
});
|
|
10570
10746
|
}), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "initializeSourceBuffer", (e, t) => {
|
|
10571
|
-
let n =
|
|
10747
|
+
let n = Ox(e, {
|
|
10572
10748
|
mimeType: t.mimeType,
|
|
10573
10749
|
mediaSource: this.mediaSource,
|
|
10574
10750
|
codec: t.codec
|
|
@@ -10595,9 +10771,9 @@ var Kb = class {
|
|
|
10595
10771
|
}
|
|
10596
10772
|
for (let t of e) {
|
|
10597
10773
|
let n = o.trackContexts.get(t.type);
|
|
10598
|
-
if (n || (n =
|
|
10774
|
+
if (n || (n = kx({
|
|
10599
10775
|
pendingSamples: [],
|
|
10600
|
-
initSegments: new
|
|
10776
|
+
initSegments: new Dx()
|
|
10601
10777
|
}), o.trackContexts.set(t.type, n)), n.state === "initialized") {
|
|
10602
10778
|
if (t.mimeType !== n.sourceBufferMimeType) try {
|
|
10603
10779
|
yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
|
|
@@ -10614,7 +10790,7 @@ var Kb = class {
|
|
|
10614
10790
|
o.logger.warn("removeSourceBuffer failed", { removeError: t }), o.reopenMediaSource("changeType recovery failed"), o.pendingTracksToAddSourceBuffers = e;
|
|
10615
10791
|
return;
|
|
10616
10792
|
}
|
|
10617
|
-
let i =
|
|
10793
|
+
let i = kx({
|
|
10618
10794
|
pendingSamples: n.pendingSamples,
|
|
10619
10795
|
initSegments: n.initSegments
|
|
10620
10796
|
});
|
|
@@ -10638,7 +10814,7 @@ var Kb = class {
|
|
|
10638
10814
|
};
|
|
10639
10815
|
}), e(this, "getNextBufferedRangeStart", (e) => {
|
|
10640
10816
|
let t = this.getCommonBufferedRangesForCurrentTracks();
|
|
10641
|
-
if (t) return
|
|
10817
|
+
if (t) return jx(e, t);
|
|
10642
10818
|
}), e(this, "getBufferedEndAt", (e) => {
|
|
10643
10819
|
var t;
|
|
10644
10820
|
let n = this.getCommonBufferedRangesForCurrentTracks();
|
|
@@ -10688,7 +10864,10 @@ var Kb = class {
|
|
|
10688
10864
|
s > 0 && performance.now() - r.lastBufferCleanupTime > 1e4 && (r.lastBufferCleanupTime = performance.now(), yield r.sourceBuffer.removeBuffer(0, s + 10));
|
|
10689
10865
|
try {
|
|
10690
10866
|
let t = r.sequenceNumber;
|
|
10691
|
-
if ("fragmented" in n) for (let t of e)
|
|
10867
|
+
if ("fragmented" in n) for (let t of Ix(e)) {
|
|
10868
|
+
var c;
|
|
10869
|
+
yield r.sourceBuffer.appendBuffer(Lx(t.map((e) => e.data)), (c = t[0]) == null ? void 0 : c.initData);
|
|
10870
|
+
}
|
|
10692
10871
|
else {
|
|
10693
10872
|
let n = Is(e, t++);
|
|
10694
10873
|
yield r.sourceBuffer.appendBuffer(n);
|
|
@@ -10734,18 +10913,19 @@ var Kb = class {
|
|
|
10734
10913
|
if (e.duration === 0) return;
|
|
10735
10914
|
let t = this.trackContexts.get(e.type);
|
|
10736
10915
|
if (!t) throw Wn(e.type, e.renditionId);
|
|
10737
|
-
|
|
10916
|
+
let n = t.pendingSamples.length - t.pendingSamplesOffset;
|
|
10917
|
+
if (t.state === "uninitialized" && n >= Nx && (e.isSync || n >= 2 * Nx) && (t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1), !(!t.hasFirstSync && !e.isSync)) {
|
|
10738
10918
|
if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
|
|
10739
10919
|
this.hasAddedInitialPosterFrame = !1;
|
|
10740
10920
|
let n = y({}, e);
|
|
10741
10921
|
"fragment" in n ? (n.fragment = n.fragment.clone(), n.fragment.updateBaseMediaDecodeTime(0), n.data = n.fragment.rawBytes()) : n.timestamp = 0, t.pendingSamples.push(n);
|
|
10742
10922
|
}
|
|
10743
10923
|
if (t.hasFirstSync = !0, t.pendingSamples.push(e), e.type === "video" && e.isSync) {
|
|
10744
|
-
var
|
|
10745
|
-
let t = (e.timestamp + ((
|
|
10746
|
-
|
|
10924
|
+
var r;
|
|
10925
|
+
let t = (e.timestamp + ((r = e.compositionTimeOffset) == null ? 0 : r)) / e.timescale * 1e3, n = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
|
|
10926
|
+
n !== void 0 && t < n && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(t), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
|
|
10747
10927
|
}
|
|
10748
|
-
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples ||
|
|
10928
|
+
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || zx(t, this.append, this.maxChunkSize).catch((n) => {
|
|
10749
10929
|
if (t.isWorkingOnPendingSamples = !1, !this.isReopening) {
|
|
10750
10930
|
if (!this.isCurrentTrackContext(e.type, t)) {
|
|
10751
10931
|
this.logger.debug("Suppressing append error from stale track context", { type: e.type });
|
|
@@ -10864,14 +11044,14 @@ var Kb = class {
|
|
|
10864
11044
|
if (this.mediaSource.isClosed()) return;
|
|
10865
11045
|
let e = this.getInitializedTrackBuffers();
|
|
10866
11046
|
if (e.length !== 0) return this.getCommonBufferedRanges(e);
|
|
10867
|
-
}), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) =>
|
|
11047
|
+
}), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) => Fx(e, t), e[0] ? Array.from(e[0]) : [])), e(this, "getPlaybackStateForBufferedRanges", (e, t) => an(t, e) ? "playing" : "buffering"), this.logger = r, this.mediaElement = a, this.emitter = i;
|
|
10868
11048
|
}
|
|
10869
11049
|
};
|
|
10870
|
-
|
|
10871
|
-
let r = new
|
|
11050
|
+
Ex = Ax, e(Ax, "create", (e, t, n) => {
|
|
11051
|
+
let r = new Ex(e, t, n);
|
|
10872
11052
|
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;
|
|
10873
11053
|
});
|
|
10874
|
-
var
|
|
11054
|
+
var jx = (e, t) => {
|
|
10875
11055
|
for (let r = 0; r < t.length; r++) {
|
|
10876
11056
|
let i = t[r];
|
|
10877
11057
|
if (i) {
|
|
@@ -10882,11 +11062,11 @@ var qb = (e, t) => {
|
|
|
10882
11062
|
}
|
|
10883
11063
|
}
|
|
10884
11064
|
}
|
|
10885
|
-
},
|
|
11065
|
+
}, Mx = (e, t) => {
|
|
10886
11066
|
var n;
|
|
10887
11067
|
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;
|
|
10888
11068
|
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;
|
|
10889
|
-
},
|
|
11069
|
+
}, Nx = 1e3, Px = 32, Fx = (e, t) => {
|
|
10890
11070
|
let n = [], r = 0, i = 0;
|
|
10891
11071
|
for (; r < e.length && i < t.length;) {
|
|
10892
11072
|
let a = e[r], o = t[i];
|
|
@@ -10898,16 +11078,30 @@ var qb = (e, t) => {
|
|
|
10898
11078
|
}), a.end <= o.end ? r++ : i++;
|
|
10899
11079
|
}
|
|
10900
11080
|
return n;
|
|
10901
|
-
},
|
|
11081
|
+
}, Ix = (e) => {
|
|
11082
|
+
let t = [];
|
|
11083
|
+
for (let r of e) {
|
|
11084
|
+
var n;
|
|
11085
|
+
if (!("fragmented" in r)) continue;
|
|
11086
|
+
let e = t[t.length - 1];
|
|
11087
|
+
(e == null || (n = e[0]) == null ? void 0 : n.initData) === r.initData ? e.push(r) : t.push([r]);
|
|
11088
|
+
}
|
|
11089
|
+
return t;
|
|
11090
|
+
}, Lx = (e) => {
|
|
11091
|
+
if (e.length === 1 && e[0]) return e[0];
|
|
11092
|
+
let t = new Uint8Array(e.reduce((e, t) => e + t.byteLength, 0)), n = 0;
|
|
11093
|
+
for (let r of e) t.set(r, n), n += r.byteLength;
|
|
11094
|
+
return t;
|
|
11095
|
+
}, Rx = (e) => {
|
|
10902
11096
|
let t = e.pendingSamplesOffset;
|
|
10903
11097
|
if (t !== 0) {
|
|
10904
11098
|
if (t >= e.pendingSamples.length) {
|
|
10905
11099
|
e.pendingSamples = [], e.pendingSamplesOffset = 0;
|
|
10906
11100
|
return;
|
|
10907
11101
|
}
|
|
10908
|
-
t <
|
|
11102
|
+
t < Px || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0);
|
|
10909
11103
|
}
|
|
10910
|
-
},
|
|
11104
|
+
}, zx = function() {
|
|
10911
11105
|
var e = t(function* (e, t, n) {
|
|
10912
11106
|
for (e.isWorkingOnPendingSamples = !0; e.pendingSamplesOffset < e.pendingSamples.length;) {
|
|
10913
11107
|
let r = [], i = e.pendingSamplesOffset;
|
|
@@ -10915,7 +11109,7 @@ var qb = (e, t) => {
|
|
|
10915
11109
|
i = t;
|
|
10916
11110
|
let a = e.pendingSamples[t], o = e.pendingSamples[t + 1];
|
|
10917
11111
|
if (a && (r.push(a), o)) {
|
|
10918
|
-
if (
|
|
11112
|
+
if (Mx(a, o)) break;
|
|
10919
11113
|
let e = (a.timestamp + a.duration) / a.timescale;
|
|
10920
11114
|
if (o.timestamp / o.timescale - e > .1) break;
|
|
10921
11115
|
}
|
|
@@ -10923,14 +11117,14 @@ var qb = (e, t) => {
|
|
|
10923
11117
|
}
|
|
10924
11118
|
let a = r[0];
|
|
10925
11119
|
if (!a) break;
|
|
10926
|
-
yield t(r, e.previousSample ?
|
|
11120
|
+
yield t(r, e.previousSample ? Mx(e.previousSample, a) : !0), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], Rx(e);
|
|
10927
11121
|
}
|
|
10928
11122
|
e.isWorkingOnPendingSamples = !1;
|
|
10929
11123
|
});
|
|
10930
11124
|
return function(t, n, r) {
|
|
10931
11125
|
return e.apply(this, arguments);
|
|
10932
11126
|
};
|
|
10933
|
-
}(),
|
|
11127
|
+
}(), Bx, Vx = class {
|
|
10934
11128
|
constructor(n, r) {
|
|
10935
11129
|
var i = this;
|
|
10936
11130
|
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "element", void 0), e(this, "pictureInPictureWindow", void 0), e(this, "unload", () => {
|
|
@@ -10962,10 +11156,10 @@ var qb = (e, t) => {
|
|
|
10962
11156
|
}()), e(this, "isWebkitPresentationModeSupported", () => !!this.element && dt(this.element)), this.emitter = n, this.logger = r, this.emitter.on("add picture in picture listener", this.onEnablePictureInPicture);
|
|
10963
11157
|
}
|
|
10964
11158
|
};
|
|
10965
|
-
|
|
11159
|
+
Bx = Vx, e(Vx, "create", (e, t) => new Bx(e, t));
|
|
10966
11160
|
//#endregion
|
|
10967
11161
|
//#region ../../libs/web-sdk/src/modules/PlaybackModule.ts
|
|
10968
|
-
var
|
|
11162
|
+
var Hx, Ux = class {
|
|
10969
11163
|
constructor(t, n, r, i) {
|
|
10970
11164
|
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", () => {
|
|
10971
11165
|
this.emitter.off("buffer state", this.onBufferedStateChanged), this.emitter.off("needs user input", this.onNeedsUserInput);
|
|
@@ -10983,29 +11177,31 @@ var tx, nx = class {
|
|
|
10983
11177
|
}), 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);
|
|
10984
11178
|
}
|
|
10985
11179
|
};
|
|
10986
|
-
|
|
11180
|
+
Hx = Ux, e(Ux, "create", (e, t, n, r) => new Hx(e, t, n, r));
|
|
10987
11181
|
//#endregion
|
|
10988
11182
|
//#region ../../libs/web-sdk/src/modules/QualityOfServiceModule.ts
|
|
10989
|
-
var
|
|
11183
|
+
var Wx, Gx = () => ({
|
|
10990
11184
|
upgradesFromLevel: [],
|
|
10991
11185
|
downgradesFromLevel: [],
|
|
10992
11186
|
bufferingRanges: [],
|
|
10993
11187
|
activeRanges: [],
|
|
10994
11188
|
decodeRate: 2 ** 53 - 1
|
|
10995
|
-
}),
|
|
11189
|
+
}), Kx = () => ({
|
|
10996
11190
|
levels: {},
|
|
10997
11191
|
levelDowngrades: [],
|
|
10998
11192
|
levelUpgrades: [],
|
|
10999
11193
|
bufferFullness: 0,
|
|
11000
|
-
general:
|
|
11001
|
-
}),
|
|
11194
|
+
general: Gx()
|
|
11195
|
+
}), qx = 100, Jx = 3600, Yx = 1e3, Xx = class {
|
|
11002
11196
|
constructor(t, n, i, a) {
|
|
11003
|
-
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", D.create()), e(this, "metrics",
|
|
11197
|
+
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", D.create()), e(this, "metrics", Kx()), 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", () => {
|
|
11004
11198
|
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);
|
|
11005
11199
|
}), e(this, "unload", () => {
|
|
11006
11200
|
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();
|
|
11007
11201
|
}), e(this, "suspend", () => {
|
|
11008
11202
|
this.isSuspended = !0, this.timers.unload(), this.bufferFullness.clear(), this.bufferFullnessRegression = void 0, this.stopBuffering(), this.unsetActive(), this.hasPlayedInSession = !1;
|
|
11203
|
+
}), e(this, "reset", () => {
|
|
11204
|
+
this.bufferFullness.clear(), this.bufferFullnessRegression = void 0;
|
|
11009
11205
|
}), e(this, "unsuspend", () => {
|
|
11010
11206
|
this.isSuspended = !1, this.currentLevel && this.setActive();
|
|
11011
11207
|
}), e(this, "fatalQosGraceTime", () => 1e4 * (this.fatalQosCount + 1)), e(this, "incrementFatalQosCount", () => {
|
|
@@ -11016,7 +11212,7 @@ var rx, ix = () => ({
|
|
|
11016
11212
|
return this.metrics.levels[a];
|
|
11017
11213
|
}), e(this, "getBufferFullnessRegression", (e = !1) => {
|
|
11018
11214
|
if (!e) return this.bufferFullnessRegression;
|
|
11019
|
-
if (performance.now() - this.lastDeliveryResumeTime <
|
|
11215
|
+
if (performance.now() - this.lastDeliveryResumeTime < Yx) return;
|
|
11020
11216
|
let t = this.bufferFullness.items().filter(({ time: e }) => e >= this.lastDeliveryResumeTime);
|
|
11021
11217
|
return t.length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression(t) : void 0;
|
|
11022
11218
|
}), e(this, "getTargetBufferTime", () => {
|
|
@@ -11076,21 +11272,21 @@ var rx, ix = () => ({
|
|
|
11076
11272
|
let d = !1;
|
|
11077
11273
|
if (e.from) {
|
|
11078
11274
|
var f;
|
|
11079
|
-
let e = (f = this.metrics.levels[l]) == null ?
|
|
11275
|
+
let e = (f = this.metrics.levels[l]) == null ? Gx() : f;
|
|
11080
11276
|
l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), $t(e.activeRanges);
|
|
11081
11277
|
let t = e.bufferingRanges[e.bufferingRanges.length - 1];
|
|
11082
11278
|
d = !!t && !t.end, $t(e.bufferingRanges), this.metrics.levels[l] = e;
|
|
11083
11279
|
}
|
|
11084
11280
|
if (e.to) {
|
|
11085
11281
|
var p;
|
|
11086
|
-
let e = (p = this.metrics.levels[u]) == null ?
|
|
11282
|
+
let e = (p = this.metrics.levels[u]) == null ? Gx() : p;
|
|
11087
11283
|
en(e.activeRanges), d && en(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
|
|
11088
11284
|
}
|
|
11089
11285
|
}), e(this, "onMediaDeliveryResumed", () => {
|
|
11090
11286
|
this.lastDeliveryResumeTime = performance.now();
|
|
11091
11287
|
}), e(this, "onBufferFullness", (e) => {
|
|
11092
11288
|
if (this.metrics.bufferFullness = e, this.isSuspended) return;
|
|
11093
|
-
let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e /
|
|
11289
|
+
let t = performance.now(), n = this.bufferFullness.peekLast(), r = (e) => Math.floor(e / qx);
|
|
11094
11290
|
if (n && r(n.time) === r(t)) n.time = t, n.value = e;
|
|
11095
11291
|
else {
|
|
11096
11292
|
var i, a;
|
|
@@ -11098,7 +11294,7 @@ var rx, ix = () => ({
|
|
|
11098
11294
|
time: t,
|
|
11099
11295
|
value: e
|
|
11100
11296
|
});
|
|
11101
|
-
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 -
|
|
11297
|
+
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 - Jx, r);
|
|
11102
11298
|
this.bufferFullness.filterPop(({ time: e }) => e >= o);
|
|
11103
11299
|
}
|
|
11104
11300
|
this.bufferFullnessRegression = this.bufferFullness.items().length >= this.minBufferFullnessLengthForRegression ? this.calculateLinearRegression() : void 0;
|
|
@@ -11170,10 +11366,10 @@ var rx, ix = () => ({
|
|
|
11170
11366
|
en(this.metrics.general.activeRanges);
|
|
11171
11367
|
}
|
|
11172
11368
|
};
|
|
11173
|
-
|
|
11369
|
+
Wx = Xx, e(Xx, "create", (e, t, n, r) => new Wx(e, t, n, r));
|
|
11174
11370
|
//#endregion
|
|
11175
11371
|
//#region ../../libs/web-sdk/src/modules/RenditionsModule.ts
|
|
11176
|
-
var
|
|
11372
|
+
var Zx, Qx = class {
|
|
11177
11373
|
constructor(t, n) {
|
|
11178
11374
|
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", () => {
|
|
11179
11375
|
this.emitter.off("renditions", this.onRenditions), this.emitter.off("subscription changed", this.onSubscriptionChanged);
|
|
@@ -11223,7 +11419,7 @@ var ux, dx = class {
|
|
|
11223
11419
|
from: t
|
|
11224
11420
|
});
|
|
11225
11421
|
}), e(this, "onSubscriptionChanged", (e) => {
|
|
11226
|
-
this.updateRenditionLevels(e);
|
|
11422
|
+
this.updateRenditionLevels(e.reset ? y(y({}, e), {}, { to: e.from }) : e);
|
|
11227
11423
|
}), e(this, "updateRenditionLevels", ({ to: e, from: t }) => {
|
|
11228
11424
|
var n;
|
|
11229
11425
|
let { channelId: r, initiator: i } = e, a = this.getRenditionLevel(t), o = /* @__PURE__ */ new Set();
|
|
@@ -11248,64 +11444,10 @@ var ux, dx = class {
|
|
|
11248
11444
|
}), 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);
|
|
11249
11445
|
}
|
|
11250
11446
|
};
|
|
11251
|
-
|
|
11252
|
-
//#endregion
|
|
11253
|
-
//#region ../../libs/web-sdk/src/modules/SubscriptionModule.ts
|
|
11254
|
-
var fx, px = (e) => JSON.parse(JSON.stringify(e)), mx = 1e4, hx = class {
|
|
11255
|
-
constructor(t, n, r) {
|
|
11256
|
-
e(this, "logger", void 0), e(this, "timers", new D()), e(this, "emitter", void 0), e(this, "targetSubscription", void 0), e(this, "currentSubscription", void 0), e(this, "_isSwitchingSubscription", !1), e(this, "pendingSubscriptionTimeoutId", void 0), e(this, "burstMs", 0), e(this, "unload", () => {
|
|
11257
|
-
this.logger.debug("Unloading module..."), this.timers.unload(), this.emitter.off("subscription changed", this.onSubscriptionChanged), this.logger.debug("Unloaded module");
|
|
11258
|
-
}), e(this, "isSwitchingSubscription", () => this._isSwitchingSubscription), e(this, "getTargetSubscription", () => this.targetSubscription), e(this, "getCurrentSubscription", () => this.currentSubscription), e(this, "enableBurst", (e) => {
|
|
11259
|
-
this.burstMs = e;
|
|
11260
|
-
}), e(this, "setSize", (e) => {
|
|
11261
|
-
this.targetSubscription.video.width = e.width, this.targetSubscription.video.height = e.height, this.scheduleSubscriptionChange();
|
|
11262
|
-
}), e(this, "setVideoConstraint", (e) => {
|
|
11263
|
-
this.targetSubscription.video = e, this.scheduleSubscriptionChange();
|
|
11264
|
-
}), e(this, "setAudioConstraint", (e) => {
|
|
11265
|
-
this.targetSubscription.audio = e, this.scheduleSubscriptionChange();
|
|
11266
|
-
}), e(this, "setVideoBitRate", (e) => {
|
|
11267
|
-
this.targetSubscription.video.bitRate = e, this.scheduleSubscriptionChange();
|
|
11268
|
-
}), e(this, "setAudioBitRate", (e) => {
|
|
11269
|
-
this.targetSubscription.audio.bitRate = e, this.scheduleSubscriptionChange();
|
|
11270
|
-
}), e(this, "setChannelId", (e) => {
|
|
11271
|
-
this.targetSubscription.channelId = e, this.scheduleSubscriptionChange();
|
|
11272
|
-
}), e(this, "setLanguage", (e) => {
|
|
11273
|
-
this.targetSubscription.audio.language = e, this.scheduleSubscriptionChange();
|
|
11274
|
-
}), e(this, "setVideoCodec", (e) => {
|
|
11275
|
-
this.targetSubscription.video.codec = e, this.scheduleSubscriptionChange();
|
|
11276
|
-
}), e(this, "setAudioCodec", (e) => {
|
|
11277
|
-
this.targetSubscription.audio.codec = e, this.scheduleSubscriptionChange();
|
|
11278
|
-
}), e(this, "setBurst", (e) => {
|
|
11279
|
-
e ? this.targetSubscription.burstMs = e : delete this.targetSubscription.burstMs;
|
|
11280
|
-
}), e(this, "isNewSubscription", () => {
|
|
11281
|
-
let e = [
|
|
11282
|
-
"burstMs",
|
|
11283
|
-
"meta",
|
|
11284
|
-
"initiator",
|
|
11285
|
-
"channelGroupId"
|
|
11286
|
-
];
|
|
11287
|
-
return !Et(Jt(this.currentSubscription, e), Jt(this.targetSubscription, e));
|
|
11288
|
-
}), e(this, "onSubscriptionChanged", ({ to: e, reset: t }) => {
|
|
11289
|
-
this.logger.debug("onSubscriptionChanged", {
|
|
11290
|
-
to: e,
|
|
11291
|
-
reset: t
|
|
11292
|
-
}), t ? this.targetSubscription = px(this.currentSubscription) : this.currentSubscription = px(e), this._isSwitchingSubscription = this.isNewSubscription();
|
|
11293
|
-
}), e(this, "scheduleSubscriptionChange", () => {
|
|
11294
|
-
this.targetSubscription = px(this.targetSubscription), this._isSwitchingSubscription = this.isNewSubscription();
|
|
11295
|
-
let e = this.currentSubscription.channelId, t = this.targetSubscription.channelId, n = e !== t;
|
|
11296
|
-
this._isSwitchingSubscription && (n && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), n && this.timers.setTimeout(() => {
|
|
11297
|
-
this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = px(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
|
|
11298
|
-
}, mx), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(() => this.emitter.emit("send signal", {
|
|
11299
|
-
type: "subscribe",
|
|
11300
|
-
subscription: this.getTargetSubscription()
|
|
11301
|
-
}), 0));
|
|
11302
|
-
}), this.logger = t, this.targetSubscription = n, this.currentSubscription = px(n), this.emitter = r, this.emitter.on("subscription changed", this.onSubscriptionChanged);
|
|
11303
|
-
}
|
|
11304
|
-
};
|
|
11305
|
-
fx = hx, e(hx, "create", (e, t, n) => new fx(e, n, t));
|
|
11447
|
+
Zx = Qx, e(Qx, "create", (e, t) => new Zx(e, t));
|
|
11306
11448
|
//#endregion
|
|
11307
11449
|
//#region ../../libs/web-sdk/src/BFrameTracker.ts
|
|
11308
|
-
var
|
|
11450
|
+
var $x = class t {
|
|
11309
11451
|
constructor() {
|
|
11310
11452
|
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 Dt(t.MAX_REMEMBERED_RENDITIONS));
|
|
11311
11453
|
}
|
|
@@ -11341,7 +11483,7 @@ var gx = class t {
|
|
|
11341
11483
|
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;
|
|
11342
11484
|
}
|
|
11343
11485
|
remember(e) {
|
|
11344
|
-
this.channelId !== void 0 && this.rememberedRenditions.set(
|
|
11486
|
+
this.channelId !== void 0 && this.rememberedRenditions.set(Ib(this.channelId, this.renditionId), e);
|
|
11345
11487
|
}
|
|
11346
11488
|
latchBFrames() {
|
|
11347
11489
|
this.hasBFramesValue = !0, this.hasObservedReordering = !0, this.isAwaitingAssessment = !1, this.remember(!0);
|
|
@@ -11353,18 +11495,18 @@ var gx = class t {
|
|
|
11353
11495
|
this.hasSeenKeyframe && !this.hasObservedReordering && (this.remember(!1), this.hasBFramesValue = !1), this.hasSeenKeyframe = !0, this.omittedBoundaryCrossings = 0;
|
|
11354
11496
|
}
|
|
11355
11497
|
resetOnSwitch(e, t) {
|
|
11356
|
-
if (
|
|
11498
|
+
if (!Lb(e, t, this.channelId, this.renditionId)) {
|
|
11357
11499
|
let n = this.channelId !== void 0;
|
|
11358
11500
|
this.channelId = e, this.renditionId = t, this.anchorCts = void 0, this.zeroOffsetSamples = 0, this.omittedBoundaryCrossings = 0, this.hasSeenKeyframe = !1, this.hasObservedReordering = !1;
|
|
11359
|
-
let r = this.rememberedRenditions.get(
|
|
11501
|
+
let r = this.rememberedRenditions.get(Ib(e, t));
|
|
11360
11502
|
this.hasBFramesValue = r == null ? !1 : r, n && (this.isAwaitingAssessment = r === void 0);
|
|
11361
11503
|
}
|
|
11362
11504
|
}
|
|
11363
11505
|
};
|
|
11364
|
-
e(
|
|
11506
|
+
e($x, "MAX_REMEMBERED_RENDITIONS", 32);
|
|
11365
11507
|
//#endregion
|
|
11366
11508
|
//#region ../../libs/web-sdk/src/modules/SyncModule.ts
|
|
11367
|
-
var
|
|
11509
|
+
var eS, tS = 5e3, nS = .5, rS = 3e3, iS = () => Fe() || Me(), aS = (e) => e && iS() ? 100 : 0, oS = (e) => (t) => t > e, sS = 100, cS = 1e3, lS = 1e3, uS = 1e3, dS = 100, fS = 50, pS = {
|
|
11368
11510
|
seek: {
|
|
11369
11511
|
toleranceMs: 200,
|
|
11370
11512
|
toleranceMaxMs: 2500,
|
|
@@ -11396,7 +11538,7 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11396
11538
|
decayCooldownMultiplier: 3,
|
|
11397
11539
|
decayCheckInterval: 15e3
|
|
11398
11540
|
}
|
|
11399
|
-
},
|
|
11541
|
+
}, mS = class {
|
|
11400
11542
|
get driftSamplesToCollect() {
|
|
11401
11543
|
return this._driftSamplesToCollect;
|
|
11402
11544
|
}
|
|
@@ -11404,8 +11546,8 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11404
11546
|
this._driftSamplesToCollect = e, this.driftSamples = new r(e);
|
|
11405
11547
|
}
|
|
11406
11548
|
constructor(t, n, i, a, o, s = !0) {
|
|
11407
|
-
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, "needsMediaSourceRecovery", !1), e(this, "lastAdjustmentTime", performance.now()), e(this, "lastDecayCheckTime", performance.now()), e(this, "syncInterval", void 0), e(this, "currentSyncIntervalMs",
|
|
11408
|
-
this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ?
|
|
11549
|
+
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", sS), 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", D.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 $x()), 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", () => {
|
|
11550
|
+
this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? cS : sS);
|
|
11409
11551
|
}), e(this, "unload", () => {
|
|
11410
11552
|
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");
|
|
11411
11553
|
}), e(this, "suspend", () => {
|
|
@@ -11423,7 +11565,7 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11423
11565
|
var e;
|
|
11424
11566
|
return (e = this.timestampOffset) == null ? 0 : e;
|
|
11425
11567
|
}), e(this, "getCurrentChannelId", () => this.currentChannelId), e(this, "resetSyncState", () => {
|
|
11426
|
-
this.state.seekToleranceMultiplier = 1, this.state.timeshiftToleranceMultiplier = 1, this.seekAdjustmentTimestamps = [], this.timeshiftAdjustmentTimestamps = [], this.driftSamples.clear(), this.playbackState = void 0, this.hasPerformedRecoverySeekInCurrentRecoveryState = !1, this.hasPerformedStuckSeekInCurrentStillness = !1, this.clearRecoverySeekFlags();
|
|
11568
|
+
this.state.seekToleranceMultiplier = 1, this.state.timeshiftToleranceMultiplier = 1, this.seekAdjustmentTimestamps = [], this.timeshiftAdjustmentTimestamps = [], this.driftSamples.clear(), this.timeshiftDeferralStartedAt = void 0, this.playbackState = void 0, this.hasPerformedRecoverySeekInCurrentRecoveryState = !1, this.hasPerformedStuckSeekInCurrentStillness = !1, this.clearRecoverySeekFlags();
|
|
11427
11569
|
}), e(this, "getEffectiveSeekToleranceMs", () => this.config.timeshift.enabled ? this.config.seek.toleranceMs * 2 : this.config.seek.toleranceMs), e(this, "isTimeshiftUnsafe", () => this.usesMse && (this.hasObservedBFrames || this.bFrameDetector.isAwaitingReorderAssessment)), e(this, "clearBFrameLatch", () => {
|
|
11428
11570
|
this.hasObservedBFrames = !1;
|
|
11429
11571
|
}), e(this, "latchBFramesIfDetected", () => {
|
|
@@ -11447,7 +11589,7 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11447
11589
|
}), e(this, "processSample", (e) => {
|
|
11448
11590
|
var t;
|
|
11449
11591
|
if (!e.channelId) throw Error("Sample must be assigned to a channel");
|
|
11450
|
-
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 -
|
|
11592
|
+
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - tS);
|
|
11451
11593
|
let n = e.type === "video" && e.isSync;
|
|
11452
11594
|
if (this.bFrameDetector.update(e), this.latchBFramesIfDetected(), this.currentChannelId !== e.channelId) {
|
|
11453
11595
|
let t = 2 ** 53 - 1;
|
|
@@ -11455,8 +11597,8 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11455
11597
|
t = Math.min(t, e);
|
|
11456
11598
|
});
|
|
11457
11599
|
let n = e.timestamp / e.timescale * 1e3;
|
|
11458
|
-
this.currentChannelId = e.channelId, this.timestampOffset = n - t;
|
|
11459
|
-
} else (n || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync();
|
|
11600
|
+
this.currentChannelId = e.channelId, this.timestampOffset = n - t, this.timeshiftDeferralStartedAt = void 0;
|
|
11601
|
+
} else (n || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync(this.usesMse);
|
|
11460
11602
|
let r = this.timestampOffset * e.timescale / 1e3;
|
|
11461
11603
|
return e.timestamp -= r, n && this.keyframeTimestamps.push(e.timestamp / e.timescale * 1e3), this.highestSeenTimestamps.set(e.type, Math.max((t = this.highestSeenTimestamps.get(e.type)) == null ? 0 : t, e.timestamp / e.timescale * 1e3)), e;
|
|
11462
11604
|
}), e(this, "processFragment", (e, t, n) => {
|
|
@@ -11464,7 +11606,7 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11464
11606
|
this.currentChannelId || (this.currentChannelId = e);
|
|
11465
11607
|
let i = t.mediaType();
|
|
11466
11608
|
if (!i) throw Error("Fragment must have a media type");
|
|
11467
|
-
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 -
|
|
11609
|
+
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - tS);
|
|
11468
11610
|
let a = i === "video" && t.startsWithKeyframe();
|
|
11469
11611
|
if (i === "video" && (this.bFrameDetector.updateFromFragment({
|
|
11470
11612
|
type: i,
|
|
@@ -11477,12 +11619,12 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11477
11619
|
let t = 2 ** 53 - 1;
|
|
11478
11620
|
console.assert(this.highestSeenTimestamps.size !== 0, "no known timestamps"), this.highestSeenTimestamps.forEach((e) => {
|
|
11479
11621
|
t = Math.min(t, e);
|
|
11480
|
-
}), this.currentChannelId = e;
|
|
11481
|
-
} else (a || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync();
|
|
11622
|
+
}), this.currentChannelId = e, this.timeshiftDeferralStartedAt = void 0;
|
|
11623
|
+
} else (a || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync(this.usesMse);
|
|
11482
11624
|
let o = this.timestampOffset * t.timescale() / 1e3;
|
|
11483
11625
|
return t.updateBaseMediaDecodeTime(t.baseMediaDecodeTime() - o), a && this.keyframeTimestamps.push(t.baseMediaDecodeTime() / t.timescale() * 1e3), this.highestSeenTimestamps.set(i, Math.max((r = this.highestSeenTimestamps.get(i)) == null ? 0 : r, t.baseMediaDecodeTime() / t.timescale() * 1e3)), t;
|
|
11484
11626
|
}), e(this, "forceSeek", () => {
|
|
11485
|
-
this.logger.debug("Forcing seek", { amount: this.serverCurrentTime - this.playbackSource.currentTime }), this.clearRecoverySeekFlags(), this.playbackSource.currentTime = this.serverCurrentTime, this.positionSetBySeek = this.playbackSource.currentTime;
|
|
11627
|
+
this.logger.debug("Forcing seek", { amount: this.serverCurrentTime - this.playbackSource.currentTime }), this.clearRecoverySeekFlags(), this.playbackSource.currentTime = this.serverCurrentTime, this.timeshiftDeferralStartedAt = void 0, this.positionSetBySeek = this.playbackSource.currentTime;
|
|
11486
11628
|
}), e(this, "forceTimeshift", () => {
|
|
11487
11629
|
this.queuedTimeshift = !0;
|
|
11488
11630
|
}), e(this, "setPlaybackRateAdjustmentEnabled", (e) => {
|
|
@@ -11569,31 +11711,47 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11569
11711
|
})), !0;
|
|
11570
11712
|
}
|
|
11571
11713
|
return !t && n < this.config.playbackRate.startDiff ? !0 : t;
|
|
11572
|
-
}), e(this, "tryTimeshiftSync", () => {
|
|
11573
|
-
var
|
|
11714
|
+
}), e(this, "tryTimeshiftSync", (e = !1) => {
|
|
11715
|
+
var t;
|
|
11574
11716
|
if (!this.config.timeshift.enabled) return;
|
|
11575
11717
|
if (this.isTimeshiftUnsafe()) {
|
|
11576
11718
|
this.queuedTimeshift && this.hasObservedBFrames && (this.queuedTimeshift = !1, this.logger.info("Dropping forced timeshift: suppressed for B-frame stream, use forceSeek to resync"));
|
|
11577
11719
|
return;
|
|
11578
11720
|
}
|
|
11579
11721
|
if (this.hasPendingRecoverySeek() || !this.isAllowedToSync() || this.playbackSource.playbackRate !== 1) return;
|
|
11580
|
-
let
|
|
11581
|
-
this.driftSamples.push(
|
|
11582
|
-
let
|
|
11583
|
-
if (this.queuedTimeshift &&
|
|
11584
|
-
this.queuedTimeshift = !1, this.applyTimeshift(
|
|
11722
|
+
let n = (t = this.drift) == null ? 0 : t;
|
|
11723
|
+
this.driftSamples.push(n);
|
|
11724
|
+
let r = bt(this.driftSamples.items());
|
|
11725
|
+
if (this.queuedTimeshift && r > 0) {
|
|
11726
|
+
this.queuedTimeshift = !1, this.applyTimeshift(r);
|
|
11727
|
+
return;
|
|
11728
|
+
}
|
|
11729
|
+
if (r >= this.getEffectiveSeekToleranceMs()) return;
|
|
11730
|
+
if (r < this.currentTimeshiftToleranceMs()) {
|
|
11731
|
+
this.timeshiftDeferralStartedAt = void 0;
|
|
11585
11732
|
return;
|
|
11586
11733
|
}
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
if (i && this.state.timeshiftToleranceMultiplier > 2) {
|
|
11734
|
+
let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(oS(i)).length;
|
|
11735
|
+
if (a && this.state.timeshiftToleranceMultiplier > 2) {
|
|
11590
11736
|
this.logger.debug("Too many timeshifts within sliding window", {
|
|
11591
|
-
timeshiftCooldownThreshold:
|
|
11592
|
-
recentTimeshiftCount:
|
|
11737
|
+
timeshiftCooldownThreshold: i,
|
|
11738
|
+
recentTimeshiftCount: a
|
|
11593
11739
|
});
|
|
11594
11740
|
return;
|
|
11595
11741
|
}
|
|
11596
|
-
|
|
11742
|
+
if (e) {
|
|
11743
|
+
var o, s;
|
|
11744
|
+
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);
|
|
11745
|
+
if (n - r < this.bufferSource.getTargetBufferTime() * nS) {
|
|
11746
|
+
let e = performance.now();
|
|
11747
|
+
if (this.timeshiftDeferralStartedAt === void 0 && (this.timeshiftDeferralStartedAt = e, this.logger.debug("Deferring timeshift while buffered ahead is thin", {
|
|
11748
|
+
drift: r,
|
|
11749
|
+
bufferedAhead: n
|
|
11750
|
+
})), e - this.timeshiftDeferralStartedAt < rS) return;
|
|
11751
|
+
}
|
|
11752
|
+
this.timeshiftDeferralStartedAt !== void 0 && this.logger.debug("Releasing timeshift deferral", { deferredMs: performance.now() - this.timeshiftDeferralStartedAt });
|
|
11753
|
+
}
|
|
11754
|
+
this.applyTimeshift(r);
|
|
11597
11755
|
}), e(this, "clearRecoverySeekFlags", () => {
|
|
11598
11756
|
this.shouldSeekAfterBuffering = !1, this.shouldSeekWhileStuck = !1;
|
|
11599
11757
|
}), e(this, "hasActiveRecoveryTrigger", () => this.playbackState === "buffering"), e(this, "hasPendingRecoverySeek", () => (this.refreshRecoverySeekState(), this.getRecoverySeekReason() !== void 0)), e(this, "refreshRecoverySeekState", () => {
|
|
@@ -11609,20 +11767,20 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11609
11767
|
let n = (e = (t = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : e.call(t, this.playbackSource.currentTime);
|
|
11610
11768
|
return this.shouldSeekAfterBuffering = n !== void 0, n;
|
|
11611
11769
|
}), e(this, "observePlayheadProgress", () => {
|
|
11612
|
-
let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek >
|
|
11770
|
+
let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > fS);
|
|
11613
11771
|
this.positionSetBySeek = void 0, (n || this.playbackSource.isPaused) && (this.hasPerformedStuckSeekInCurrentStillness = !1), (t || this.playbackSource.isPaused || this.isSeeking()) && (this.lastPlayheadPosition = e, this.lastPlayheadProgressAt = performance.now());
|
|
11614
11772
|
}), e(this, "isPlayheadStuckInBuffer", () => {
|
|
11615
11773
|
var e, t;
|
|
11616
|
-
if (performance.now() - this.lastPlayheadProgressAt <
|
|
11774
|
+
if (performance.now() - this.lastPlayheadProgressAt < lS) return !1;
|
|
11617
11775
|
let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n);
|
|
11618
|
-
return r !== void 0 && r - n >=
|
|
11776
|
+
return r !== void 0 && r - n >= uS;
|
|
11619
11777
|
}), e(this, "getRecoverySeekReason", () => {
|
|
11620
11778
|
if (this.needsMediaSourceRecovery) return "media source reopen";
|
|
11621
11779
|
if (this.shouldSeekWhileStuck) return "stuck in buffer";
|
|
11622
11780
|
if (this.shouldSeekAfterBuffering) return "buffering";
|
|
11623
11781
|
}), 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", () => {
|
|
11624
11782
|
var e, t;
|
|
11625
|
-
let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot,
|
|
11783
|
+
let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, dS);
|
|
11626
11784
|
if (r === void 0 || i >= r) return;
|
|
11627
11785
|
let a = this.findKeyframeCloseToTimestamp(i);
|
|
11628
11786
|
return {
|
|
@@ -11670,7 +11828,7 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11670
11828
|
let i = performance.now();
|
|
11671
11829
|
this.lastSeekTime = i, t && t !== "stuck in buffer" && (this.hasPerformedRecoverySeekInCurrentRecoveryState = !0), this.clearRecoverySeekFlags(), this.driftSamples.clear(), this.seekAdjustmentTimestamps.push(i), this.seekAdjustmentCount++;
|
|
11672
11830
|
let a = t === "stuck in buffer" ? 0 : Math.min(n, this.bufferSource.getTargetBufferTime());
|
|
11673
|
-
this.playbackSource.currentTime = r.targetCurrentTime + a, this.positionSetBySeek = this.playbackSource.currentTime, t === "stuck in buffer" && (this.hasPerformedStuckSeekInCurrentStillness = !0, this.lastPlayheadPosition = this.playbackSource.currentTime, this.positionSetBySeek = void 0), this.applyBackoff();
|
|
11831
|
+
this.playbackSource.currentTime = r.targetCurrentTime + a, this.timeshiftDeferralStartedAt = void 0, this.positionSetBySeek = this.playbackSource.currentTime, t === "stuck in buffer" && (this.hasPerformedStuckSeekInCurrentStillness = !0, this.lastPlayheadPosition = this.playbackSource.currentTime, this.positionSetBySeek = void 0), this.applyBackoff();
|
|
11674
11832
|
}), e(this, "applyTimeshift", (e) => {
|
|
11675
11833
|
var t;
|
|
11676
11834
|
let n = (t = e == null ? this.drift : e) == null ? 0 : t;
|
|
@@ -11682,7 +11840,7 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11682
11840
|
currentTime: this.playbackSource.currentTime,
|
|
11683
11841
|
rtt: this.rtt,
|
|
11684
11842
|
timeshiftToleranceMultiplier: this.state.timeshiftToleranceMultiplier
|
|
11685
|
-
}), this.timestampOffset += r;
|
|
11843
|
+
}), this.timestampOffset += r, this.timeshiftDeferralStartedAt = void 0;
|
|
11686
11844
|
let i = performance.now();
|
|
11687
11845
|
if (this.lastSeekTime = i, this.lastAdjustmentTime = i, !this.playbackSource.isPaused && (this.driftSamples.clear(), this.timeshiftAdjustmentTimestamps.push(i), this.timeshiftAdjustmentCount++, this.config.backoff.enabled && this.timeshiftAdjustmentCount > 0 && this.timeshiftAdjustmentCount % this.config.timeshift.backoffEveryN === 0)) {
|
|
11688
11846
|
let e = this.state.timeshiftToleranceMultiplier, t = this.config.timeshift.toleranceMaxMs / this.config.timeshift.toleranceMs;
|
|
@@ -11696,10 +11854,14 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11696
11854
|
var e;
|
|
11697
11855
|
this.tryDecayMultipliers(), this.refreshRecoverySeekState();
|
|
11698
11856
|
let t = (e = this.drift) == null ? 0 : e, n = this.getRecoverySeekReason(), r = n !== void 0;
|
|
11699
|
-
if (!r && !this.isAllowedToSyncIgnoringCooldown()
|
|
11857
|
+
if (!r && !this.isAllowedToSyncIgnoringCooldown()) {
|
|
11858
|
+
this.timeshiftDeferralStartedAt = void 0;
|
|
11859
|
+
return;
|
|
11860
|
+
}
|
|
11861
|
+
if (r && (this.isSeeking() || !this.currentChannelId || this.isSuspended || this.playbackSource.isPaused) || (this.driftSamples.push(t), bt(this.driftSamples.items()) < this.currentTimeshiftToleranceMs() && (this.timeshiftDeferralStartedAt = void 0), !this.isSeekCooldownExpired()) || !r && this.driftSamples.items().length < this.driftSamplesToCollect && Math.abs(t) < 2e3) return;
|
|
11700
11862
|
let i = r ? t : bt(this.driftSamples.items());
|
|
11701
11863
|
if (!r && this.tryPlaybackRateSync(i) || !r && this.shouldSkipNormalSeek(i)) return;
|
|
11702
|
-
let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(
|
|
11864
|
+
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;
|
|
11703
11865
|
if (o && this.state.seekToleranceMultiplier > 2 && !r && !c) {
|
|
11704
11866
|
this.logger.debug("Too many seek adjustments within sliding window", {
|
|
11705
11867
|
seekCooldownThreshold: a,
|
|
@@ -11728,9 +11890,9 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11728
11890
|
return;
|
|
11729
11891
|
}
|
|
11730
11892
|
}), e(this, "onPageActive", (e) => {
|
|
11731
|
-
this.setSyncInterval(e ?
|
|
11893
|
+
this.setSyncInterval(e ? sS : cS), e && this.onSync();
|
|
11732
11894
|
}), e(this, "onPageShow", (e) => {
|
|
11733
|
-
e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ?
|
|
11895
|
+
e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? cS : sS), this.onSync());
|
|
11734
11896
|
}), e(this, "setSyncInterval", (e) => {
|
|
11735
11897
|
this.syncInterval !== void 0 && this.currentSyncIntervalMs === e || (this.clearSyncInterval(), this.currentSyncIntervalMs = e, this.syncInterval = this.timers.setInterval(this.onSync, e));
|
|
11736
11898
|
}), e(this, "clearSyncInterval", () => {
|
|
@@ -11741,11 +11903,11 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11741
11903
|
let t = n >= e - this.config.seek.keyframeSearchBeforeMs, r = n <= e + this.config.seek.keyframeSearchAfterMs;
|
|
11742
11904
|
if (t && r) return n;
|
|
11743
11905
|
}
|
|
11744
|
-
}), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot =
|
|
11745
|
-
seek: y({},
|
|
11746
|
-
timeshift: y({},
|
|
11747
|
-
playbackRate: y({},
|
|
11748
|
-
backoff: y({},
|
|
11906
|
+
}), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot = aS(s), this.config = {
|
|
11907
|
+
seek: y({}, pS.seek),
|
|
11908
|
+
timeshift: y({}, pS.timeshift),
|
|
11909
|
+
playbackRate: y({}, pS.playbackRate),
|
|
11910
|
+
backoff: y({}, pS.backoff)
|
|
11749
11911
|
}, this.config.timeshift.enabled = o, s || (this.config.seek.toleranceMs = 50, this.config.timeshift.toleranceMs = 20, this.config.seek.aheadToleranceMs = 40), this.state = {
|
|
11750
11912
|
seekToleranceMultiplier: 1,
|
|
11751
11913
|
timeshiftToleranceMultiplier: 1
|
|
@@ -11807,10 +11969,10 @@ var _x, vx = 5e3, yx = () => Fe() || Me(), bx = (e) => e && yx() ? 100 : 0, xx =
|
|
|
11807
11969
|
return this.serverCurrentTime - this.playbackSource.currentTime;
|
|
11808
11970
|
}
|
|
11809
11971
|
};
|
|
11810
|
-
|
|
11972
|
+
eS = mS, e(mS, "create", (e, t, n, r, i, a = !0) => new eS(e, t, n, r, i, a));
|
|
11811
11973
|
//#endregion
|
|
11812
11974
|
//#region ../../libs/web-sdk/src/modules/TelemetryModule.ts
|
|
11813
|
-
var
|
|
11975
|
+
var hS, gS = {
|
|
11814
11976
|
enabled: !0,
|
|
11815
11977
|
interval: 3e4,
|
|
11816
11978
|
includeErrors: !0,
|
|
@@ -11819,11 +11981,11 @@ var Ax, jx = {
|
|
|
11819
11981
|
maxRetries: 10,
|
|
11820
11982
|
maxErrorReports: 50,
|
|
11821
11983
|
maxEvents: 50
|
|
11822
|
-
},
|
|
11984
|
+
}, _S = (e, t) => y(y({}, t), {}, {
|
|
11823
11985
|
type: e,
|
|
11824
11986
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11825
11987
|
discriminator: "web"
|
|
11826
|
-
}),
|
|
11988
|
+
}), vS = class {
|
|
11827
11989
|
constructor(n, i, a, o) {
|
|
11828
11990
|
var s = this;
|
|
11829
11991
|
e(this, "logger", void 0), e(this, "timers", new D()), 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", () => {
|
|
@@ -11840,7 +12002,7 @@ var Ax, jx = {
|
|
|
11840
12002
|
initiator: "interval"
|
|
11841
12003
|
}, n = {}) => {
|
|
11842
12004
|
if (!this.options.includeStats) return;
|
|
11843
|
-
let r = this.parentContext.getStatistics(), i =
|
|
12005
|
+
let r = this.parentContext.getStatistics(), i = _S("stats", y(y(y({}, n), r), {}, {
|
|
11844
12006
|
isFinal: e,
|
|
11845
12007
|
initiator: t,
|
|
11846
12008
|
count: this.statsCount++
|
|
@@ -11848,7 +12010,7 @@ var Ax, jx = {
|
|
|
11848
12010
|
this.unsentLines.push(i);
|
|
11849
12011
|
}), e(this, "addEvent", (e) => {
|
|
11850
12012
|
if (!this.options.includeEvents || this.eventCount > this.options.maxEvents) return;
|
|
11851
|
-
let t =
|
|
12013
|
+
let t = _S("event", y(y({}, this.parentContext.getStatistics()), e));
|
|
11852
12014
|
this.eventCount++, this.unsentLines.push(t);
|
|
11853
12015
|
}), e(this, "getStatistics", () => ({ errorCount: this.errorCount })), e(this, "send", function() {
|
|
11854
12016
|
var e = t(function* (e) {
|
|
@@ -11893,14 +12055,14 @@ var Ax, jx = {
|
|
|
11893
12055
|
let { includeErrors: t, maxErrorReports: n } = this.options;
|
|
11894
12056
|
if (!(e instanceof O) || e.code() === "channel_not_live" || !t || (this.errorCount++, this.errorCount > n)) return;
|
|
11895
12057
|
let r = this.parentContext.getStatistics();
|
|
11896
|
-
this.unsentLines.push(
|
|
11897
|
-
}), this.logger = n, this.emitter = i, this.options = y(y({},
|
|
12058
|
+
this.unsentLines.push(_S("error", y(y({}, r), e.toStringifiable())));
|
|
12059
|
+
}), this.logger = n, this.emitter = i, this.options = y(y({}, gS), a), this.parentContext = o;
|
|
11898
12060
|
}
|
|
11899
12061
|
};
|
|
11900
|
-
|
|
12062
|
+
hS = vS, e(vS, "create", (e, t, n, r) => new hS(e, t, n, r));
|
|
11901
12063
|
//#endregion
|
|
11902
12064
|
//#region ../../libs/web-sdk/src/modules/UnpauseModule.ts
|
|
11903
|
-
var
|
|
12065
|
+
var yS, bS = class {
|
|
11904
12066
|
constructor(t, n, r) {
|
|
11905
12067
|
e(this, "logger", void 0), e(this, "elements", void 0), e(this, "documentState", void 0), e(this, "timers", new D()), e(this, "unload", () => {
|
|
11906
12068
|
this.timers.unload();
|
|
@@ -11909,10 +12071,10 @@ var Px, Fx = class {
|
|
|
11909
12071
|
}), this.logger = t, this.elements = n, this.documentState = r, this.timers.setInterval(this.unpause, 100);
|
|
11910
12072
|
}
|
|
11911
12073
|
};
|
|
11912
|
-
|
|
12074
|
+
yS = bS, e(bS, "create", (e, t, n) => new yS(e, t, n));
|
|
11913
12075
|
//#endregion
|
|
11914
12076
|
//#region ../../libs/web-sdk/src/OptionsProvider.ts
|
|
11915
|
-
var
|
|
12077
|
+
var xS = [
|
|
11916
12078
|
"minBufferTime",
|
|
11917
12079
|
"maxBufferTime",
|
|
11918
12080
|
"burstEnabled",
|
|
@@ -11921,10 +12083,10 @@ var Ix = [
|
|
|
11921
12083
|
"offscreenCanvasEnabled",
|
|
11922
12084
|
"videoCodecs"
|
|
11923
12085
|
];
|
|
11924
|
-
function
|
|
11925
|
-
return
|
|
12086
|
+
function SS(e) {
|
|
12087
|
+
return xS.includes(e);
|
|
11926
12088
|
}
|
|
11927
|
-
var
|
|
12089
|
+
var CS = class {
|
|
11928
12090
|
constructor(t) {
|
|
11929
12091
|
e(this, "options", void 0), e(this, "overrides", /* @__PURE__ */ new Map()), this.options = t;
|
|
11930
12092
|
}
|
|
@@ -11938,7 +12100,7 @@ var Rx = class {
|
|
|
11938
12100
|
this.options[e] = t;
|
|
11939
12101
|
}
|
|
11940
12102
|
get(e, t) {
|
|
11941
|
-
if (t &&
|
|
12103
|
+
if (t && SS(e)) {
|
|
11942
12104
|
var n;
|
|
11943
12105
|
let r = (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
11944
12106
|
if (r !== void 0) return r;
|
|
@@ -11949,7 +12111,7 @@ var Rx = class {
|
|
|
11949
12111
|
var n;
|
|
11950
12112
|
return (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
11951
12113
|
}
|
|
11952
|
-
},
|
|
12114
|
+
}, wS = 6, TS = (e) => {
|
|
11953
12115
|
let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
|
|
11954
12116
|
var i, a;
|
|
11955
12117
|
if (e.flags && Rs(e.flags)) {
|
|
@@ -11961,7 +12123,7 @@ var Rx = class {
|
|
|
11961
12123
|
return u > 0 && (r = u), y(y({}, e), {}, { duration: u > 0 ? u : r });
|
|
11962
12124
|
};
|
|
11963
12125
|
return (e, n = !1) => {
|
|
11964
|
-
if (e.flags && Rs(e.flags) && n && (i = !i), !(n && t.length <
|
|
12126
|
+
if (e.flags && Rs(e.flags) && n && (i = !i), !(n && t.length < wS && i) && t.length > 0) {
|
|
11965
12127
|
i = !1;
|
|
11966
12128
|
let n = e;
|
|
11967
12129
|
for (let e = t.length - 1; e > 0; e--) {
|
|
@@ -11974,13 +12136,13 @@ var Rx = class {
|
|
|
11974
12136
|
}
|
|
11975
12137
|
return t.push(e), [];
|
|
11976
12138
|
};
|
|
11977
|
-
},
|
|
12139
|
+
}, ES = ["mse", "wasm"], DS = (e) => e == null ? ES : e, OS = (e) => {
|
|
11978
12140
|
if (!e) return !1;
|
|
11979
12141
|
let t = e.headers && Object.keys(e.headers).length > 0, n = e.queryParams && Object.keys(e.queryParams).length > 0;
|
|
11980
12142
|
return !!(t || n);
|
|
11981
|
-
},
|
|
11982
|
-
if (
|
|
11983
|
-
let r =
|
|
12143
|
+
}, kS = (e, t, n) => {
|
|
12144
|
+
if (OS(n)) return "mse";
|
|
12145
|
+
let r = DS(e);
|
|
11984
12146
|
for (let e of r) switch (e) {
|
|
11985
12147
|
case "mse":
|
|
11986
12148
|
if (t) return "mse";
|
|
@@ -11991,7 +12153,7 @@ var Rx = class {
|
|
|
11991
12153
|
case "wasm": return "wasm";
|
|
11992
12154
|
}
|
|
11993
12155
|
return "wasm";
|
|
11994
|
-
},
|
|
12156
|
+
}, AS = (e, t, n) => {
|
|
11995
12157
|
if (fn(t)) return y(y({}, e), {}, {
|
|
11996
12158
|
type: "video",
|
|
11997
12159
|
codec: t.codec,
|
|
@@ -12012,12 +12174,12 @@ var Rx = class {
|
|
|
12012
12174
|
data: e.payload,
|
|
12013
12175
|
duration: 0
|
|
12014
12176
|
});
|
|
12015
|
-
},
|
|
12177
|
+
}, jS = ({ average: e, last: t, max: n, min: r }) => ({
|
|
12016
12178
|
average: Math.round(e),
|
|
12017
12179
|
last: Math.round(t),
|
|
12018
12180
|
max: Math.round(n),
|
|
12019
12181
|
min: Math.round(r)
|
|
12020
|
-
}),
|
|
12182
|
+
}), MS = [
|
|
12021
12183
|
"timeSpentBuffering",
|
|
12022
12184
|
"timePerBufferingEvent",
|
|
12023
12185
|
"drift",
|
|
@@ -12029,24 +12191,24 @@ var Rx = class {
|
|
|
12029
12191
|
"videoKeyframeIntervalMs",
|
|
12030
12192
|
"timeToConnected",
|
|
12031
12193
|
"mediaSourceOpenTime"
|
|
12032
|
-
],
|
|
12194
|
+
], NS = [
|
|
12033
12195
|
"videoDecodeTime",
|
|
12034
12196
|
"audioDecodeTime",
|
|
12035
12197
|
"videoTransportTime",
|
|
12036
12198
|
"rtt"
|
|
12037
|
-
],
|
|
12199
|
+
], PS = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, FS = (e) => {
|
|
12038
12200
|
let t = y({}, e);
|
|
12039
|
-
for (let e of
|
|
12201
|
+
for (let e of MS) {
|
|
12040
12202
|
let n = t[e];
|
|
12041
12203
|
typeof n == "number" && (t[e] = Math.round(n));
|
|
12042
12204
|
}
|
|
12043
|
-
for (let e of
|
|
12205
|
+
for (let e of NS) {
|
|
12044
12206
|
let n = t[e];
|
|
12045
|
-
|
|
12207
|
+
PS(n) && (t[e] = jS(n));
|
|
12046
12208
|
}
|
|
12047
12209
|
return t;
|
|
12048
|
-
},
|
|
12049
|
-
if (!
|
|
12210
|
+
}, IS = (e, t) => e && typeof e == "object" && t in e, LS = (e) => !(typeof e != "object" || !IS(e, "channelId") || typeof e.channelId != "string" || !IS(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), RS = (e) => {
|
|
12211
|
+
if (!LS(e)) throw new O("Invalid options", {
|
|
12050
12212
|
isFatal: !0,
|
|
12051
12213
|
code: "invalid_options"
|
|
12052
12214
|
});
|
|
@@ -12055,13 +12217,13 @@ var Rx = class {
|
|
|
12055
12217
|
let n = t;
|
|
12056
12218
|
n[e] === void 0 && delete n[e];
|
|
12057
12219
|
}), t;
|
|
12058
|
-
},
|
|
12220
|
+
}, zS = (e) => {
|
|
12059
12221
|
if (typeof e != "object" || !e) throw Error("not an object");
|
|
12060
12222
|
if (!("video" in e)) throw Error("missing video in subscription");
|
|
12061
12223
|
if (!("audio" in e)) throw Error("missing audio in subscription");
|
|
12062
12224
|
if (!("channelId" in e)) throw Error("missing channelId");
|
|
12063
12225
|
return !0;
|
|
12064
|
-
},
|
|
12226
|
+
}, BS = class {
|
|
12065
12227
|
constructor(n) {
|
|
12066
12228
|
var r = this;
|
|
12067
12229
|
e(this, "cache", /* @__PURE__ */ new Map()), e(this, "inFlight", /* @__PURE__ */ new Map()), e(this, "checkVideoSupport", function() {
|
|
@@ -12122,10 +12284,10 @@ var Rx = class {
|
|
|
12122
12284
|
return this.inFlight.set(e, o), o;
|
|
12123
12285
|
}), this.logger = n;
|
|
12124
12286
|
}
|
|
12125
|
-
},
|
|
12287
|
+
}, VS = 1e4, HS = 300, US = 3e3, WS = 1e4, GS = 1280 * 720, KS = /* @__PURE__ */ new WeakMap(), qS = /* @__PURE__ */ new WeakMap(), JS = /* @__PURE__ */ new WeakMap(), YS = class n extends ie {
|
|
12126
12288
|
constructor(r) {
|
|
12127
12289
|
var o, c, u;
|
|
12128
|
-
super(), o = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", qe()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ie()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", ln()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !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 oe(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new cn()), e(this, "encryptedMediaExtensions", void 0), i(this,
|
|
12290
|
+
super(), o = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", qe()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ie()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", ln()), 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 oe(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new cn()), e(this, "encryptedMediaExtensions", void 0), i(this, KS, 0), i(this, qS, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new Rb()), e(this, "unextractableSamplesWarned", new Rb()), 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, JS, void 0), e(this, "attach", (e) => {
|
|
12129
12291
|
var t;
|
|
12130
12292
|
(t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
|
|
12131
12293
|
}), e(this, "setElement", (e) => {
|
|
@@ -12175,7 +12337,7 @@ var Rx = class {
|
|
|
12175
12337
|
let r = o.modules.subscription.getTargetSubscription(), i = e.channels.find((e) => e.channelId === r.channelId);
|
|
12176
12338
|
if (o.emitter.emit("connect info", e), "timeshift" in e && e.timeshift ? (e.timeshift, o._channels = e.channels.map((t) => y(y({}, t), {}, { timeshift: e.timeshift })), o.emit("timeshift info", e.timeshift)) : o._channels = e.channels, o.updateTextTracks((n = i == null ? void 0 : i.renditions) == null ? [] : n), !o.textTrack && o.options.get("textTrack") && (o.textTrack = o.options.get("textTrack")), yield Promise.all(e.channels.map(function() {
|
|
12177
12339
|
var e = t(function* (e) {
|
|
12178
|
-
e.overrides && o.options.addOverrides(e.channelId, e.overrides), e.renditions = yield o.filterRenditions(e.renditions), o.modules.renditions.setRenditions(e.channelId, e.renditions);
|
|
12340
|
+
e.overrides && o.options.addOverrides(e.channelId, e.overrides), e.renditions = yield o.filterRenditions(e.renditions, e.channelId), o.modules.renditions.setRenditions(e.channelId, e.renditions);
|
|
12179
12341
|
});
|
|
12180
12342
|
return function(t) {
|
|
12181
12343
|
return e.apply(this, arguments);
|
|
@@ -12187,14 +12349,14 @@ var Rx = class {
|
|
|
12187
12349
|
if ((s || c) && (o.modules.bufferTime.updateConfig({
|
|
12188
12350
|
minBufferTime: o.options.get("minBufferTime", o.channelId),
|
|
12189
12351
|
maxBufferTime: o.options.get("maxBufferTime", o.channelId)
|
|
12190
|
-
}), o.targetBufferTime = o.options.get("minBufferTime", o.channelId)), o.applyBurstEnabled(o.channelId), o.emit("is live", i.isLive), !i.isLive) throw Qn();
|
|
12191
|
-
let l = o.modules.connection.estimatedBandwidth;
|
|
12192
|
-
o.patchSubscription(i, l), yield o.initializeDecodingModule(), o.resetModules(), o.emit("rendition levels", o.modules.renditions.getRenditionLevels()), o.emit("channels", o.channels), o.emitLanguagesIfChanged(), o.sampleProcessingSesssions.clear();
|
|
12193
|
-
let
|
|
12352
|
+
}), o.modules.adaptivity.updateConfig({ cooldownTime: Math.max(o.options.get("minBufferTime", o.channelId), 2e3) }), o.targetBufferTime = o.options.get("minBufferTime", o.channelId)), o.applyBurstEnabled(o.channelId), o.emit("is live", i.isLive), !i.isLive) throw Qn();
|
|
12353
|
+
let l = o.modules.connection.estimatedBandwidth, u = o.modules.subscription.getCurrentSubscription().channelId !== o.channelId;
|
|
12354
|
+
o.patchSubscription(i, l), yield o.initializeDecodingModule(), o.resetModules(), o.emit("rendition levels", o.modules.renditions.getRenditionLevels()), o.emit("channels", o.channels), o.emitLanguagesIfChanged(), u && o.emit("channel switch", { channelId: o.channelId }), o.sampleProcessingSesssions.clear();
|
|
12355
|
+
let d = o.options.get("burstEnabled", o.channelId) && o.burstFits(l);
|
|
12194
12356
|
return {
|
|
12195
12357
|
video: o.targetSubscription.video,
|
|
12196
12358
|
audio: o.targetSubscription.audio,
|
|
12197
|
-
burstMs:
|
|
12359
|
+
burstMs: d ? o.targetBufferTime : void 0,
|
|
12198
12360
|
sessionId: o.sessionId,
|
|
12199
12361
|
clientId: o.clientId,
|
|
12200
12362
|
channelId: o.channelId,
|
|
@@ -12206,85 +12368,100 @@ var Rx = class {
|
|
|
12206
12368
|
return function(t) {
|
|
12207
12369
|
return e.apply(this, arguments);
|
|
12208
12370
|
};
|
|
12209
|
-
}()), e(this, "
|
|
12371
|
+
}()), e(this, "stepDownForRejoin", () => {
|
|
12372
|
+
var e;
|
|
12373
|
+
let t = this.targetSubscription, n = (e = this.modules.renditions.getRenditionLevel()) == null || (e = e.video) == null ? void 0 : e.bitRate;
|
|
12374
|
+
if (!this.abrEnabled || n === void 0 || t.channelId !== this.currentSubscription.channelId) return;
|
|
12375
|
+
let r = t.video.bitRate !== void 0 && t.video.bitRate > n, i = this.modules.renditions.getRenditionLevels(t).filter((e) => e.video && (r ? e.video.bitRate <= n : e.video.bitRate < n)).pop();
|
|
12376
|
+
!(i != null && i.video) || t.video.bitRate !== void 0 && t.video.bitRate <= i.video.bitRate || (this.logger.info("Stepping down a level for the rejoin after a ping timeout", { to: i }), this.alignSizeAndBitRate(y(y({}, t), {}, {
|
|
12377
|
+
video: y(y({}, t.video), i.video),
|
|
12378
|
+
audio: y(y({}, t.audio), i.audio)
|
|
12379
|
+
})), this.emitter.emit("adapted level"));
|
|
12380
|
+
}), e(this, "emitLanguagesIfChanged", () => {
|
|
12210
12381
|
let e = this.modules.renditions.getLanguages(), t = this.latestEmittedLanguages;
|
|
12211
12382
|
e.length === t.length && e.every((e) => t.includes(e)) || (this.logger.debug("Emitting new languages", { currentLanguages: e }), this.latestEmittedLanguages = e, this.emit("languages", this.latestEmittedLanguages));
|
|
12212
12383
|
}), e(this, "updateTextTracks", (e) => {
|
|
12213
12384
|
let t = e.filter((e) => e.codec === "webvtt");
|
|
12214
12385
|
t.forEach((e) => {
|
|
12215
|
-
if (!s(
|
|
12386
|
+
if (!s(qS, this).find((t) => t.language === e.language)) {
|
|
12216
12387
|
if (this.modules.canvasModule) {
|
|
12217
12388
|
let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
|
|
12218
|
-
s(
|
|
12389
|
+
s(qS, this).push(t);
|
|
12219
12390
|
} else if (this.mediaElement instanceof HTMLVideoElement) {
|
|
12220
12391
|
let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
|
|
12221
|
-
s(
|
|
12392
|
+
s(qS, this).push(t);
|
|
12222
12393
|
}
|
|
12223
12394
|
}
|
|
12224
12395
|
});
|
|
12225
|
-
for (let e of s(
|
|
12396
|
+
for (let e of s(qS, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
|
|
12226
12397
|
this.emit("text tracks", this.textTracks);
|
|
12227
12398
|
}), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
|
|
12228
|
-
s(
|
|
12399
|
+
s(qS, this).forEach((t) => {
|
|
12229
12400
|
if (t.cues) for (let n of Array.from(t.cues)) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
|
|
12230
12401
|
});
|
|
12231
12402
|
}), e(this, "filterRenditions", function() {
|
|
12232
|
-
var e = t(function* (e) {
|
|
12233
|
-
let n = yield Promise.all(e.map(function() {
|
|
12403
|
+
var e = t(function* (e, n) {
|
|
12404
|
+
let r = o.options.getOverride("maxVideoBitRate", n), i = yield Promise.all(e.map(function() {
|
|
12234
12405
|
var e = t(function* (e) {
|
|
12235
12406
|
if (pn(e)) {
|
|
12236
12407
|
var t;
|
|
12237
12408
|
return o.willUseMediaSource() && !((t = Ee()) != null && t.isTypeSupported(mn(e))) ? !1 : o.willUseMediaSource() || e.codec === "opus" ? !0 : o.isWebCodecsAudioAvailable(o.channelId) ? o.webCodecsRenditionSupport.checkAudioSupport(e) : !1;
|
|
12238
12409
|
}
|
|
12239
|
-
if (!fn(e) || !o.isSupportedVideoCodecProfile(e.codec, e.codecString)) return !1;
|
|
12410
|
+
if (!fn(e) || !o.isSupportedVideoCodecProfile(e.codec, e.codecString) || r && e.bitRate > r) return !1;
|
|
12240
12411
|
if (!o.willUseMediaSource()) return o.isWebCodecsVideoAvailable(o.channelId) ? o.webCodecsRenditionSupport.checkVideoSupport(e) : !0;
|
|
12241
12412
|
let n = yield pc(e);
|
|
12242
|
-
|
|
12243
|
-
if (e.codec === "av1" && !n.smooth && !n.powerEfficient) return o.logger.debug("discarding av1 rendition, neither smooth nor power efficient", {
|
|
12413
|
+
return n.supported ? e.codec === "av1" && !n.smooth && !n.powerEfficient ? (o.logger.debug("discarding av1 rendition, neither smooth nor power efficient", {
|
|
12244
12414
|
codecString: e.codecString,
|
|
12245
12415
|
width: e.width,
|
|
12246
12416
|
height: e.height,
|
|
12247
12417
|
bitRate: e.bitRate,
|
|
12248
12418
|
capabilities: n
|
|
12249
|
-
}), !1;
|
|
12250
|
-
let r = o.options.getOverride("maxVideoBitRate", o.channelId);
|
|
12251
|
-
return r ? r >= e.bitRate : !0;
|
|
12419
|
+
}), !1) : !0 : !1;
|
|
12252
12420
|
});
|
|
12253
12421
|
return function(t) {
|
|
12254
12422
|
return e.apply(this, arguments);
|
|
12255
12423
|
};
|
|
12256
|
-
}())),
|
|
12257
|
-
|
|
12424
|
+
}())), a = e.filter((e, t) => i[t]), s = e.filter((e, t) => !i[t]);
|
|
12425
|
+
s.length > 0 && o.logger.debug("unsupported renditions filtered out", { renditions: s.map((e) => y(y({
|
|
12258
12426
|
codec: e.codec,
|
|
12259
12427
|
codecString: e.codecString
|
|
12260
12428
|
}, fn(e) ? {
|
|
12261
12429
|
width: e.width,
|
|
12262
12430
|
height: e.height
|
|
12263
12431
|
} : {}), {}, { bitRate: e.bitRate })) });
|
|
12264
|
-
let
|
|
12265
|
-
return
|
|
12432
|
+
let c = a.filter((e) => e.codec === "h264").reverse()[0], l = a.filter((e) => e.codec === "av1").reverse()[0];
|
|
12433
|
+
return c && l && c.width > l.width && c.height > l.height && (o.logger.debug("discarding av1 renditions, h264 ladder has higher resolution", {
|
|
12266
12434
|
bestH264: {
|
|
12267
|
-
width:
|
|
12268
|
-
height:
|
|
12269
|
-
bitRate:
|
|
12435
|
+
width: c.width,
|
|
12436
|
+
height: c.height,
|
|
12437
|
+
bitRate: c.bitRate
|
|
12270
12438
|
},
|
|
12271
12439
|
bestAV1: {
|
|
12272
|
-
width:
|
|
12273
|
-
height:
|
|
12274
|
-
bitRate:
|
|
12440
|
+
width: l.width,
|
|
12441
|
+
height: l.height,
|
|
12442
|
+
bitRate: l.bitRate
|
|
12275
12443
|
}
|
|
12276
|
-
}),
|
|
12444
|
+
}), a = a.filter((e) => e.codec !== "av1")), o.logger.debug("supported renditions", { renditions: a.map((e) => y(y({
|
|
12277
12445
|
codec: e.codec,
|
|
12278
12446
|
codecString: e.codecString
|
|
12279
12447
|
}, fn(e) ? {
|
|
12280
12448
|
width: e.width,
|
|
12281
12449
|
height: e.height
|
|
12282
|
-
} : {}), {}, { bitRate: e.bitRate })) }),
|
|
12450
|
+
} : {}), {}, { bitRate: e.bitRate })) }), a;
|
|
12283
12451
|
});
|
|
12284
|
-
return function(t) {
|
|
12452
|
+
return function(t, n) {
|
|
12285
12453
|
return e.apply(this, arguments);
|
|
12286
12454
|
};
|
|
12287
|
-
}()), e(this, "
|
|
12455
|
+
}()), e(this, "linkHoldsUpgrade", () => {
|
|
12456
|
+
var e;
|
|
12457
|
+
let t = this.modules.connection.linkQueue;
|
|
12458
|
+
if (!t) return !1;
|
|
12459
|
+
let n = Math.max(this.targetBufferTime, US), r = t.peak(n), i = performance.now() - ((e = this.modules.connection.lastConnectionTime) == null ? performance.now() : e), a = r === void 0 ? i < WS : !(r < HS);
|
|
12460
|
+
return a && !this.upgradeHeld && this.logger.debug("Holding the upgrade while the link queues", {
|
|
12461
|
+
linkQueuePeakMs: r === void 0 ? void 0 : Math.round(r),
|
|
12462
|
+
windowMs: n
|
|
12463
|
+
}), this.upgradeHeld = a, a;
|
|
12464
|
+
}), e(this, "burstFits", (e) => {
|
|
12288
12465
|
var t, n;
|
|
12289
12466
|
let { video: r, audio: i, channelId: a } = this.modules.subscription.getTargetSubscription(), o = lc(((t = this.modules.renditions.getVideoRenditions(a)) == null ? [] : t).filter((e) => e.codec === r.codec).map((e) => e.bitRate), r.bitRate), s = lc(((n = this.modules.renditions.getAudioRenditions(a)) == null ? [] : n).filter((e) => e.codec === i.codec).filter((e) => !i.language || e.language === i.language).map((e) => e.bitRate), i.bitRate), c = uc(e, o + s);
|
|
12290
12467
|
return c || this.logger.info("Skipping the join burst: the starting rendition needs more than half the bandwidth", {
|
|
@@ -12384,8 +12561,8 @@ var Rx = class {
|
|
|
12384
12561
|
u = void 0, d = void 0, o.logger.warn("Failed to enable OffscreenCanvas; falling back to main thread rendering", { error: e });
|
|
12385
12562
|
}
|
|
12386
12563
|
else s && o.logger.warn("OffscreenCanvas requested but not supported; falling back to main thread rendering");
|
|
12387
|
-
let f = o.capturesCanvasOnWebKit(u), p = yield
|
|
12388
|
-
if (h instanceof
|
|
12564
|
+
let f = o.capturesCanvasOnWebKit(u), p = yield Yb.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;
|
|
12565
|
+
if (h instanceof vx) if (m === "OffscreenCanvas" && d) {
|
|
12389
12566
|
h.setVideoRenderingEnabled(!1);
|
|
12390
12567
|
let e = o.element;
|
|
12391
12568
|
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);
|
|
@@ -12397,11 +12574,11 @@ var Rx = class {
|
|
|
12397
12574
|
t.parentElement && t.parentElement.replaceChild(e, t), o.setElement(e);
|
|
12398
12575
|
}
|
|
12399
12576
|
}
|
|
12400
|
-
else h instanceof
|
|
12577
|
+
else h instanceof Tx && (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));
|
|
12401
12578
|
(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();
|
|
12402
|
-
})), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof
|
|
12579
|
+
})), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof Tx), e(this, "connectWebKitVideoOutput", (e, t) => {
|
|
12403
12580
|
let n = () => {
|
|
12404
|
-
t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(
|
|
12581
|
+
t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(GS);
|
|
12405
12582
|
};
|
|
12406
12583
|
e.onVideoTrackLost((e) => {
|
|
12407
12584
|
this.logger.warn("Worker video track lost, falling back to canvas capture", { error: e }), n();
|
|
@@ -12409,7 +12586,7 @@ var Rx = class {
|
|
|
12409
12586
|
let r = e.videoTrack;
|
|
12410
12587
|
r ? t.setVideoTrack(r) : n();
|
|
12411
12588
|
}), e(this, "setupOffscreenSubtitleRouting", () => {
|
|
12412
|
-
if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof
|
|
12589
|
+
if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof Tx) return;
|
|
12413
12590
|
let e = this.modules.decoder, t = this.modules.canvasModule;
|
|
12414
12591
|
if (!t) return;
|
|
12415
12592
|
let n = !1;
|
|
@@ -12451,7 +12628,7 @@ var Rx = class {
|
|
|
12451
12628
|
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();
|
|
12452
12629
|
}), e(this, "getStatistics", () => {
|
|
12453
12630
|
let e = Object.values(this.modules).reduce((e, t) => t && "getStatistics" in t ? y(y({}, 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;
|
|
12454
|
-
return
|
|
12631
|
+
return FS(y(y({}, e), {}, {
|
|
12455
12632
|
averageBitRate: t,
|
|
12456
12633
|
reconnectsPerHour: i,
|
|
12457
12634
|
seekAdjustmentsPerMinute: s,
|
|
@@ -12460,7 +12637,7 @@ var Rx = class {
|
|
|
12460
12637
|
}), e(this, "resetModules", () => {
|
|
12461
12638
|
Object.values(this.modules).forEach((e) => {
|
|
12462
12639
|
e && "reset" in e && e.reset();
|
|
12463
|
-
}), this.playbackSource instanceof fc && this.modules.adaptivity.
|
|
12640
|
+
}), this.playbackSource instanceof fc && this.modules.adaptivity.holdReconnect(VS), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
|
|
12464
12641
|
}), e(this, "disconnectForInactivePage", (e) => {
|
|
12465
12642
|
if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
|
|
12466
12643
|
var t;
|
|
@@ -12491,10 +12668,10 @@ var Rx = class {
|
|
|
12491
12668
|
e && "unsuspend" in e && e.unsuspend();
|
|
12492
12669
|
});
|
|
12493
12670
|
}), e(this, "getRuntimeInfo", () => {
|
|
12494
|
-
let e = this.modules.canvasModule instanceof
|
|
12671
|
+
let e = this.modules.canvasModule instanceof Tx ? !0 : void 0;
|
|
12495
12672
|
return y({
|
|
12496
12673
|
uptime: this.uptime,
|
|
12497
|
-
version: "4.7.2-
|
|
12674
|
+
version: "4.7.2-20-g80a09629",
|
|
12498
12675
|
clientId: this.clientId,
|
|
12499
12676
|
sessionId: this.sessionId,
|
|
12500
12677
|
channelId: this.channelId,
|
|
@@ -12539,7 +12716,7 @@ var Rx = class {
|
|
|
12539
12716
|
if (this.browser.platform.isWebKit || !this.browser.isMobile) return !1;
|
|
12540
12717
|
let t = (e = this.modules) == null ? void 0 : e.decoder;
|
|
12541
12718
|
return t ? t.audioWebCodecsInUse : this.isWebCodecsAudioAvailable(this.channelId);
|
|
12542
|
-
}), this.options = new
|
|
12719
|
+
}), this.options = new CS(y(y({}, or), RS(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
|
|
12543
12720
|
let d = {
|
|
12544
12721
|
channelId: this.options.get("channelId"),
|
|
12545
12722
|
audio: {
|
|
@@ -12552,14 +12729,14 @@ var Rx = class {
|
|
|
12552
12729
|
height: this.options.get("maxSize").height
|
|
12553
12730
|
}
|
|
12554
12731
|
}, f = b.get();
|
|
12555
|
-
f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new
|
|
12732
|
+
f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new BS(f), r.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
|
|
12556
12733
|
let p = (c = r.streamToMediaElementEnabled) == null ? r.iosMediaElementEnabled : c;
|
|
12557
12734
|
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.");
|
|
12558
12735
|
let m = (u = r.backgroundPlayEnabled) == null ? r.iosBackgroundPlayEnabled : u;
|
|
12559
12736
|
m !== void 0 && (this.options.set("backgroundPlayEnabled", m), this.options.set("iosBackgroundPlayEnabled", m));
|
|
12560
12737
|
let g = r.mseEnabled !== void 0, ee = r.decoders !== void 0;
|
|
12561
12738
|
g && this.logger.warn("Option mseEnabled is deprecated and will be removed in a future release. Use decoders instead (e.g. decoders: [\"wasm\"])."), g && !ee && r.mseEnabled === !1 && this.options.set("decoders", ["wasm"]);
|
|
12562
|
-
let _ =
|
|
12739
|
+
let _ = Vx.create(this.emitter, this.logger.createContext("PictureInPictureModule")), te = this.options.get("mediaSessionEnabled") ? Cx.create(this.emitter, this.logger.createContext("MediaSessionModule"), {
|
|
12563
12740
|
metadata: this.options.get("mediaSessionMetadata"),
|
|
12564
12741
|
decoy: this.willUseMediaSource() || this.usesSplitCanvasAudio() ? void 0 : jc.create(this.logger.createContext("AudioFocusDecoy"), this.yieldToInterruption),
|
|
12565
12742
|
isMuted: () => this.playbackSource.userMuted,
|
|
@@ -12570,11 +12747,11 @@ var Rx = class {
|
|
|
12570
12747
|
holdDecoyWhilePaused: this.holdsDecoyWhilePaused(),
|
|
12571
12748
|
keepDecoyWhenMuted: this.isWebKitCanvasPath(),
|
|
12572
12749
|
pauseMeansMute: !this.options.get("pauseSupportEnabled")
|
|
12573
|
-
}) : void 0, v = D.create(), re =
|
|
12750
|
+
}) : void 0, v = D.create(), re = Ab.create(this.emitter, this.logger.createContext("ConnectionModule"), {
|
|
12574
12751
|
reconnectHandler: this.options.get("reconnectHandler"),
|
|
12575
12752
|
options: this.options,
|
|
12576
12753
|
onConnectInfo: this.onConnectInfo
|
|
12577
|
-
}), ae =
|
|
12754
|
+
}), ae = jv.create(this.logger.createContext("SubscriptionModule"), this.emitter, d), x = Qx.create(this.emitter, ae), S = Ux.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime")), se = Xx.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), x, S);
|
|
12578
12755
|
this.encryptedMediaExtensions = new wi(this.emitter, this.logger.createContext("EncryptedMediaExtensions"), r.drm), this.drm = {
|
|
12579
12756
|
setHeaders: (e) => {
|
|
12580
12757
|
this.encryptedMediaExtensions.headers = e;
|
|
@@ -12583,7 +12760,7 @@ var Rx = class {
|
|
|
12583
12760
|
this.encryptedMediaExtensions.queryParams = e;
|
|
12584
12761
|
}
|
|
12585
12762
|
};
|
|
12586
|
-
let ce =
|
|
12763
|
+
let ce = Zb.create(this.emitter), le = this.options.get("poster"), ue = le === !0 ? this.getThumbnailUrl() : le || void 0, C, de, fe;
|
|
12587
12764
|
if (this.willUseMediaSource()) {
|
|
12588
12765
|
let e = new fc({
|
|
12589
12766
|
type: this.options.get("media") === "audio" ? "audio" : "video",
|
|
@@ -12593,9 +12770,9 @@ var Rx = class {
|
|
|
12593
12770
|
logger: this.logger.createContext("MediaElement"),
|
|
12594
12771
|
poster: ue
|
|
12595
12772
|
});
|
|
12596
|
-
e.on("buffer state", (e) => this.onMediaElementBufferState(e, C)), 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, wi.isSupported() && this.encryptedMediaExtensions.attach(e.element), C =
|
|
12773
|
+
e.on("buffer state", (e) => this.onMediaElementBufferState(e, C)), 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, wi.isSupported() && this.encryptedMediaExtensions.attach(e.element), C = Ax.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (de = bS.create(this.logger.createContext("UnpauseModule"), [e], ce)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
|
|
12597
12774
|
} else if (this.streamsToMediaElement()) {
|
|
12598
|
-
let e =
|
|
12775
|
+
let e = Tx.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
|
|
12599
12776
|
type: this.options.get("media") === "audio" ? "audio" : "video",
|
|
12600
12777
|
muted: this.options.get("muted") || this.options.get("media") === "video",
|
|
12601
12778
|
volume: this.options.get("volume"),
|
|
@@ -12607,10 +12784,10 @@ var Rx = class {
|
|
|
12607
12784
|
});
|
|
12608
12785
|
this.element = e.element().element, this.playbackSource = e, fe = e;
|
|
12609
12786
|
let t = this.browser.platform.isIOS && this.browser.platform.iosVersion <= 15;
|
|
12610
|
-
this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (de =
|
|
12787
|
+
this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (de = bS.create(this.logger.createContext("UnpauseModule"), e.elements(), ce));
|
|
12611
12788
|
} else {
|
|
12612
12789
|
let e;
|
|
12613
|
-
e =
|
|
12790
|
+
e = vx.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
|
|
12614
12791
|
this.setElement(e.element());
|
|
12615
12792
|
}, this.options.get("minBufferTime")), this.element = e.element(), this.playbackSource = e, fe = e, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new $s());
|
|
12616
12793
|
}
|
|
@@ -12628,9 +12805,9 @@ var Rx = class {
|
|
|
12628
12805
|
getTargetBufferTime: () => S.getTargetBufferTime(),
|
|
12629
12806
|
getNextBufferedRangeStart: C ? (e) => C.getNextBufferedRangeStart(e) : void 0,
|
|
12630
12807
|
getBufferedEndAt: C ? (e) => C.getBufferedEndAt(e) : void 0
|
|
12631
|
-
}, ge =
|
|
12808
|
+
}, ge = mS.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, he, me, pe), _e = rx.create(this.logger.createContext("JitterModule")), ve = hc.create(this.emitter), ye = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), w = new URL("/telemetry", ye).toString();
|
|
12632
12809
|
this.modules = {
|
|
12633
|
-
telemetry:
|
|
12810
|
+
telemetry: vS.create(this.logger.createContext("TelemetryModule"), this.emitter, {
|
|
12634
12811
|
url: w,
|
|
12635
12812
|
enabled: this.options.get("telemetryEnabled"),
|
|
12636
12813
|
includeStats: !1,
|
|
@@ -12642,8 +12819,8 @@ var Rx = class {
|
|
|
12642
12819
|
}),
|
|
12643
12820
|
incomingData: ve,
|
|
12644
12821
|
adaptivity: Tc.create(this.emitter, this.logger.createContext("AdaptivityModule"), se, ve, { cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3) }),
|
|
12645
|
-
constraintCap:
|
|
12646
|
-
event:
|
|
12822
|
+
constraintCap: Fb.create(this.emitter, this.element, x, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
|
|
12823
|
+
event: ex.create(this.emitter, this.logger.createContext("EventModule"), ge),
|
|
12647
12824
|
sync: ge,
|
|
12648
12825
|
jitter: _e,
|
|
12649
12826
|
documentState: ce,
|
|
@@ -12715,7 +12892,7 @@ var Rx = class {
|
|
|
12715
12892
|
let r = ((t = (n = e.telemetry) == null ? void 0 : n.probability) == null ? 1 : t) >= Math.random();
|
|
12716
12893
|
if (e.telemetry) {
|
|
12717
12894
|
var i;
|
|
12718
|
-
(i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry =
|
|
12895
|
+
(i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = vS.create(this.logger.createContext("TelemetryModule"), this.emitter, y(y({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
|
|
12719
12896
|
}
|
|
12720
12897
|
}), this.emitter.on("adapt level", (e) => {
|
|
12721
12898
|
let t = this.modules.renditions.getRenditionLevels(), n = this.modules.renditions.getRenditionLevel(), r = t.findIndex((e) => e === n), i = t.length - 1, a = r;
|
|
@@ -12724,6 +12901,7 @@ var Rx = class {
|
|
|
12724
12901
|
{
|
|
12725
12902
|
var o, s, c, l, u;
|
|
12726
12903
|
let e = Math.min(r + 1, i), n = t[e], d = (o = this.modules.connection.estimatedBandwidth) == null ? hn() : o, f = ((s = n == null || (c = n.audio) == null ? void 0 : c.bitRate) == null ? 0 : s) + ((l = n == null || (u = n.video) == null ? void 0 : u.bitRate) == null ? 0 : l), p = d * 2 > f;
|
|
12904
|
+
if (e > r && this.linkHoldsUpgrade()) break;
|
|
12727
12905
|
n && p && this.modules.adaptivity.isQoSOk(n) && (a = e);
|
|
12728
12906
|
}
|
|
12729
12907
|
break;
|
|
@@ -12733,21 +12911,32 @@ var Rx = class {
|
|
|
12733
12911
|
case "double downgrade":
|
|
12734
12912
|
a = Math.max(r - 2, 0);
|
|
12735
12913
|
break;
|
|
12736
|
-
case "reconnect":
|
|
12737
|
-
|
|
12738
|
-
|
|
12914
|
+
case "reconnect": {
|
|
12915
|
+
var d;
|
|
12916
|
+
let e = this.modules.connection.lastConnectionTime;
|
|
12917
|
+
if (e !== void 0 && performance.now() - e >= this.modules.qualityOfService.fatalQosGraceTime() && this.modules.connection.getState() === "connected" && (r === 0 || this.modules.qualityOfService.timeSpentBufferingLast(6e3) > 5e3)) {
|
|
12918
|
+
this.modules.qualityOfService.incrementFatalQosCount(), this.logger.info("Reconnecting due to poor qos"), this.modules.connection.reconnect("Fatal QOS"), this.emitter.emit("adapted level");
|
|
12919
|
+
return;
|
|
12920
|
+
}
|
|
12921
|
+
if (this.modules.subscription.getTargetSubscription().channelId !== ((d = this.modules.subscription.getCurrentSubscription()) == null ? void 0 : d.channelId)) return;
|
|
12922
|
+
let t = this.targetSubscription, n = this.modules.renditions.getRenditionLevels(t)[0];
|
|
12923
|
+
if (!n || Et(this.modules.renditions.getRenditionLevel(t), n)) return;
|
|
12924
|
+
this.alignSizeAndBitRate(y(y({}, t), {}, {
|
|
12925
|
+
video: y(y({}, t.video), n.video),
|
|
12926
|
+
audio: y(y({}, t.audio), n.audio)
|
|
12927
|
+
})), this.emitter.emit("adapted level");
|
|
12739
12928
|
return;
|
|
12740
|
-
}
|
|
12929
|
+
}
|
|
12741
12930
|
}
|
|
12742
|
-
if (a === r) return;
|
|
12743
|
-
let
|
|
12931
|
+
if (this.modules.connection.isMoq && this.modules.subscription.isSwitchingSubscription() || a === r) return;
|
|
12932
|
+
let f = t[a];
|
|
12744
12933
|
this.alignSizeAndBitRate(y(y({}, this.targetSubscription), {}, {
|
|
12745
|
-
video: y(y({}, this.targetSubscription.video),
|
|
12746
|
-
audio: y(y({}, this.targetSubscription.audio),
|
|
12934
|
+
video: y(y({}, this.targetSubscription.video), f == null ? void 0 : f.video),
|
|
12935
|
+
audio: y(y({}, this.targetSubscription.audio), f == null ? void 0 : f.audio)
|
|
12747
12936
|
})), this.emitter.emit("adapted level");
|
|
12748
|
-
}), this.emitter.on("text track data", (e) => {
|
|
12749
|
-
let t = s(
|
|
12750
|
-
if (a(
|
|
12937
|
+
}), this.emitter.on("ping timeout", this.stepDownForRejoin), this.emitter.on("text track data", (e) => {
|
|
12938
|
+
let t = s(qS, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(KS, this);
|
|
12939
|
+
if (a(KS, this, n), t) {
|
|
12751
12940
|
if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
|
|
12752
12941
|
for (let r of e.cues) {
|
|
12753
12942
|
let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
|
|
@@ -12757,25 +12946,25 @@ var Rx = class {
|
|
|
12757
12946
|
}), this.emitter.on("native text track selected", (e) => {
|
|
12758
12947
|
this.textTrack = e;
|
|
12759
12948
|
}), this.emitter.on("received signal", (e) => {
|
|
12760
|
-
let t = e, n = this.modules.subscription.getCurrentSubscription();
|
|
12949
|
+
let t = e, n = this.modules.subscription.getCurrentSubscription(), r = this.sessionId;
|
|
12761
12950
|
switch (this.logger.debug("received", y({}, t)), t.type) {
|
|
12762
12951
|
case "client ip":
|
|
12763
12952
|
this.clientIp = t.ip;
|
|
12764
12953
|
break;
|
|
12765
12954
|
case "renditions":
|
|
12766
|
-
this.updateTextTracks(t.renditions), a(
|
|
12767
|
-
this.emitter.emit("renditions", {
|
|
12955
|
+
this.updateTextTracks(t.renditions), a(JS, this, this.filterRenditions(t.renditions, n.channelId).then((e) => {
|
|
12956
|
+
r === this.sessionId && (this.emitter.emit("renditions", {
|
|
12768
12957
|
renditions: e,
|
|
12769
|
-
channelId:
|
|
12770
|
-
}), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
|
|
12958
|
+
channelId: n.channelId
|
|
12959
|
+
}), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged());
|
|
12771
12960
|
}).finally(() => {
|
|
12772
|
-
a(
|
|
12961
|
+
a(JS, this, void 0);
|
|
12773
12962
|
}));
|
|
12774
12963
|
break;
|
|
12775
12964
|
case "subscription changed":
|
|
12776
|
-
var
|
|
12965
|
+
var i;
|
|
12777
12966
|
try {
|
|
12778
|
-
|
|
12967
|
+
zS(t.subscription);
|
|
12779
12968
|
} catch (e) {
|
|
12780
12969
|
this.emitter.emit("error", new O("Subscription failed validation", {
|
|
12781
12970
|
source: e instanceof Error ? e : void 0,
|
|
@@ -12787,14 +12976,14 @@ var Rx = class {
|
|
|
12787
12976
|
reset: t.reset,
|
|
12788
12977
|
to: t.subscription,
|
|
12789
12978
|
from: this.modules.subscription.getCurrentSubscription()
|
|
12790
|
-
}), t.reset && n.channelId !== t.subscription.channelId && (this.emit("error", ir(t.subscription.channelId)), this.emit("channel switch failed", { channelId: n.channelId })), this.modules.sync.allowTimeshiftOnAudio = !((
|
|
12979
|
+
}), t.reset && n.channelId !== t.subscription.channelId && (this.emit("error", ir(t.subscription.channelId)), this.emit("channel switch failed", { channelId: n.channelId })), this.modules.sync.allowTimeshiftOnAudio = !((i = t.subscription.video) != null && i.codec), this.modules.adaptivity.reset();
|
|
12791
12980
|
break;
|
|
12792
12981
|
case "timing info":
|
|
12793
12982
|
this.modules.sync.updateChannelSyncInfo(t.timingInfo.channelId, t.timingInfo), this.emit("server wallclock time", t.timingInfo.wallclockTime);
|
|
12794
12983
|
break;
|
|
12795
12984
|
}
|
|
12796
12985
|
}), this.emitter.on("channel switch timeout", (e) => {
|
|
12797
|
-
this.emit("error", ir(e)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
|
|
12986
|
+
this.alignSizeAndBitRate(this.targetSubscription), this.emit("error", ir(e)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
|
|
12798
12987
|
}), this.emitter.on("received data", (e) => {
|
|
12799
12988
|
let t = this.modules.subscription.getCurrentSubscription(), n = Us(e);
|
|
12800
12989
|
if (!t) {
|
|
@@ -12906,7 +13095,7 @@ var Rx = class {
|
|
|
12906
13095
|
let xe = function() {
|
|
12907
13096
|
var e = t(function* (e) {
|
|
12908
13097
|
let t = e.channelId;
|
|
12909
|
-
s(
|
|
13098
|
+
s(JS, o) && (yield s(JS, o));
|
|
12910
13099
|
let n = o.modules.renditions.getRendition(e.renditionId, t);
|
|
12911
13100
|
if (!Bs(e.flags)) {
|
|
12912
13101
|
if (Vs(e.flags)) {
|
|
@@ -12920,8 +13109,8 @@ var Rx = class {
|
|
|
12920
13109
|
} catch (e) {
|
|
12921
13110
|
o.logger.warn("failed to parse WebVTT segment, dropping it", e);
|
|
12922
13111
|
}
|
|
12923
|
-
let i = n / 1e3, c = s(
|
|
12924
|
-
if (a(
|
|
13112
|
+
let i = n / 1e3, c = s(qS, o).find((t) => t.language === e.language), l = i - s(KS, o);
|
|
13113
|
+
if (a(KS, o, i), c) {
|
|
12925
13114
|
if (c.cues) for (let e of c.cues) e.startTime -= l, e.endTime -= l;
|
|
12926
13115
|
for (let e of r) {
|
|
12927
13116
|
let t = new VTTCue(e.startTime - i, e.endTime - i, e.text);
|
|
@@ -12957,10 +13146,10 @@ var Rx = class {
|
|
|
12957
13146
|
mimeType: s
|
|
12958
13147
|
}), o.emit("initialized media");
|
|
12959
13148
|
} else {
|
|
12960
|
-
let t =
|
|
13149
|
+
let t = AS(e, n, o.sizes.get(e.renditionId));
|
|
12961
13150
|
o.modules.jitter.recordSample(t);
|
|
12962
13151
|
let i = o.sampleProcessingSesssions.get(r);
|
|
12963
|
-
if (!i) i =
|
|
13152
|
+
if (!i) i = TS(o.modules.sync.processSample(t)), o.sampleProcessingSesssions.set(r, i);
|
|
12964
13153
|
else {
|
|
12965
13154
|
let e = o.willUseMediaSource() && o.isSwitchingRenditionLevel && t.type === "video", n = i(o.modules.sync.processSample(t), e), r = t;
|
|
12966
13155
|
n.forEach((e) => {
|
|
@@ -13067,7 +13256,7 @@ var Rx = class {
|
|
|
13067
13256
|
this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
|
|
13068
13257
|
}
|
|
13069
13258
|
set textTrack(e) {
|
|
13070
|
-
e !== this.textTrack && (s(
|
|
13259
|
+
e !== this.textTrack && (s(qS, this).forEach((t) => {
|
|
13071
13260
|
if (t.label === e) t.mode = "showing";
|
|
13072
13261
|
else {
|
|
13073
13262
|
if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
|
|
@@ -13076,11 +13265,11 @@ var Rx = class {
|
|
|
13076
13265
|
}), this.emitter.emit("text track", e));
|
|
13077
13266
|
}
|
|
13078
13267
|
get textTracks() {
|
|
13079
|
-
return s(
|
|
13268
|
+
return s(qS, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
|
|
13080
13269
|
}
|
|
13081
13270
|
get textTrack() {
|
|
13082
13271
|
var e;
|
|
13083
|
-
return (e = s(
|
|
13272
|
+
return (e = s(qS, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
|
|
13084
13273
|
}
|
|
13085
13274
|
get channelId() {
|
|
13086
13275
|
var e, t;
|
|
@@ -13218,7 +13407,7 @@ var Rx = class {
|
|
|
13218
13407
|
return this.modules.subscription.getTargetSubscription();
|
|
13219
13408
|
}
|
|
13220
13409
|
resolvedDecoder(e) {
|
|
13221
|
-
return
|
|
13410
|
+
return kS(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
|
|
13222
13411
|
}
|
|
13223
13412
|
usesSplitCanvasAudio() {
|
|
13224
13413
|
return !this.willUseMediaSource() && this.options.get("streamToMediaElementEnabled") && gt(this.browser) && this.options.get("media") !== "audio" && this.options.get("media") !== "video" && this.browser.platform.isIOS;
|
|
@@ -13258,6 +13447,6 @@ var Rx = class {
|
|
|
13258
13447
|
return this.hasCalledConnect && this.isBackgroundPlayEnabled(e) && !this.isUserPaused;
|
|
13259
13448
|
}
|
|
13260
13449
|
};
|
|
13261
|
-
e(
|
|
13450
|
+
e(YS, "MAX_POOL_SIZE", 10), e(YS, "REMOVE_CUE_THRESHOLD", 1e3 * 10), e(YS, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 1e3 * 15), e(YS, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
|
|
13262
13451
|
//#endregion
|
|
13263
|
-
export { ft as C, ht as D, dt as E, Ve as O, mt as S, st as T, rt as _, Sn as a, nt as b, vn as c, wn as d, O as f, et as g, it as h, bn as i, Be as k, kn as l, tt as m, Fn as n, Cn as o, Yt as p, xn as r, yn as s,
|
|
13452
|
+
export { ft as C, ht as D, dt as E, Ve as O, mt as S, st as T, rt as _, Sn as a, nt as b, vn as c, wn as d, O as f, et as g, it as h, bn as i, Be as k, kn as l, tt as m, Fn as n, Cn as o, Yt as p, xn as r, yn as s, YS as t, Tn as u, lt as v, ut as w, ot as x, $e as y };
|