@vindral/web-sdk 4.2.0-43-g56b43428 → 4.2.0-44-g781abd38
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/{D3wmSZ31.js → CWnxclst.js} +317 -178
- package/{Bj_AaV0h.js → Cu3cx7bH.js} +1 -1
- package/core.d.ts +3 -0
- package/core.js +1 -1
- package/legacy.d.ts +3 -0
- package/legacy.es.js +449 -310
- package/legacy.umd.js +8 -8
- package/package.json +1 -1
- package/player.d.ts +3 -0
- package/player.js +2 -2
- package/react.d.ts +3 -0
- package/vindral-player-component.js +2 -2
|
@@ -3424,7 +3424,11 @@ var ss = (e) => {
|
|
|
3424
3424
|
}, cs = class extends _e {
|
|
3425
3425
|
constructor({ type: n, autoplay: r, muted: i, volume: a, logger: s, poster: c }) {
|
|
3426
3426
|
var l;
|
|
3427
|
-
super(), l = this, e(this, "element", void 0), e(this, "logger", void 0), e(this, "seekTimes", new _(10)), e(this, "seekStartTime", void 0), e(this, "_totalSeekTime", 0), e(this, "_userProvidedMuted", void 0), e(this, "timers", new j()), e(this, "_userHasProvidedInput", !1), e(this, "_isPaused", !0), e(this, "isActivated", !1), e(this, "dummy", void 0), e(this, "
|
|
3427
|
+
super(), l = this, e(this, "element", void 0), e(this, "logger", void 0), e(this, "seekTimes", new _(10)), e(this, "seekStartTime", void 0), e(this, "_totalSeekTime", 0), e(this, "_userProvidedMuted", void 0), e(this, "timers", new j()), e(this, "_userHasProvidedInput", !1), e(this, "_isPaused", !0), e(this, "isActivated", !1), e(this, "dummy", void 0), e(this, "addEventListeners", () => {
|
|
3428
|
+
this.element.addEventListener("stalled", this.onEvent), this.element.addEventListener("canplay", this.onEvent), this.element.addEventListener("loadeddata", this.onEvent), this.element.addEventListener("loadedmetadata", this.onEvent), this.element.addEventListener("canplaythrough", this.onEvent), this.element.addEventListener("waiting", this.onWaiting), this.element.addEventListener("playing", this.onPlayPause), this.element.addEventListener("pause", this.onPlayPause), this.element.addEventListener("seeked", this.onSeekEnd), this.element.addEventListener("seeking", this.onSeekStart), this.element.addEventListener("volumechange", this.onVolumeChange), this.element.addEventListener("timeupdate", this.onBufferStateChange), this.element.addEventListener("progress", this.onBufferStateChange);
|
|
3429
|
+
}), e(this, "removeEventListeners", () => {
|
|
3430
|
+
this.element.removeEventListener("stalled", this.onEvent), this.element.removeEventListener("canplay", this.onEvent), this.element.removeEventListener("loadeddata", this.onEvent), this.element.removeEventListener("loadedmetadata", this.onEvent), this.element.removeEventListener("canplaythrough", this.onEvent), this.element.removeEventListener("waiting", this.onWaiting), this.element.removeEventListener("playing", this.onPlayPause), this.element.removeEventListener("pause", this.onPlayPause), this.element.removeEventListener("seeked", this.onSeekEnd), this.element.removeEventListener("seeking", this.onSeekStart), this.element.removeEventListener("volumechange", this.onVolumeChange), this.element.removeEventListener("timeupdate", this.onBufferStateChange), this.element.removeEventListener("progress", this.onBufferStateChange);
|
|
3431
|
+
}), e(this, "_iosHackEnterPiPMode", () => {
|
|
3428
3432
|
let e = this.element.parentElement, t = this.element.clientWidth / this.element.clientHeight;
|
|
3429
3433
|
this.element.style.position = "fixed", this.element.style.opacity = "0", this.element.style.pointerEvents = "none", e && (this.dummy = document.createElement("video"), this.dummy.style.paddingBottom = `calc(100% / ${t})`, this.dummy.style.width = "100%", this.dummy.style.height = "0px", e.appendChild(this.dummy));
|
|
3430
3434
|
}), e(this, "_iosHackExitPiPMode", () => {
|
|
@@ -3436,8 +3440,8 @@ var ss = (e) => {
|
|
|
3436
3440
|
this.timers.setInterval(this.onBufferStateChange, 500);
|
|
3437
3441
|
}, 1e4);
|
|
3438
3442
|
}), e(this, "unload", () => {
|
|
3439
|
-
this.timers.unload();
|
|
3440
|
-
}), e(this, "getPlaybackRate", () => this.element.playbackRate), e(this, "getPlaybackState", () => this.element.readyState >= this.element.HAVE_FUTURE_DATA ? "playing" : "buffering"), e(this, "setPlaybackRate", (e) => void (this.element.playbackRate = e)), e(this, "getBuffer", () => {
|
|
3443
|
+
this.timers.unload(), this.removeEventListeners();
|
|
3444
|
+
}), e(this, "getPlaybackRate", () => this.element.playbackRate), e(this, "getPlaybackState", () => this.element.readyState >= this.element.HAVE_FUTURE_DATA ? "playing" : "buffering"), e(this, "getMediaElementState", () => this.element.paused ? "paused" : "playing"), e(this, "setPlaybackRate", (e) => void (this.element.playbackRate = e)), e(this, "getBuffer", () => {
|
|
3441
3445
|
let e = [], t = this.element.buffered;
|
|
3442
3446
|
if (!t) return [];
|
|
3443
3447
|
for (let n = 0; n < t.length; n++) e.push({
|
|
@@ -3480,6 +3484,8 @@ var ss = (e) => {
|
|
|
3480
3484
|
event: e,
|
|
3481
3485
|
playbackState: this.getPlaybackState()
|
|
3482
3486
|
});
|
|
3487
|
+
}), e(this, "onWaiting", (e) => {
|
|
3488
|
+
this.onEvent(e), this.onBufferStateChange();
|
|
3483
3489
|
}), e(this, "onVolumeChange", () => {
|
|
3484
3490
|
this.logger.info("volume state", {
|
|
3485
3491
|
isMuted: this.element.muted,
|
|
@@ -3489,14 +3495,14 @@ var ss = (e) => {
|
|
|
3489
3495
|
volume: this.element.volume
|
|
3490
3496
|
});
|
|
3491
3497
|
}), e(this, "onPlayPause", () => {
|
|
3492
|
-
this._isPaused !== this.element.paused && (this._isPaused = this.element.paused, this.logger.info("player pause change", { paused: this.element.paused }), this.emit("media element state", this.
|
|
3493
|
-
}), e(this, "
|
|
3494
|
-
this.
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3498
|
+
this._isPaused !== this.element.paused && (this._isPaused = this.element.paused, this.logger.info("player pause change", { paused: this.element.paused }), this.emit("media element state", this.getMediaElementState()));
|
|
3499
|
+
}), e(this, "getBufferState", () => ({
|
|
3500
|
+
isPaused: this.element.paused,
|
|
3501
|
+
buffered: this.getBuffer(),
|
|
3502
|
+
currentTime: this.currentTime,
|
|
3503
|
+
playbackState: this.getPlaybackState()
|
|
3504
|
+
})), e(this, "onBufferStateChange", () => {
|
|
3505
|
+
this.emit("buffer state", this.getBufferState());
|
|
3500
3506
|
}), e(this, "onSeekStart", () => {
|
|
3501
3507
|
this.seekStartTime = Date.now();
|
|
3502
3508
|
}), e(this, "onSeekEnd", () => {
|
|
@@ -3505,7 +3511,7 @@ var ss = (e) => {
|
|
|
3505
3511
|
this.seekTimes.push(e), this._totalSeekTime += e, this.seekStartTime = void 0;
|
|
3506
3512
|
}), this.logger = s, this._userProvidedMuted = i, this.element = document.createElement(n), this.element instanceof HTMLVideoElement && (this.element.playsInline = !0), this.element.controls = !1, this.element.autoplay = r, this.element.muted = i, a !== void 0 && (this.element.volume = a), this.element.style.display = "block", this.element.style.width = "100%", this.element.disableRemotePlayback = !0, this.element.setAttribute("poster", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg=="), this.onPlayPause(), setTimeout(() => {
|
|
3507
3513
|
!this.element || !c || this.element.setAttribute("poster", c);
|
|
3508
|
-
}, 0), this.
|
|
3514
|
+
}, 0), this.addEventListeners();
|
|
3509
3515
|
}
|
|
3510
3516
|
get seekTime() {
|
|
3511
3517
|
return this.seekTimes.isEmpty() ? 0 : Ot(this.seekTimes.items());
|
|
@@ -9194,7 +9200,7 @@ function z_({ initSegments: e, pendingSamples: t }) {
|
|
|
9194
9200
|
initSegments: e == null ? new L_() : e,
|
|
9195
9201
|
sequenceNumber: 0,
|
|
9196
9202
|
isWorkingOnPendingSamples: !1,
|
|
9197
|
-
hasFirstSync:
|
|
9203
|
+
hasFirstSync: t.some((e) => e.isSync),
|
|
9198
9204
|
pendingSamples: t == null ? [] : t,
|
|
9199
9205
|
pendingSamplesOffset: 0,
|
|
9200
9206
|
consecutiveQuotaExceededErrorCount: 0,
|
|
@@ -9204,10 +9210,10 @@ function z_({ initSegments: e, pendingSamples: t }) {
|
|
|
9204
9210
|
var B_ = class {
|
|
9205
9211
|
constructor(n, a, s) {
|
|
9206
9212
|
var u = this;
|
|
9207
|
-
e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", j.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new F_()), e(this, "trackContexts", /* @__PURE__ */ new Map()), e(this, "autoRecoverFromMediaErrors", !0), e(this, "quotaErrorCount", 0), e(this, "recoveredFromErrorCount", 0), e(this, "sourceOpenStartTime", Date.now()), e(this, "sourceOpenEndTime", Date.now()), e(this, "pendingTracksToAddSourceBuffers", void 0), e(this, "hasAddedInitialPosterFrame", !0), e(this, "videoKeyframeTimestamps", []), e(this, "isReopening", !1), e(this, "load", () => {
|
|
9213
|
+
e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", j.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new F_()), e(this, "trackContexts", /* @__PURE__ */ new Map()), e(this, "autoRecoverFromMediaErrors", !0), e(this, "quotaErrorCount", 0), e(this, "recoveredFromErrorCount", 0), e(this, "sourceOpenStartTime", Date.now()), e(this, "sourceOpenEndTime", Date.now()), e(this, "pendingTracksToAddSourceBuffers", void 0), e(this, "hasAddedInitialPosterFrame", !0), e(this, "videoKeyframeTimestamps", []), e(this, "isReopening", !1), e(this, "playbackStallCount", 0), e(this, "hasStartedPlayback", !1), e(this, "isPlaybackStalled", !1), e(this, "load", () => {
|
|
9208
9214
|
this.emitter.on("init segment", this.init), this.emitter.on("coded sample", this.onCodedSample), this.emitter.on("flush buffers", this.flushBuffers), this.emitter.on("fragment", this.onFragment);
|
|
9209
9215
|
}), e(this, "unload", () => {
|
|
9210
|
-
this.logger.debug("Unloading module..."), this.emitter.off("init segment", this.init), this.emitter.off("coded sample", this.onCodedSample), this.emitter.off("flush buffers", this.flushBuffers), this.emitter.off("fragment", this.onFragment), this.mediaSource.off("source ended", this.onSourceEnded), this.mediaSource.off("source open", this.onSourceOpen), this.mediaElement.removeEventListener("error", this.onMediaElementError), this.mediaSource.detach(this.mediaElement), this.trackContexts.forEach((e) => {
|
|
9216
|
+
this.logger.debug("Unloading module..."), this.emitter.off("init segment", this.init), this.emitter.off("coded sample", this.onCodedSample), this.emitter.off("flush buffers", this.flushBuffers), this.emitter.off("fragment", this.onFragment), this.mediaSource.off("source ended", this.onSourceEnded), this.mediaSource.off("source open", this.onSourceOpen), this.mediaElement.removeEventListener("error", this.onMediaElementError), this.mediaElement.removeEventListener("waiting", this.onPlaybackStall), this.mediaElement.removeEventListener("stalled", this.onPlaybackStall), this.mediaElement.removeEventListener("playing", this.onPlaybackProgress), this.mediaElement.removeEventListener("pause", this.onPlaybackPauseOrSeek), this.mediaElement.removeEventListener("seeking", this.onPlaybackPauseOrSeek), this.mediaSource.detach(this.mediaElement), this.trackContexts.forEach((e) => {
|
|
9211
9217
|
e.state === "initialized" && e.sourceBuffer.dispose(), e.pendingSamples = [], e.pendingSamplesOffset = 0;
|
|
9212
9218
|
}), this.videoKeyframeTimestamps = [], this.timers.unload(), this.logger.debug("Unloaded module");
|
|
9213
9219
|
}), e(this, "getStatistics", () => {
|
|
@@ -9215,6 +9221,7 @@ var B_ = class {
|
|
|
9215
9221
|
let n = {
|
|
9216
9222
|
quotaErrorCount: this.quotaErrorCount,
|
|
9217
9223
|
mediaSourceOpenTime: this.sourceOpenEndTime - this.sourceOpenStartTime,
|
|
9224
|
+
playbackStallCount: this.playbackStallCount,
|
|
9218
9225
|
successfulAudioAppendsCalls: (e = this.trackContexts.get("audio")) == null ? void 0 : e.successfulAppendCalls,
|
|
9219
9226
|
successfulVideoAppendCalls: (t = this.trackContexts.get("video")) == null ? void 0 : t.successfulAppendCalls,
|
|
9220
9227
|
videoKeyframeIntervalMs: kt(this.videoKeyframeTimestamps),
|
|
@@ -9246,12 +9253,24 @@ var B_ = class {
|
|
|
9246
9253
|
});
|
|
9247
9254
|
l.pendingSamplesOffset = c, this.trackContexts.set(t, l);
|
|
9248
9255
|
});
|
|
9249
|
-
}), e(this, "
|
|
9256
|
+
}), e(this, "resetRemovedTrackContexts", (e) => {
|
|
9257
|
+
let t = new Set(e.map((e) => e.type));
|
|
9258
|
+
this.trackContexts.forEach((e, n) => {
|
|
9259
|
+
if (t.has(n)) return;
|
|
9260
|
+
e.state === "initialized" && this.mediaSource.isOpen() && this.mediaSource.removeSourceBuffer(e.sourceBuffer);
|
|
9261
|
+
let r = z_({
|
|
9262
|
+
pendingSamples: [],
|
|
9263
|
+
initSegments: e.initSegments
|
|
9264
|
+
});
|
|
9265
|
+
this.trackContexts.set(n, r);
|
|
9266
|
+
});
|
|
9267
|
+
}), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "setSourceBuffers", function() {
|
|
9250
9268
|
var e = t(function* (e) {
|
|
9251
9269
|
if (u.mediaSource.isClosed()) {
|
|
9252
9270
|
u.pendingTracksToAddSourceBuffers = e;
|
|
9253
9271
|
return;
|
|
9254
9272
|
}
|
|
9273
|
+
u.resetRemovedTrackContexts(e);
|
|
9255
9274
|
let t = !0;
|
|
9256
9275
|
for (let n of e) {
|
|
9257
9276
|
let e = u.trackContexts.get(n.type);
|
|
@@ -9284,21 +9303,18 @@ var B_ = class {
|
|
|
9284
9303
|
return e.apply(this, arguments);
|
|
9285
9304
|
};
|
|
9286
9305
|
}()), e(this, "getBuffer", (e) => {
|
|
9287
|
-
let t = [];
|
|
9288
9306
|
if (this.mediaSource.isClosed()) return [];
|
|
9289
|
-
let
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
return [];
|
|
9301
|
-
}
|
|
9307
|
+
let t = this.trackContexts.get(e);
|
|
9308
|
+
return !t || t.state === "uninitialized" ? [] : this.getBufferedRanges(t.sourceBuffer);
|
|
9309
|
+
}), e(this, "getBufferState", (e) => {
|
|
9310
|
+
let t = this.getCommonBufferedRangesForCurrentTracks();
|
|
9311
|
+
if (t) return {
|
|
9312
|
+
buffered: t,
|
|
9313
|
+
playbackState: this.getPlaybackStateForBufferedRanges(e, t)
|
|
9314
|
+
};
|
|
9315
|
+
}), e(this, "getNextBufferedRangeStart", (e) => {
|
|
9316
|
+
let t = this.getCommonBufferedRangesForCurrentTracks();
|
|
9317
|
+
if (t) return H_(e, t);
|
|
9302
9318
|
}), e(this, "getVideoKeyframeTimestamps", () => this.videoKeyframeTimestamps), e(this, "init", ({ initSegment: e, mimeType: t }) => {
|
|
9303
9319
|
this.logger.debug("Added init segment", {
|
|
9304
9320
|
channel: e.channelId,
|
|
@@ -9397,21 +9413,27 @@ var B_ = class {
|
|
|
9397
9413
|
let t = (e.timestamp + ((n = e.compositionTimeOffset) == null ? 0 : n)) / e.timescale * 1e3, r = this.videoKeyframeTimestamps[this.videoKeyframeTimestamps.length - 1];
|
|
9398
9414
|
r !== void 0 && t < r && (this.videoKeyframeTimestamps = []), this.videoKeyframeTimestamps.push(t), this.videoKeyframeTimestamps.length > 20 && (this.videoKeyframeTimestamps = this.videoKeyframeTimestamps.slice(-20));
|
|
9399
9415
|
}
|
|
9400
|
-
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples ||
|
|
9401
|
-
if (t.isWorkingOnPendingSamples = !1, !this.isReopening
|
|
9402
|
-
if (this.
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
}
|
|
9406
|
-
|
|
9416
|
+
t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || q_(t, this.append, this.maxChunkSize).catch((n) => {
|
|
9417
|
+
if (t.isWorkingOnPendingSamples = !1, !this.isReopening) {
|
|
9418
|
+
if (!this.isCurrentTrackContext(e.type, t)) {
|
|
9419
|
+
this.logger.debug("Suppressing append error from stale track context", { type: e.type });
|
|
9420
|
+
return;
|
|
9421
|
+
}
|
|
9422
|
+
if (n instanceof Error) {
|
|
9423
|
+
if (this.logger.error("append failed", {
|
|
9424
|
+
message: n.message,
|
|
9425
|
+
name: n.name
|
|
9426
|
+
}), n instanceof DOMException && n.code === DOMException.QUOTA_EXCEEDED_ERR) {
|
|
9427
|
+
if (t.consecutiveQuotaExceededErrorCount >= this.minConsecutiveErrorsBeforeEmit) {
|
|
9428
|
+
let r = ae(!1, n, t.consecutiveQuotaExceededErrorCount, e.type);
|
|
9429
|
+
this.emitter.emit("error", r);
|
|
9430
|
+
}
|
|
9431
|
+
} else {
|
|
9407
9432
|
let r = ae(!1, n, t.consecutiveQuotaExceededErrorCount, e.type);
|
|
9408
9433
|
this.emitter.emit("error", r);
|
|
9409
9434
|
}
|
|
9410
|
-
|
|
9411
|
-
let r = ae(!1, n, t.consecutiveQuotaExceededErrorCount, e.type);
|
|
9412
|
-
this.emitter.emit("error", r);
|
|
9435
|
+
this.mediaElement.error && this.onSourceEnded();
|
|
9413
9436
|
}
|
|
9414
|
-
this.mediaElement.error && this.onSourceEnded();
|
|
9415
9437
|
}
|
|
9416
9438
|
}));
|
|
9417
9439
|
}
|
|
@@ -9443,27 +9465,82 @@ var B_ = class {
|
|
|
9443
9465
|
}), this.reopenMediaSource("media element error recovery"));
|
|
9444
9466
|
}), e(this, "onSourceEnded", () => {
|
|
9445
9467
|
this.mediaElement.error && this.onMediaElementError(), this.logger.debug("source ended");
|
|
9446
|
-
}), this
|
|
9468
|
+
}), e(this, "onPlaybackProgress", () => {
|
|
9469
|
+
this.hasStartedPlayback = !0, this.isPlaybackStalled = !1;
|
|
9470
|
+
}), e(this, "onPlaybackPauseOrSeek", () => {
|
|
9471
|
+
this.isPlaybackStalled = !1;
|
|
9472
|
+
}), e(this, "onPlaybackStall", (e) => {
|
|
9473
|
+
!this.hasStartedPlayback || this.mediaElement.paused || this.mediaElement.seeking || this.isPlaybackStalled || (this.playbackStallCount++, this.isPlaybackStalled = !0, this.logger.info("Detected playback stall", {
|
|
9474
|
+
event: e.type,
|
|
9475
|
+
currentTime: this.mediaElement.currentTime * 1e3,
|
|
9476
|
+
playbackStallCount: this.playbackStallCount
|
|
9477
|
+
}));
|
|
9478
|
+
}), e(this, "getBufferedRanges", (e) => {
|
|
9479
|
+
let t = [];
|
|
9480
|
+
try {
|
|
9481
|
+
let n = e.buffered();
|
|
9482
|
+
if (!n) return [];
|
|
9483
|
+
for (let e = 0; e < n.length; e++) t.push({
|
|
9484
|
+
start: n.start(e) * 1e3,
|
|
9485
|
+
end: n.end(e) * 1e3
|
|
9486
|
+
});
|
|
9487
|
+
return t;
|
|
9488
|
+
} catch (e) {
|
|
9489
|
+
return [];
|
|
9490
|
+
}
|
|
9491
|
+
}), e(this, "getInitializedTrackBuffers", () => {
|
|
9492
|
+
let e = [];
|
|
9493
|
+
return this.trackContexts.forEach((t) => {
|
|
9494
|
+
t.state !== "uninitialized" && e.push(this.getBufferedRanges(t.sourceBuffer));
|
|
9495
|
+
}), e;
|
|
9496
|
+
}), e(this, "getCommonBufferedRangesForCurrentTracks", () => {
|
|
9497
|
+
if (this.mediaSource.isClosed()) return;
|
|
9498
|
+
let e = this.getInitializedTrackBuffers();
|
|
9499
|
+
if (e.length !== 0) return this.getCommonBufferedRanges(e);
|
|
9500
|
+
}), e(this, "getCommonBufferedRanges", (e) => e.slice(1).reduce((e, t) => U_(e, t), e[0] ? Array.from(e[0]) : [])), e(this, "getPlaybackStateForBufferedRanges", (e, t) => V_(e, t) ? "playing" : "buffering"), this.logger = n, this.mediaElement = s, this.emitter = a;
|
|
9447
9501
|
}
|
|
9448
9502
|
};
|
|
9449
9503
|
I_ = B_, e(B_, "create", (e, t, n) => {
|
|
9450
9504
|
let r = new I_(e, t, n);
|
|
9451
|
-
return r.setTrackContexts(), r.mediaSource.on("source ended", r.onSourceEnded), r.mediaSource.on("source open", r.onSourceOpen), n.addEventListener("error", r.onMediaElementError), r.mediaSource.attach(n), r;
|
|
9505
|
+
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("seeking", r.onPlaybackPauseOrSeek), r.mediaSource.attach(n), r;
|
|
9452
9506
|
});
|
|
9453
|
-
var V_ = (e, t) => {
|
|
9507
|
+
var V_ = (e, t) => t.some((t) => t.start <= e && e < t.end), H_ = (e, t) => {
|
|
9508
|
+
for (let r = 0; r < t.length; r++) {
|
|
9509
|
+
let i = t[r];
|
|
9510
|
+
if (i) {
|
|
9511
|
+
if (e < i.start) return i.start;
|
|
9512
|
+
if (i.start <= e && e < i.end) {
|
|
9513
|
+
var n;
|
|
9514
|
+
return (n = t[r + 1]) == null ? void 0 : n.start;
|
|
9515
|
+
}
|
|
9516
|
+
}
|
|
9517
|
+
}
|
|
9518
|
+
}, U_ = (e, t) => {
|
|
9519
|
+
let n = [], r = 0, i = 0;
|
|
9520
|
+
for (; r < e.length && i < t.length;) {
|
|
9521
|
+
let a = e[r], o = t[i];
|
|
9522
|
+
if (!a || !o) break;
|
|
9523
|
+
let s = Math.max(a.start, o.start), c = Math.min(a.end, o.end);
|
|
9524
|
+
s < c && n.push({
|
|
9525
|
+
start: s,
|
|
9526
|
+
end: c
|
|
9527
|
+
}), a.end <= o.end ? r++ : i++;
|
|
9528
|
+
}
|
|
9529
|
+
return n;
|
|
9530
|
+
}, W_ = (e, t) => {
|
|
9454
9531
|
var n;
|
|
9455
9532
|
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;
|
|
9456
9533
|
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;
|
|
9457
|
-
},
|
|
9534
|
+
}, G_ = 32, K_ = (e) => {
|
|
9458
9535
|
let t = e.pendingSamplesOffset;
|
|
9459
9536
|
if (t !== 0) {
|
|
9460
9537
|
if (t >= e.pendingSamples.length) {
|
|
9461
9538
|
e.pendingSamples = [], e.pendingSamplesOffset = 0;
|
|
9462
9539
|
return;
|
|
9463
9540
|
}
|
|
9464
|
-
t <
|
|
9541
|
+
t < G_ || t * 2 < e.pendingSamples.length || (e.pendingSamples = e.pendingSamples.slice(t), e.pendingSamplesOffset = 0);
|
|
9465
9542
|
}
|
|
9466
|
-
},
|
|
9543
|
+
}, q_ = function() {
|
|
9467
9544
|
var e = t(function* (e, t, n) {
|
|
9468
9545
|
for (e.isWorkingOnPendingSamples = !0; e.pendingSamplesOffset < e.pendingSamples.length;) {
|
|
9469
9546
|
let r = [], i = e.pendingSamplesOffset;
|
|
@@ -9471,7 +9548,7 @@ var V_ = (e, t) => {
|
|
|
9471
9548
|
i = t;
|
|
9472
9549
|
let a = e.pendingSamples[t], o = e.pendingSamples[t + 1];
|
|
9473
9550
|
if (a && (r.push(a), o)) {
|
|
9474
|
-
if (
|
|
9551
|
+
if (W_(a, o)) break;
|
|
9475
9552
|
let e = (a.timestamp + a.duration) / a.timescale;
|
|
9476
9553
|
if (o.timestamp / o.timescale - e > .1) break;
|
|
9477
9554
|
}
|
|
@@ -9479,14 +9556,14 @@ var V_ = (e, t) => {
|
|
|
9479
9556
|
}
|
|
9480
9557
|
let a = r[0];
|
|
9481
9558
|
if (!a) break;
|
|
9482
|
-
yield t(r, e.previousSample ?
|
|
9559
|
+
yield t(r, e.previousSample ? W_(e.previousSample, a) : !0), e.pendingSamplesOffset = i + 1, e.previousSample = r[r.length - 1], K_(e);
|
|
9483
9560
|
}
|
|
9484
9561
|
e.isWorkingOnPendingSamples = !1;
|
|
9485
9562
|
});
|
|
9486
9563
|
return function(t, n, r) {
|
|
9487
9564
|
return e.apply(this, arguments);
|
|
9488
9565
|
};
|
|
9489
|
-
}(),
|
|
9566
|
+
}(), J_, Y_ = class {
|
|
9490
9567
|
constructor(n, r) {
|
|
9491
9568
|
var i = this;
|
|
9492
9569
|
e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "element", void 0), e(this, "pictureInPictureWindow", void 0), e(this, "unload", () => {
|
|
@@ -9518,10 +9595,10 @@ var V_ = (e, t) => {
|
|
|
9518
9595
|
}()), e(this, "isWebkitPresentationModeSupported", () => !!this.element && xt(this.element)), this.emitter = n, this.logger = r, this.emitter.on("add picture in picture listener", this.onEnablePictureInPicture);
|
|
9519
9596
|
}
|
|
9520
9597
|
};
|
|
9521
|
-
|
|
9598
|
+
J_ = Y_, e(Y_, "create", (e, t) => new J_(e, t));
|
|
9522
9599
|
//#endregion
|
|
9523
9600
|
//#region ../../libs/web-sdk/src/modules/PlaybackModule.ts
|
|
9524
|
-
var
|
|
9601
|
+
var X_, Z_ = class {
|
|
9525
9602
|
constructor(t, n, r, i) {
|
|
9526
9603
|
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", () => {
|
|
9527
9604
|
this.emitter.off("buffer state", this.onBufferedStateChanged), this.emitter.off("needs user input", this.onNeedsUserInput);
|
|
@@ -9539,24 +9616,24 @@ var q_, J_ = class {
|
|
|
9539
9616
|
}), 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);
|
|
9540
9617
|
}
|
|
9541
9618
|
};
|
|
9542
|
-
|
|
9619
|
+
X_ = Z_, e(Z_, "create", (e, t, n, r) => new X_(e, t, n, r));
|
|
9543
9620
|
//#endregion
|
|
9544
9621
|
//#region ../../libs/web-sdk/src/modules/QualityOfServiceModule.ts
|
|
9545
|
-
var
|
|
9622
|
+
var Q_, $_ = () => ({
|
|
9546
9623
|
upgradesFromLevel: [],
|
|
9547
9624
|
downgradesFromLevel: [],
|
|
9548
9625
|
bufferingRanges: [],
|
|
9549
9626
|
activeRanges: [],
|
|
9550
9627
|
decodeRate: 2 ** 53 - 1
|
|
9551
|
-
}),
|
|
9628
|
+
}), ev = () => ({
|
|
9552
9629
|
levels: {},
|
|
9553
9630
|
levelDowngrades: [],
|
|
9554
9631
|
levelUpgrades: [],
|
|
9555
9632
|
bufferFullness: 0,
|
|
9556
|
-
general:
|
|
9557
|
-
}),
|
|
9633
|
+
general: $_()
|
|
9634
|
+
}), tv = class {
|
|
9558
9635
|
constructor(t, n, r) {
|
|
9559
|
-
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics",
|
|
9636
|
+
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics", ev()), e(this, "bufferFullness", new _(30)), e(this, "bufferFullnessRegression", void 0), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "targetBufferTime", 0), e(this, "renditionLevelSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasAsserted", !1), e(this, "load", () => {
|
|
9560
9637
|
this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("buffer fullness", this.onBufferFullness), this.emitter.on("rendition level changed", this.onRenditionLevelChanged), this.emitter.on("video decode rate", this.onVideoDecodeRate), this.emitter.on("target buffer time", this.onTargetBufferTime);
|
|
9561
9638
|
}), e(this, "unload", () => {
|
|
9562
9639
|
this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("target buffer time", this.onTargetBufferTime), this.suspend();
|
|
@@ -9624,14 +9701,14 @@ var Y_, X_ = () => ({
|
|
|
9624
9701
|
let d = !1;
|
|
9625
9702
|
if (e.from) {
|
|
9626
9703
|
var f;
|
|
9627
|
-
let e = (f = this.metrics.levels[l]) == null ?
|
|
9704
|
+
let e = (f = this.metrics.levels[l]) == null ? $_() : f;
|
|
9628
9705
|
l < u ? e.upgradesFromLevel.push(Date.now()) : e.downgradesFromLevel.push(Date.now()), on(e.activeRanges);
|
|
9629
9706
|
let t = e.bufferingRanges[e.bufferingRanges.length - 1];
|
|
9630
9707
|
d = !!t && !t.end, on(e.bufferingRanges), this.metrics.levels[l] = e;
|
|
9631
9708
|
}
|
|
9632
9709
|
if (e.to) {
|
|
9633
9710
|
var p;
|
|
9634
|
-
let e = (p = this.metrics.levels[u]) == null ?
|
|
9711
|
+
let e = (p = this.metrics.levels[u]) == null ? $_() : p;
|
|
9635
9712
|
sn(e.activeRanges), d && sn(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
|
|
9636
9713
|
}
|
|
9637
9714
|
}), e(this, "onBufferFullness", (e) => {
|
|
@@ -9700,10 +9777,10 @@ var Y_, X_ = () => ({
|
|
|
9700
9777
|
sn(this.metrics.general.activeRanges);
|
|
9701
9778
|
}
|
|
9702
9779
|
};
|
|
9703
|
-
|
|
9780
|
+
Q_ = tv, e(tv, "create", (e, t, n) => new Q_(e, t, n));
|
|
9704
9781
|
//#endregion
|
|
9705
9782
|
//#region ../../libs/web-sdk/src/modules/RenditionsModule.ts
|
|
9706
|
-
var
|
|
9783
|
+
var nv, rv = class {
|
|
9707
9784
|
constructor(t, n) {
|
|
9708
9785
|
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", () => {
|
|
9709
9786
|
this.emitter.off("renditions", this.onRenditions), this.emitter.off("subscription changed", this.onSubscriptionChanged);
|
|
@@ -9778,10 +9855,10 @@ var $_, ev = class {
|
|
|
9778
9855
|
}), 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);
|
|
9779
9856
|
}
|
|
9780
9857
|
};
|
|
9781
|
-
|
|
9858
|
+
nv = rv, e(rv, "create", (e, t) => new nv(e, t));
|
|
9782
9859
|
//#endregion
|
|
9783
9860
|
//#region ../../libs/web-sdk/src/modules/SubscriptionModule.ts
|
|
9784
|
-
var
|
|
9861
|
+
var iv, av = (e) => JSON.parse(JSON.stringify(e)), ov = 1e4, sv = class {
|
|
9785
9862
|
constructor(t, n, r) {
|
|
9786
9863
|
e(this, "logger", void 0), e(this, "timers", new j()), 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", () => {
|
|
9787
9864
|
this.logger.debug("Unloading module..."), this.timers.unload(), this.emitter.off("subscription changed", this.onSubscriptionChanged), this.logger.debug("Unloaded module");
|
|
@@ -9819,23 +9896,23 @@ var tv, nv = (e) => JSON.parse(JSON.stringify(e)), rv = 1e4, iv = class {
|
|
|
9819
9896
|
this.logger.debug("onSubscriptionChanged", {
|
|
9820
9897
|
to: e,
|
|
9821
9898
|
reset: t
|
|
9822
|
-
}), t ? this.targetSubscription =
|
|
9899
|
+
}), t ? this.targetSubscription = av(this.currentSubscription) : this.currentSubscription = av(e), this._isSwitchingSubscription = this.isNewSubscription();
|
|
9823
9900
|
}), e(this, "scheduleSubscriptionChange", () => {
|
|
9824
|
-
this.targetSubscription =
|
|
9901
|
+
this.targetSubscription = av(this.targetSubscription), this._isSwitchingSubscription = this.isNewSubscription();
|
|
9825
9902
|
let e = this.currentSubscription.channelId, t = this.targetSubscription.channelId, n = e !== t;
|
|
9826
9903
|
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(() => {
|
|
9827
|
-
this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription =
|
|
9828
|
-
},
|
|
9904
|
+
this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = av(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
|
|
9905
|
+
}, ov), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(() => this.emitter.emit("send signal", {
|
|
9829
9906
|
type: "subscribe",
|
|
9830
9907
|
subscription: this.getTargetSubscription()
|
|
9831
9908
|
}), 0));
|
|
9832
|
-
}), this.logger = t, this.targetSubscription = n, this.currentSubscription =
|
|
9909
|
+
}), this.logger = t, this.targetSubscription = n, this.currentSubscription = av(n), this.emitter = r, this.emitter.on("subscription changed", this.onSubscriptionChanged);
|
|
9833
9910
|
}
|
|
9834
9911
|
};
|
|
9835
|
-
|
|
9912
|
+
iv = sv, e(sv, "create", (e, t, n) => new iv(e, n, t));
|
|
9836
9913
|
//#endregion
|
|
9837
9914
|
//#region ../../libs/web-sdk/src/modules/SyncModule.ts
|
|
9838
|
-
var
|
|
9915
|
+
var cv, lv = 5e3, uv = () => Ye() || Ke(), dv = (e) => e && uv() ? 100 : 0, fv = (e) => (t) => t > e, pv = {
|
|
9839
9916
|
seek: {
|
|
9840
9917
|
toleranceMs: 200,
|
|
9841
9918
|
toleranceMaxMs: 2500,
|
|
@@ -9867,7 +9944,7 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
9867
9944
|
decayCooldownMultiplier: 3,
|
|
9868
9945
|
decayCheckInterval: 15e3
|
|
9869
9946
|
}
|
|
9870
|
-
},
|
|
9947
|
+
}, mv = class {
|
|
9871
9948
|
get driftSamplesToAverage() {
|
|
9872
9949
|
return this._driftSamplesToAverage;
|
|
9873
9950
|
}
|
|
@@ -9875,10 +9952,10 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
9875
9952
|
this._driftSamplesToAverage = e, this.driftSamples = new _(e);
|
|
9876
9953
|
}
|
|
9877
9954
|
constructor(t, n, r, i, a, o = !0) {
|
|
9878
|
-
e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new _(10)), e(this, "lastSeekTime", Date.now()), e(this, "lastAdjustmentTime", Date.now()), e(this, "lastDecayCheckTime", Date.now()), 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", j.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, "_driftSamplesToAverage", 5), e(this, "driftSamples", new _(this._driftSamplesToAverage)), e(this, "timestampOffset", void 0), 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, "load", () => {
|
|
9955
|
+
e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "playbackSource", void 0), e(this, "bufferSource", void 0), e(this, "keyframeTimestamps", new _(10)), e(this, "lastSeekTime", Date.now()), e(this, "lastAdjustmentTime", Date.now()), e(this, "lastDecayCheckTime", Date.now()), 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", j.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, "_driftSamplesToAverage", 5), e(this, "driftSamples", new _(this._driftSamplesToAverage)), e(this, "timestampOffset", void 0), 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, "usesMse", void 0), e(this, "load", () => {
|
|
9879
9956
|
this.timers.setInterval(this.onSync, 100);
|
|
9880
9957
|
}), e(this, "unload", () => {
|
|
9881
|
-
this.logger.debug("Unloading module..."), this.emitter.off("rtt", this.updateRtt), this.timers.unload(), this.logger.debug("Unloaded module");
|
|
9958
|
+
this.logger.debug("Unloading module..."), this.emitter.off("rtt", this.updateRtt), this.emitter.off("playback state", this.onPlaybackState), this.timers.unload(), this.logger.debug("Unloaded module");
|
|
9882
9959
|
}), e(this, "suspend", () => {
|
|
9883
9960
|
this.isSuspended = !0;
|
|
9884
9961
|
}), e(this, "unsuspend", () => {
|
|
@@ -9893,7 +9970,7 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
9893
9970
|
var e;
|
|
9894
9971
|
return (e = this.timestampOffset) == null ? 0 : e;
|
|
9895
9972
|
}), e(this, "getCurrentChannelId", () => this.currentChannelId), e(this, "resetSyncState", () => {
|
|
9896
|
-
this.state.seekToleranceMultiplier = 1, this.state.timeshiftToleranceMultiplier = 1, this.seekAdjustmentTimestamps = [], this.timeshiftAdjustmentTimestamps = [], this.driftSamples.clear();
|
|
9973
|
+
this.state.seekToleranceMultiplier = 1, this.state.timeshiftToleranceMultiplier = 1, this.seekAdjustmentTimestamps = [], this.timeshiftAdjustmentTimestamps = [], this.driftSamples.clear(), this.playbackState = void 0, this.hasPerformedRecoverySeekInCurrentRecoveryState = !1, this.clearRecoverySeekFlags();
|
|
9897
9974
|
}), e(this, "getEffectiveSeekToleranceMs", () => this.config.timeshift.enabled ? this.config.seek.toleranceMs * 2 : this.config.seek.toleranceMs), e(this, "getLiveEdgeTime", (e) => {
|
|
9898
9975
|
let t = this.channelSyncInfo.get(e);
|
|
9899
9976
|
if (!t) return;
|
|
@@ -9913,7 +9990,7 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
9913
9990
|
}), e(this, "processSample", (e) => {
|
|
9914
9991
|
var t;
|
|
9915
9992
|
if (!e.channelId) throw Error("Sample must be assigned to a channel");
|
|
9916
|
-
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 -
|
|
9993
|
+
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - lv);
|
|
9917
9994
|
let n = e.type === "video" && e.isSync;
|
|
9918
9995
|
if (this.currentChannelId !== e.channelId) {
|
|
9919
9996
|
let t = 2 ** 53 - 1;
|
|
@@ -9930,7 +10007,7 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
9930
10007
|
this.currentChannelId || (this.currentChannelId = e);
|
|
9931
10008
|
let r = t.mediaType();
|
|
9932
10009
|
if (!r) throw Error("Fragment must have a media type");
|
|
9933
|
-
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 -
|
|
10010
|
+
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - lv);
|
|
9934
10011
|
let i = t.mediaType() === "video" && t.startsWithKeyframe();
|
|
9935
10012
|
if (this.currentChannelId !== e) {
|
|
9936
10013
|
let t = 2 ** 53 - 1;
|
|
@@ -9941,7 +10018,7 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
9941
10018
|
let a = this.timestampOffset * t.timescale() / 1e3;
|
|
9942
10019
|
return t.updateBaseMediaDecodeTime(t.baseMediaDecodeTime() - a), i && this.keyframeTimestamps.push(t.baseMediaDecodeTime() / t.timescale() * 1e3), this.highestSeenTimestamps.set(r, Math.max((n = this.highestSeenTimestamps.get(r)) == null ? 0 : n, t.baseMediaDecodeTime() / t.timescale() * 1e3)), t;
|
|
9943
10020
|
}), e(this, "forceSeek", () => {
|
|
9944
|
-
this.logger.debug("Forcing seek", { amount: this.serverCurrentTime - this.playbackSource.currentTime }), this.playbackSource.currentTime = this.serverCurrentTime;
|
|
10021
|
+
this.logger.debug("Forcing seek", { amount: this.serverCurrentTime - this.playbackSource.currentTime }), this.clearRecoverySeekFlags(), this.playbackSource.currentTime = this.serverCurrentTime;
|
|
9945
10022
|
}), e(this, "forceTimeshift", () => {
|
|
9946
10023
|
this.queuedTimeshift = !0;
|
|
9947
10024
|
}), e(this, "setPlaybackRateAdjustmentEnabled", (e) => {
|
|
@@ -9964,7 +10041,7 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
9964
10041
|
};
|
|
9965
10042
|
}), e(this, "updateRtt", (e) => {
|
|
9966
10043
|
this.rtt = e;
|
|
9967
|
-
}), e(this, "isPlaybackSourceReadyToSeek", () => !this.isSeeking() && this.isSeekCooldownExpired() && this.isSyncAdjustmentActivated), e(this, "isSeeking", () => this.playbackSource.isSeeking ? !this.isSeekTimeoutExpired() : !1), e(this, "isAllowedToSync", () => this.isPlaybackSourceReadyToSeek() && !!this.currentChannelId && !this.isSuspended && !this.playbackSource.isPaused), e(this, "isSeekCooldownExpired", () => Date.now() - this.lastSeekTime > this.config.seek.cooldownMs), e(this, "isSeekTimeoutExpired", () => Date.now() - this.lastSeekTime > this.config.seek.timeoutMs), e(this, "currentTimeshiftToleranceMs", () => Math.min(this.config.timeshift.toleranceMs * this.state.timeshiftToleranceMultiplier, this.config.timeshift.toleranceMaxMs)), e(this, "currentSeekToleranceMs", () => Math.min(this.state.seekToleranceMultiplier * this.getEffectiveSeekToleranceMs(), this.config.seek.toleranceMaxMs)), e(this, "currentAheadToleranceMs", () => {
|
|
10044
|
+
}), e(this, "isPlaybackSourceReadyToSeek", () => !this.isSeeking() && this.isSeekCooldownExpired() && this.isSyncAdjustmentActivated), e(this, "isPlaybackSourceReady", () => !this.isSeeking() && this.isSyncAdjustmentActivated), e(this, "isSeeking", () => this.playbackSource.isSeeking ? !this.isSeekTimeoutExpired() : !1), e(this, "isAllowedToSync", () => this.isPlaybackSourceReadyToSeek() && !!this.currentChannelId && !this.isSuspended && !this.playbackSource.isPaused), e(this, "isAllowedToSyncIgnoringCooldown", () => this.isPlaybackSourceReady() && !!this.currentChannelId && !this.isSuspended && !this.playbackSource.isPaused), e(this, "isSeekCooldownExpired", () => Date.now() - this.lastSeekTime > this.config.seek.cooldownMs), e(this, "isSeekTimeoutExpired", () => Date.now() - this.lastSeekTime > this.config.seek.timeoutMs), e(this, "currentTimeshiftToleranceMs", () => Math.min(this.config.timeshift.toleranceMs * this.state.timeshiftToleranceMultiplier, this.config.timeshift.toleranceMaxMs)), e(this, "currentSeekToleranceMs", () => Math.min(this.state.seekToleranceMultiplier * this.getEffectiveSeekToleranceMs(), this.config.seek.toleranceMaxMs)), e(this, "currentEmergencySeekToleranceMs", () => Math.max(this.currentSeekToleranceMs() + this.getEffectiveSeekToleranceMs(), this.bufferSource.getTargetBufferTime())), e(this, "currentAheadToleranceMs", () => {
|
|
9968
10045
|
let e = Math.max(this.config.seek.aheadToleranceMs * this.state.seekToleranceMultiplier, 400), t = this.playbackSource.seekTime > 500 ? e : this.config.seek.aheadToleranceMs;
|
|
9969
10046
|
return Math.min(t, this.bufferSource.getTargetBufferTime() / 2);
|
|
9970
10047
|
}), e(this, "tryDecayMultipliers", () => {
|
|
@@ -10029,7 +10106,7 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
10029
10106
|
return !t && n < this.config.playbackRate.startDiff ? !0 : t;
|
|
10030
10107
|
}), e(this, "tryTimeshiftSync", () => {
|
|
10031
10108
|
var e;
|
|
10032
|
-
if (!this.config.timeshift.enabled || !this.isAllowedToSync() || this.playbackSource.playbackRate !== 1) return;
|
|
10109
|
+
if (!this.config.timeshift.enabled || this.hasPendingRecoverySeek() || !this.isAllowedToSync() || this.playbackSource.playbackRate !== 1) return;
|
|
10033
10110
|
let t = (e = this.drift) == null ? 0 : e;
|
|
10034
10111
|
this.driftSamples.push(t);
|
|
10035
10112
|
let n = Ot(this.driftSamples.items());
|
|
@@ -10038,27 +10115,60 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
10038
10115
|
return;
|
|
10039
10116
|
}
|
|
10040
10117
|
if (n >= this.getEffectiveSeekToleranceMs() || n < this.currentTimeshiftToleranceMs()) return;
|
|
10041
|
-
let r = Date.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, i = this.timeshiftAdjustmentTimestamps.filter(
|
|
10118
|
+
let r = Date.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, i = this.timeshiftAdjustmentTimestamps.filter(fv(r)).length;
|
|
10042
10119
|
if (i && this.state.timeshiftToleranceMultiplier > 2) {
|
|
10043
|
-
this.logger.
|
|
10120
|
+
this.logger.debug("Too many timeshifts within sliding window", {
|
|
10044
10121
|
timeshiftCooldownThreshold: r,
|
|
10045
10122
|
recentTimeshiftCount: i
|
|
10046
10123
|
});
|
|
10047
10124
|
return;
|
|
10048
10125
|
}
|
|
10049
10126
|
this.applyTimeshift(n);
|
|
10050
|
-
}), e(this, "
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
this.
|
|
10127
|
+
}), e(this, "clearRecoverySeekFlags", () => {
|
|
10128
|
+
this.shouldSeekAfterBuffering = !1;
|
|
10129
|
+
}), e(this, "hasActiveRecoveryTrigger", () => this.playbackState === "buffering"), e(this, "hasPendingRecoverySeek", () => (this.refreshRecoverySeekState(), this.getRecoverySeekReason() !== void 0)), e(this, "refreshRecoverySeekState", () => {
|
|
10130
|
+
var e, t;
|
|
10131
|
+
if (!this.hasActiveRecoveryTrigger() || !this.usesMse || this.hasPerformedRecoverySeekInCurrentRecoveryState) {
|
|
10132
|
+
this.clearRecoverySeekFlags();
|
|
10133
|
+
return;
|
|
10134
|
+
}
|
|
10135
|
+
let n = (e = (t = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : e.call(t, this.playbackSource.currentTime);
|
|
10136
|
+
return this.shouldSeekAfterBuffering = n !== void 0, n;
|
|
10137
|
+
}), e(this, "getRecoverySeekReason", () => {
|
|
10138
|
+
if (this.shouldSeekAfterBuffering) return "buffering";
|
|
10139
|
+
}), 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, "buildSeekPlan", (e, t) => {
|
|
10140
|
+
var n, r;
|
|
10141
|
+
let i = this.playbackSource.currentTime + e, a = t ? (n = (r = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : n.call(r, this.playbackSource.currentTime) : void 0, o = i + this.seekOvershoot, s = this.playbackSource.currentTime + this.seekOvershoot, c = t ? Math.max(o, s) : o;
|
|
10142
|
+
if (t && this.shouldDeferRecoverySeek(c, a)) {
|
|
10143
|
+
this.logger.debug("Deferring recovery seek until expected playhead reaches next buffered range start", {
|
|
10144
|
+
currentTime: this.playbackSource.currentTime,
|
|
10145
|
+
desiredCurrentTime: c,
|
|
10146
|
+
nextBufferedRangeStart: a,
|
|
10147
|
+
recoverySeekReason: t
|
|
10148
|
+
});
|
|
10149
|
+
return;
|
|
10150
|
+
}
|
|
10151
|
+
let l = t && a ? a : i, u = this.findKeyframeCloseToTimestamp(l);
|
|
10152
|
+
if (!(!t && !u && !this.keyframeTimestamps.isEmpty())) return {
|
|
10153
|
+
closestKeyFrame: u,
|
|
10154
|
+
keyframeSearchTime: l,
|
|
10155
|
+
nextBufferedRangeStart: a,
|
|
10156
|
+
targetCurrentTime: u && u > c ? a ? Math.max(a, u) : u : c
|
|
10157
|
+
};
|
|
10158
|
+
}), e(this, "applySeek", (e, t) => {
|
|
10159
|
+
let n = this.playbackSource.seekTime, r = this.buildSeekPlan(e, t);
|
|
10160
|
+
r && (this.logger.info("Adjusting for drift using seek", {
|
|
10055
10161
|
drift: e,
|
|
10056
10162
|
currentTime: this.playbackSource.currentTime,
|
|
10057
|
-
|
|
10058
|
-
|
|
10163
|
+
recoverySeekReason: t,
|
|
10164
|
+
keyframeSearchTime: r.keyframeSearchTime,
|
|
10165
|
+
closestKeyFrame: r.closestKeyFrame,
|
|
10166
|
+
nextBufferedRangeStart: r.nextBufferedRangeStart,
|
|
10167
|
+
targetCurrentTime: r.targetCurrentTime,
|
|
10168
|
+
seekTime: n,
|
|
10059
10169
|
rtt: this.rtt,
|
|
10060
10170
|
seekToleranceMultiplier: this.state.seekToleranceMultiplier
|
|
10061
|
-
}), this.lastSeekTime = Date.now(), this.driftSamples.clear(), this.seekAdjustmentTimestamps.push(this.lastSeekTime), this.seekAdjustmentCount++, this.playbackSource.currentTime =
|
|
10171
|
+
}), this.lastSeekTime = Date.now(), t && (this.hasPerformedRecoverySeekInCurrentRecoveryState = !0), this.clearRecoverySeekFlags(), this.driftSamples.clear(), this.seekAdjustmentTimestamps.push(this.lastSeekTime), this.seekAdjustmentCount++, this.playbackSource.currentTime = r.targetCurrentTime + Math.min(n, this.bufferSource.getTargetBufferTime()), this.applyBackoff());
|
|
10062
10172
|
}), e(this, "applyTimeshift", (e) => {
|
|
10063
10173
|
var t;
|
|
10064
10174
|
let n = (t = e == null ? this.drift : e) == null ? 0 : t;
|
|
@@ -10080,35 +10190,51 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
10080
10190
|
}
|
|
10081
10191
|
}), e(this, "onSync", () => {
|
|
10082
10192
|
var e;
|
|
10083
|
-
|
|
10084
|
-
let t = (e = this.drift) == null ? 0 : e;
|
|
10085
|
-
if (this.driftSamples.push(t), this.driftSamples.items().length < this.driftSamplesToAverage && Math.abs(t) < 2e3) return;
|
|
10086
|
-
let
|
|
10087
|
-
if (
|
|
10088
|
-
let
|
|
10089
|
-
if (
|
|
10090
|
-
this.logger.
|
|
10091
|
-
seekCooldownThreshold:
|
|
10092
|
-
recentSeekCount:
|
|
10193
|
+
this.tryDecayMultipliers(), this.refreshRecoverySeekState();
|
|
10194
|
+
let t = (e = this.drift) == null ? 0 : e, n = this.getRecoverySeekReason(), r = n !== void 0;
|
|
10195
|
+
if (!r && !this.isAllowedToSyncIgnoringCooldown() || r && (this.isSeeking() || !this.currentChannelId || this.isSuspended || this.playbackSource.isPaused) || (this.driftSamples.push(t), !this.isSeekCooldownExpired()) || !r && this.driftSamples.items().length < this.driftSamplesToAverage && Math.abs(t) < 2e3) return;
|
|
10196
|
+
let i = r ? t : Ot(this.driftSamples.items());
|
|
10197
|
+
if (!r && this.tryPlaybackRateSync(i) || !r && this.shouldSkipNormalSeek(i)) return;
|
|
10198
|
+
let a = Date.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(fv(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
|
|
10199
|
+
if (o && this.state.seekToleranceMultiplier > 2 && !r && !c) {
|
|
10200
|
+
this.logger.debug("Too many seek adjustments within sliding window", {
|
|
10201
|
+
seekCooldownThreshold: a,
|
|
10202
|
+
recentSeekCount: o
|
|
10093
10203
|
});
|
|
10094
10204
|
return;
|
|
10095
10205
|
}
|
|
10096
|
-
this.
|
|
10206
|
+
o && (r || c) && this.logger.debug("Bypassing recent seek limit", {
|
|
10207
|
+
drift: i,
|
|
10208
|
+
recoverySeekReason: n,
|
|
10209
|
+
emergencySeekToleranceMs: s,
|
|
10210
|
+
recentSeekCount: o,
|
|
10211
|
+
seekToleranceMultiplier: this.state.seekToleranceMultiplier
|
|
10212
|
+
}), this.applySeek(i, n);
|
|
10213
|
+
}), e(this, "onPlaybackState", (e) => {
|
|
10214
|
+
let t = this.playbackState === "buffering";
|
|
10215
|
+
if (this.playbackState = e, e !== "buffering") {
|
|
10216
|
+
this.hasPerformedRecoverySeekInCurrentRecoveryState = !1, this.clearRecoverySeekFlags();
|
|
10217
|
+
return;
|
|
10218
|
+
}
|
|
10219
|
+
if (t || (this.hasPerformedRecoverySeekInCurrentRecoveryState = !1), this.refreshRecoverySeekState() !== void 0) {
|
|
10220
|
+
this.onSync();
|
|
10221
|
+
return;
|
|
10222
|
+
}
|
|
10097
10223
|
}), e(this, "findKeyframeCloseToTimestamp", (e) => {
|
|
10098
10224
|
let t = this.keyframeTimestamps.items();
|
|
10099
10225
|
for (let n of t) {
|
|
10100
10226
|
let t = n >= e - this.config.seek.keyframeSearchBeforeMs, r = n <= e + this.config.seek.keyframeSearchAfterMs;
|
|
10101
10227
|
if (t && r) return n;
|
|
10102
10228
|
}
|
|
10103
|
-
}), this.logger = n, this.emitter = t, this.playbackSource = r, this.bufferSource = i, this.seekOvershoot =
|
|
10104
|
-
seek: C({},
|
|
10105
|
-
timeshift: C({},
|
|
10106
|
-
playbackRate: C({},
|
|
10107
|
-
backoff: C({},
|
|
10229
|
+
}), this.logger = n, this.emitter = t, this.playbackSource = r, this.bufferSource = i, this.usesMse = o, this.seekOvershoot = dv(o), this.config = {
|
|
10230
|
+
seek: C({}, pv.seek),
|
|
10231
|
+
timeshift: C({}, pv.timeshift),
|
|
10232
|
+
playbackRate: C({}, pv.playbackRate),
|
|
10233
|
+
backoff: C({}, pv.backoff)
|
|
10108
10234
|
}, this.config.timeshift.enabled = a, o || (this.config.seek.toleranceMs = 50, this.config.timeshift.toleranceMs = 20, this.config.seek.aheadToleranceMs = 40), this.state = {
|
|
10109
10235
|
seekToleranceMultiplier: 1,
|
|
10110
10236
|
timeshiftToleranceMultiplier: 1
|
|
10111
|
-
}, typeof window < "u" && window.location.search.includes("playbackRateAdjustmentEnabled") && (this.config.playbackRate.enabled = !0), this.emitter.on("rtt", this.updateRtt), this.logger.info("SyncModule initialized", { config: this.config });
|
|
10237
|
+
}, typeof window < "u" && window.location.search.includes("playbackRateAdjustmentEnabled") && (this.config.playbackRate.enabled = !0), this.emitter.on("rtt", this.updateRtt), this.emitter.on("playback state", this.onPlaybackState), this.logger.info("SyncModule initialized", { config: this.config });
|
|
10112
10238
|
}
|
|
10113
10239
|
updateChannelSyncInfo(e, t) {
|
|
10114
10240
|
let n = Date.now(), r = this.channelSyncInfo.get(e), i = this.getLiveEdgeTime(e);
|
|
@@ -10160,10 +10286,10 @@ var av, ov = 5e3, sv = () => Ye() || Ke(), cv = (e) => e && sv() ? 100 : 0, lv =
|
|
|
10160
10286
|
return this.serverCurrentTime - this.playbackSource.currentTime;
|
|
10161
10287
|
}
|
|
10162
10288
|
};
|
|
10163
|
-
|
|
10289
|
+
cv = mv, e(mv, "create", (e, t, n, r, i, a = !0) => new cv(e, t, n, r, i, a));
|
|
10164
10290
|
//#endregion
|
|
10165
10291
|
//#region ../../libs/web-sdk/src/modules/TelemetryModule.ts
|
|
10166
|
-
var
|
|
10292
|
+
var hv, gv = {
|
|
10167
10293
|
enabled: !0,
|
|
10168
10294
|
interval: 3e4,
|
|
10169
10295
|
includeErrors: !0,
|
|
@@ -10172,11 +10298,11 @@ var fv, pv = {
|
|
|
10172
10298
|
maxRetries: 10,
|
|
10173
10299
|
maxErrorReports: 50,
|
|
10174
10300
|
maxEvents: 50
|
|
10175
|
-
},
|
|
10301
|
+
}, _v = (e, t) => C(C({}, t), {}, {
|
|
10176
10302
|
type: e,
|
|
10177
10303
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10178
10304
|
discriminator: "web"
|
|
10179
|
-
}),
|
|
10305
|
+
}), vv = class {
|
|
10180
10306
|
constructor(n, r, i, a) {
|
|
10181
10307
|
var o = this;
|
|
10182
10308
|
e(this, "logger", void 0), e(this, "timers", new j()), e(this, "emitter", void 0), e(this, "options", void 0), e(this, "parentContext", void 0), e(this, "unsentLines", new _(100)), e(this, "retries", 0), e(this, "errorCount", 0), e(this, "eventCount", 0), e(this, "statsCount", 0), e(this, "unload", () => {
|
|
@@ -10193,7 +10319,7 @@ var fv, pv = {
|
|
|
10193
10319
|
initiator: "interval"
|
|
10194
10320
|
}, n = {}) => {
|
|
10195
10321
|
if (!this.options.includeStats) return;
|
|
10196
|
-
let r = this.parentContext.getStatistics(), i =
|
|
10322
|
+
let r = this.parentContext.getStatistics(), i = _v("stats", C(C(C({}, n), r), {}, {
|
|
10197
10323
|
isFinal: e,
|
|
10198
10324
|
initiator: t,
|
|
10199
10325
|
count: this.statsCount++
|
|
@@ -10201,7 +10327,7 @@ var fv, pv = {
|
|
|
10201
10327
|
this.unsentLines.push(i);
|
|
10202
10328
|
}), e(this, "addEvent", (e) => {
|
|
10203
10329
|
if (!this.options.includeEvents || this.eventCount > this.options.maxEvents) return;
|
|
10204
|
-
let t =
|
|
10330
|
+
let t = _v("event", C(C({}, this.parentContext.getStatistics()), e));
|
|
10205
10331
|
this.eventCount++, this.unsentLines.push(t);
|
|
10206
10332
|
}), e(this, "getStatistics", () => ({ errorCount: this.errorCount })), e(this, "send", function() {
|
|
10207
10333
|
var e = t(function* (e) {
|
|
@@ -10247,15 +10373,15 @@ var fv, pv = {
|
|
|
10247
10373
|
if (t && e instanceof g) {
|
|
10248
10374
|
if (this.errorCount++, this.errorCount > n) return;
|
|
10249
10375
|
let t = this.parentContext.getStatistics();
|
|
10250
|
-
this.unsentLines.push(
|
|
10376
|
+
this.unsentLines.push(_v("error", C(C({}, t), e.toStringifiable())));
|
|
10251
10377
|
}
|
|
10252
|
-
}), this.logger = n, this.emitter = r, this.options = C(C({},
|
|
10378
|
+
}), this.logger = n, this.emitter = r, this.options = C(C({}, gv), i), this.parentContext = a;
|
|
10253
10379
|
}
|
|
10254
10380
|
};
|
|
10255
|
-
|
|
10381
|
+
hv = vv, e(vv, "create", (e, t, n, r) => new hv(e, t, n, r));
|
|
10256
10382
|
//#endregion
|
|
10257
10383
|
//#region ../../libs/web-sdk/src/modules/UnpauseModule.ts
|
|
10258
|
-
var
|
|
10384
|
+
var yv, bv = class {
|
|
10259
10385
|
constructor(t, n, r) {
|
|
10260
10386
|
e(this, "logger", void 0), e(this, "element", void 0), e(this, "documentState", void 0), e(this, "timers", new j()), e(this, "unload", () => {
|
|
10261
10387
|
this.timers.unload();
|
|
@@ -10264,10 +10390,10 @@ var gv, _v = class {
|
|
|
10264
10390
|
}), this.logger = t, this.element = n, this.documentState = r, this.timers.setInterval(this.unpause, 100);
|
|
10265
10391
|
}
|
|
10266
10392
|
};
|
|
10267
|
-
|
|
10393
|
+
yv = bv, e(bv, "create", (e, t, n) => new yv(e, t, n));
|
|
10268
10394
|
//#endregion
|
|
10269
10395
|
//#region ../../libs/web-sdk/src/OptionsProvider.ts
|
|
10270
|
-
var
|
|
10396
|
+
var xv = [
|
|
10271
10397
|
"minBufferTime",
|
|
10272
10398
|
"maxBufferTime",
|
|
10273
10399
|
"burstEnabled",
|
|
@@ -10277,10 +10403,10 @@ var vv = [
|
|
|
10277
10403
|
"offscreenCanvasEnabled",
|
|
10278
10404
|
"videoCodecs"
|
|
10279
10405
|
];
|
|
10280
|
-
function
|
|
10281
|
-
return
|
|
10406
|
+
function Sv(e) {
|
|
10407
|
+
return xv.includes(e);
|
|
10282
10408
|
}
|
|
10283
|
-
var
|
|
10409
|
+
var Cv = class {
|
|
10284
10410
|
constructor(t) {
|
|
10285
10411
|
e(this, "options", void 0), e(this, "overrides", /* @__PURE__ */ new Map()), this.options = t;
|
|
10286
10412
|
}
|
|
@@ -10294,7 +10420,7 @@ var bv = class {
|
|
|
10294
10420
|
this.options[e] = t;
|
|
10295
10421
|
}
|
|
10296
10422
|
get(e, t) {
|
|
10297
|
-
if (t &&
|
|
10423
|
+
if (t && Sv(e)) {
|
|
10298
10424
|
var n;
|
|
10299
10425
|
let r = (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
10300
10426
|
if (r !== void 0) return r;
|
|
@@ -10305,7 +10431,7 @@ var bv = class {
|
|
|
10305
10431
|
var n;
|
|
10306
10432
|
return (n = this.overrides.get(t)) == null ? void 0 : n[e];
|
|
10307
10433
|
}
|
|
10308
|
-
},
|
|
10434
|
+
}, wv = 6, Tv = (e) => {
|
|
10309
10435
|
let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
|
|
10310
10436
|
var i, a;
|
|
10311
10437
|
if (e.flags && Wo(e.flags)) {
|
|
@@ -10317,7 +10443,7 @@ var bv = class {
|
|
|
10317
10443
|
return u > 0 && (r = u), C(C({}, e), {}, { duration: u > 0 ? u : r });
|
|
10318
10444
|
};
|
|
10319
10445
|
return (e, n = !1) => {
|
|
10320
|
-
if (e.flags && Wo(e.flags) && n && (i = !i), !(n && t.length <
|
|
10446
|
+
if (e.flags && Wo(e.flags) && n && (i = !i), !(n && t.length < wv && i) && t.length > 0) {
|
|
10321
10447
|
i = !1;
|
|
10322
10448
|
let n = e;
|
|
10323
10449
|
for (let e = t.length - 1; e > 0; e--) {
|
|
@@ -10330,13 +10456,13 @@ var bv = class {
|
|
|
10330
10456
|
}
|
|
10331
10457
|
return t.push(e), [];
|
|
10332
10458
|
};
|
|
10333
|
-
},
|
|
10459
|
+
}, Ev = ["mse", "wasm"], Dv = (e) => e == null ? Ev : e, Ov = (e) => {
|
|
10334
10460
|
if (!e) return !1;
|
|
10335
10461
|
let t = e.headers && Object.keys(e.headers).length > 0, n = e.queryParams && Object.keys(e.queryParams).length > 0;
|
|
10336
10462
|
return !!(t || n);
|
|
10337
|
-
},
|
|
10338
|
-
if (
|
|
10339
|
-
let r =
|
|
10463
|
+
}, kv = (e, t, n) => {
|
|
10464
|
+
if (Ov(n)) return "mse";
|
|
10465
|
+
let r = Dv(e);
|
|
10340
10466
|
for (let e of r) switch (e) {
|
|
10341
10467
|
case "mse":
|
|
10342
10468
|
if (t) return "mse";
|
|
@@ -10347,7 +10473,7 @@ var bv = class {
|
|
|
10347
10473
|
case "wasm": return "wasm";
|
|
10348
10474
|
}
|
|
10349
10475
|
return "wasm";
|
|
10350
|
-
},
|
|
10476
|
+
}, Av = (e, t, n) => {
|
|
10351
10477
|
if (hn(t)) return C(C({}, e), {}, {
|
|
10352
10478
|
type: "video",
|
|
10353
10479
|
codec: t.codec,
|
|
@@ -10368,8 +10494,8 @@ var bv = class {
|
|
|
10368
10494
|
data: e.payload,
|
|
10369
10495
|
duration: 0
|
|
10370
10496
|
});
|
|
10371
|
-
},
|
|
10372
|
-
if (!
|
|
10497
|
+
}, jv = (e, t) => e && typeof e == "object" && t in e, Mv = (e) => !(typeof e != "object" || !jv(e, "channelId") || typeof e.channelId != "string" || !jv(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), Nv = (e) => {
|
|
10498
|
+
if (!Mv(e)) throw new g("Invalid options", {
|
|
10373
10499
|
isFatal: !0,
|
|
10374
10500
|
code: "invalid_options"
|
|
10375
10501
|
});
|
|
@@ -10378,13 +10504,13 @@ var bv = class {
|
|
|
10378
10504
|
let n = t;
|
|
10379
10505
|
n[e] === void 0 && delete n[e];
|
|
10380
10506
|
}), t;
|
|
10381
|
-
},
|
|
10507
|
+
}, Pv = (e) => {
|
|
10382
10508
|
if (typeof e != "object" || !e) throw Error("not an object");
|
|
10383
10509
|
if (!("video" in e)) throw Error("missing video in subscription");
|
|
10384
10510
|
if (!("audio" in e)) throw Error("missing audio in subscription");
|
|
10385
10511
|
if (!("channelId" in e)) throw Error("missing channelId");
|
|
10386
10512
|
return !0;
|
|
10387
|
-
},
|
|
10513
|
+
}, Fv = class {
|
|
10388
10514
|
constructor(n) {
|
|
10389
10515
|
var r = this;
|
|
10390
10516
|
e(this, "cache", /* @__PURE__ */ new Map()), e(this, "inFlight", /* @__PURE__ */ new Map()), e(this, "checkVideoSupport", function() {
|
|
@@ -10445,10 +10571,10 @@ var bv = class {
|
|
|
10445
10571
|
return this.inFlight.set(e, o), o;
|
|
10446
10572
|
}), this.logger = n;
|
|
10447
10573
|
}
|
|
10448
|
-
},
|
|
10574
|
+
}, Iv = /* @__PURE__ */ new WeakMap(), Lv = /* @__PURE__ */ new WeakMap(), Rv = /* @__PURE__ */ new WeakMap(), zv = class n extends _e {
|
|
10449
10575
|
constructor(r) {
|
|
10450
10576
|
var i, a;
|
|
10451
|
-
super(), i = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", rt()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new _e()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", fn()), e(this, "_channels", []), e(this, "createdAt", Date.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new Se(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new dn()), e(this, "encryptedMediaExtensions", void 0), v(this,
|
|
10577
|
+
super(), i = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", rt()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new _e()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", fn()), e(this, "_channels", []), e(this, "createdAt", Date.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new Se(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new dn()), e(this, "encryptedMediaExtensions", void 0), v(this, Iv, 0), v(this, Lv, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "sizes", /* @__PURE__ */ new Map()), e(this, "isSuspended", !0), e(this, "disconnectTimeout", void 0), e(this, "offscreenSubtitleInterval", void 0), v(this, Rv, void 0), e(this, "attach", (e) => {
|
|
10452
10578
|
var t;
|
|
10453
10579
|
(t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
|
|
10454
10580
|
}), e(this, "setElement", (e) => {
|
|
@@ -10531,20 +10657,20 @@ var bv = class {
|
|
|
10531
10657
|
}), e(this, "updateTextTracks", (e) => {
|
|
10532
10658
|
let t = e.filter((e) => e.codec === "webvtt");
|
|
10533
10659
|
t.forEach((e) => {
|
|
10534
|
-
if (!b(
|
|
10660
|
+
if (!b(Lv, this).find((t) => t.language === e.language)) {
|
|
10535
10661
|
if (this.modules.canvasModule) {
|
|
10536
10662
|
let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
|
|
10537
|
-
b(
|
|
10663
|
+
b(Lv, this).push(t);
|
|
10538
10664
|
} else if (this.mediaElement instanceof HTMLVideoElement) {
|
|
10539
10665
|
let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
|
|
10540
|
-
b(
|
|
10666
|
+
b(Lv, this).push(t);
|
|
10541
10667
|
}
|
|
10542
10668
|
}
|
|
10543
10669
|
});
|
|
10544
|
-
for (let e of b(
|
|
10670
|
+
for (let e of b(Lv, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
|
|
10545
10671
|
this.emit("text tracks", this.textTracks);
|
|
10546
10672
|
}), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
|
|
10547
|
-
b(
|
|
10673
|
+
b(Lv, this).forEach((t) => {
|
|
10548
10674
|
if (t.cues) for (let n of t.cues) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
|
|
10549
10675
|
});
|
|
10550
10676
|
}), e(this, "filterRenditions", function() {
|
|
@@ -10736,7 +10862,7 @@ var bv = class {
|
|
|
10736
10862
|
let e = this.modules.canvasModule instanceof O_ ? !0 : void 0;
|
|
10737
10863
|
return C({
|
|
10738
10864
|
uptime: Date.now() - this.createdAt,
|
|
10739
|
-
version: "4.2.0-
|
|
10865
|
+
version: "4.2.0-44-g781abd38",
|
|
10740
10866
|
clientId: this.clientId,
|
|
10741
10867
|
sessionId: this.sessionId,
|
|
10742
10868
|
channelId: this.channelId,
|
|
@@ -10747,6 +10873,16 @@ var bv = class {
|
|
|
10747
10873
|
streamToMediaElementEnabled: e,
|
|
10748
10874
|
iosMediaElementEnabled: e
|
|
10749
10875
|
}, this.userAgentInformation.getUserAgentInformation());
|
|
10876
|
+
}), e(this, "getPlaybackBufferState", (e, t) => {
|
|
10877
|
+
let n = t == null ? void 0 : t.getBufferState(e.currentTime);
|
|
10878
|
+
if (!n) return e;
|
|
10879
|
+
let r = e.playbackState === "buffering" || n.playbackState === "buffering" ? "buffering" : e.playbackState === "paused" ? "paused" : "playing";
|
|
10880
|
+
return C(C({}, e), {}, {
|
|
10881
|
+
buffered: n.buffered,
|
|
10882
|
+
playbackState: r
|
|
10883
|
+
});
|
|
10884
|
+
}), e(this, "onMediaElementBufferState", (e, t) => {
|
|
10885
|
+
this.emitter.emit("buffer state", this.getPlaybackBufferState(e, t));
|
|
10750
10886
|
}), e(this, "onMediaElementState", (e) => {
|
|
10751
10887
|
this.logger.info("media element state", { state: e }), this.options.get("pauseSupportEnabled") && (e === "paused" ? this.modules.documentState.isVisible && (this.suspend(), this.modules.connection.disconnect()) : (this.unsuspend(), this.modules.connection.getState() === "disconnected" && this.modules.connection.unsuspend()));
|
|
10752
10888
|
}), e(this, "onBufferEvent", (e) => {
|
|
@@ -10760,7 +10896,7 @@ var bv = class {
|
|
|
10760
10896
|
}), e(this, "timeToFirstFrame", () => {
|
|
10761
10897
|
let e = this.modules.playback.getFirstFrameTime(), t = this.modules.connection.firstConnectionTime;
|
|
10762
10898
|
if (t && e) return e - t;
|
|
10763
|
-
}), this.options = new
|
|
10899
|
+
}), this.options = new Cv(C(C({}, xn), Nv(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
|
|
10764
10900
|
let o = {
|
|
10765
10901
|
channelId: this.options.get("channelId"),
|
|
10766
10902
|
audio: {
|
|
@@ -10773,16 +10909,16 @@ var bv = class {
|
|
|
10773
10909
|
height: this.options.get("maxSize").height
|
|
10774
10910
|
}
|
|
10775
10911
|
}, s = O.get();
|
|
10776
|
-
s.setLevel(this.options.get("logLevel")), s.setDebug(!1), this.logger = s, this.webCodecsRenditionSupport = new
|
|
10912
|
+
s.setLevel(this.options.get("logLevel")), s.setDebug(!1), this.logger = s, this.webCodecsRenditionSupport = new Fv(s), r.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
|
|
10777
10913
|
let c = (a = r.streamToMediaElementEnabled) == null ? r.iosMediaElementEnabled : a;
|
|
10778
10914
|
c !== void 0 && (this.options.set("streamToMediaElementEnabled", c), this.options.set("iosMediaElementEnabled", c));
|
|
10779
10915
|
let l = r.mseEnabled !== void 0, f = r.decoders !== void 0;
|
|
10780
10916
|
l && this.logger.warn("Option mseEnabled is deprecated and will be removed in a future release. Use decoders instead (e.g. decoders: [\"wasm\"])."), l && !f && r.mseEnabled === !1 && this.options.set("decoders", ["wasm"]);
|
|
10781
|
-
let p =
|
|
10917
|
+
let p = Y_.create(this.emitter, this.logger.createContext("PictureInPictureModule")), h = j.create(), ee = Kg.create(this.emitter, this.logger.createContext("ConnectionModule"), {
|
|
10782
10918
|
reconnectHandler: this.options.get("reconnectHandler"),
|
|
10783
10919
|
options: this.options,
|
|
10784
10920
|
onConnectInfo: this.onConnectInfo
|
|
10785
|
-
}), te =
|
|
10921
|
+
}), te = sv.create(this.logger.createContext("SubscriptionModule"), this.emitter, o), ne = rv.create(this.emitter, te), re = tv.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), ne), ie = Z_.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime"));
|
|
10786
10922
|
this.encryptedMediaExtensions = new Rr(this.emitter, this.logger.createContext("EncryptedMediaExtensions"), r.drm), this.drm = {
|
|
10787
10923
|
setHeaders: (e) => {
|
|
10788
10924
|
this.encryptedMediaExtensions.headers = e;
|
|
@@ -10801,7 +10937,7 @@ var bv = class {
|
|
|
10801
10937
|
logger: this.logger.createContext("MediaElement"),
|
|
10802
10938
|
poster: se
|
|
10803
10939
|
});
|
|
10804
|
-
e.on("buffer state", (e) => this.
|
|
10940
|
+
e.on("buffer state", (e) => this.onMediaElementBufferState(e, _)), e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("volume state", (e) => this.emit("volume state", e)), e.on("media element state", (e) => this.onMediaElementState(e)), this.element = e.element, this.playbackSource = e, Rr.isSupported() && this.encryptedMediaExtensions.attach(e.element), _ = B_.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (y = bv.create(this.logger.createContext("UnpauseModule"), e, ae)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
|
|
10805
10941
|
} else if (this.options.get("streamToMediaElementEnabled") && Et(this.browser)) {
|
|
10806
10942
|
let e = O_.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
|
|
10807
10943
|
type: this.options.get("media") === "audio" ? "audio" : "video",
|
|
@@ -10813,7 +10949,7 @@ var bv = class {
|
|
|
10813
10949
|
}), t = e.element();
|
|
10814
10950
|
this.element = t.element, this.playbackSource = e, S = e;
|
|
10815
10951
|
let n = this.browser.platform.isIOS && this.browser.platform.iosVersion <= 15;
|
|
10816
|
-
this.options.get("pictureInPictureEnabled") && !n && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (y =
|
|
10952
|
+
this.options.get("pictureInPictureEnabled") && !n && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (y = bv.create(this.logger.createContext("UnpauseModule"), t, ae));
|
|
10817
10953
|
} else {
|
|
10818
10954
|
let e;
|
|
10819
10955
|
e = E_.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
|
|
@@ -10830,10 +10966,13 @@ var bv = class {
|
|
|
10830
10966
|
}, this.emitter.on("error", (e) => {
|
|
10831
10967
|
if (e.type() === "external" && this.emit("error", e), e.isFatal()) return () => void this.unload();
|
|
10832
10968
|
});
|
|
10833
|
-
let ce = this.willUseMediaSource(), ue = ce ? !this.browser.platform.isWebKit : !0, de =
|
|
10969
|
+
let ce = this.willUseMediaSource(), ue = ce ? !this.browser.platform.isWebKit : !0, de = {
|
|
10970
|
+
getTargetBufferTime: () => ie.getTargetBufferTime(),
|
|
10971
|
+
getNextBufferedRangeStart: _ ? (e) => _.getNextBufferedRangeStart(e) : void 0
|
|
10972
|
+
}, fe = mv.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, de, ue, ce), pe = d_.create(this.logger.createContext("JitterModule")), me = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), ge = new URL("/telemetry", me).toString();
|
|
10834
10973
|
this.modules = {
|
|
10835
|
-
telemetry:
|
|
10836
|
-
url:
|
|
10974
|
+
telemetry: vv.create(this.logger.createContext("TelemetryModule"), this.emitter, {
|
|
10975
|
+
url: ge,
|
|
10837
10976
|
enabled: this.options.get("telemetryEnabled"),
|
|
10838
10977
|
includeStats: !1,
|
|
10839
10978
|
interval: 5e3
|
|
@@ -10845,9 +10984,9 @@ var bv = class {
|
|
|
10845
10984
|
incomingData: c_.create(this.emitter),
|
|
10846
10985
|
adaptivity: ys.create(this.emitter, this.logger.createContext("AdaptivityModule"), re, { cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3) }),
|
|
10847
10986
|
constraintCap: Zg.create(this.emitter, this.element, ne, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
|
|
10848
|
-
event: o_.create(this.emitter, this.logger.createContext("EventModule"),
|
|
10849
|
-
sync:
|
|
10850
|
-
jitter:
|
|
10987
|
+
event: o_.create(this.emitter, this.logger.createContext("EventModule"), fe),
|
|
10988
|
+
sync: fe,
|
|
10989
|
+
jitter: pe,
|
|
10851
10990
|
documentState: ae,
|
|
10852
10991
|
connection: ee,
|
|
10853
10992
|
playback: ie,
|
|
@@ -10870,10 +11009,10 @@ var bv = class {
|
|
|
10870
11009
|
this.connectionState === "connected" && e && (this.emitter.emit("flush buffers"), this.modules.connection.disconnect("Page inactive timeout"));
|
|
10871
11010
|
}, n.DISCONNECT_TIMEOUT);
|
|
10872
11011
|
});
|
|
10873
|
-
let
|
|
11012
|
+
let ve;
|
|
10874
11013
|
this.emitter.on("context switch complete", () => {
|
|
10875
|
-
|
|
10876
|
-
window.clearTimeout(
|
|
11014
|
+
ve || (ve = window.setTimeout(() => {
|
|
11015
|
+
window.clearTimeout(ve), ve = void 0, this.emit("context switch", "completed"), this.emitLanguagesIfChanged();
|
|
10877
11016
|
}, this.targetBufferTime));
|
|
10878
11017
|
}), this.emitter.on("context switch started", () => this.emit("context switch", "started")), this.emitter.on("needs user input", (e) => this.emit("needs user input", e)), this.emitter.on("event", (e) => {
|
|
10879
11018
|
switch (e.type) {
|
|
@@ -10898,7 +11037,7 @@ var bv = class {
|
|
|
10898
11037
|
let r = ((t = (n = e.telemetry) == null ? void 0 : n.probability) == null ? 1 : t) >= Math.random();
|
|
10899
11038
|
if (e.telemetry) {
|
|
10900
11039
|
var i;
|
|
10901
|
-
(i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry =
|
|
11040
|
+
(i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = vv.create(this.logger.createContext("TelemetryModule"), this.emitter, C(C({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
|
|
10902
11041
|
}
|
|
10903
11042
|
}), this.emitter.on("adapt level", (e) => {
|
|
10904
11043
|
this.logger.debug("adapt level", { direction: e });
|
|
@@ -10930,8 +11069,8 @@ var bv = class {
|
|
|
10930
11069
|
audio: C(C({}, this.targetSubscription.audio), d == null ? void 0 : d.audio)
|
|
10931
11070
|
})), this.emitter.emit("adapted level");
|
|
10932
11071
|
}), this.emitter.on("text track data", (e) => {
|
|
10933
|
-
let t = b(
|
|
10934
|
-
if (x(
|
|
11072
|
+
let t = b(Lv, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - b(Iv, this);
|
|
11073
|
+
if (x(Iv, this, n), t) {
|
|
10935
11074
|
if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
|
|
10936
11075
|
for (let r of e.cues) {
|
|
10937
11076
|
let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
|
|
@@ -10945,19 +11084,19 @@ var bv = class {
|
|
|
10945
11084
|
this.clientIp = t.ip;
|
|
10946
11085
|
break;
|
|
10947
11086
|
case "renditions":
|
|
10948
|
-
this.updateTextTracks(t.renditions), x(
|
|
11087
|
+
this.updateTextTracks(t.renditions), x(Rv, this, this.filterRenditions(t.renditions).then((e) => {
|
|
10949
11088
|
this.emitter.emit("renditions", {
|
|
10950
11089
|
renditions: e,
|
|
10951
11090
|
channelId: this.currentSubscription.channelId
|
|
10952
11091
|
}), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
|
|
10953
11092
|
}).finally(() => {
|
|
10954
|
-
x(
|
|
11093
|
+
x(Rv, this, void 0);
|
|
10955
11094
|
}));
|
|
10956
11095
|
break;
|
|
10957
11096
|
case "subscription changed":
|
|
10958
11097
|
var r;
|
|
10959
11098
|
try {
|
|
10960
|
-
|
|
11099
|
+
Pv(t.subscription);
|
|
10961
11100
|
} catch (e) {
|
|
10962
11101
|
this.emitter.emit("error", new g("Subscription failed validation", {
|
|
10963
11102
|
source: e instanceof Error ? e : void 0,
|
|
@@ -10983,7 +11122,7 @@ var bv = class {
|
|
|
10983
11122
|
this.logger.warn("Received unwanted message", C({}, n));
|
|
10984
11123
|
return;
|
|
10985
11124
|
}
|
|
10986
|
-
|
|
11125
|
+
xe(C(C({}, n), {}, { channelId: t.channelId }));
|
|
10987
11126
|
}), this.emitter.on("received moq data", (e) => {
|
|
10988
11127
|
let t = e.payload.mediaType(), n = e.channelId, r = e.renditionId, i = this.modules.sync.processFragment(n, e.payload);
|
|
10989
11128
|
if (t !== "text" && this.modules.jitter.recordSample({
|
|
@@ -11067,12 +11206,12 @@ var bv = class {
|
|
|
11067
11206
|
renditionId: r
|
|
11068
11207
|
});
|
|
11069
11208
|
});
|
|
11070
|
-
let
|
|
11071
|
-
|
|
11072
|
-
let
|
|
11209
|
+
let ye = this.options.get("container");
|
|
11210
|
+
ye && this.attach(ye), this.logger.info("Created Vindral instance", { options: this.options });
|
|
11211
|
+
let xe = function() {
|
|
11073
11212
|
var e = t(function* (e) {
|
|
11074
11213
|
let t = e.channelId;
|
|
11075
|
-
b(
|
|
11214
|
+
b(Rv, i) && (yield b(Rv, i));
|
|
11076
11215
|
let n = i.modules.renditions.getRendition(e.renditionId, t);
|
|
11077
11216
|
if (!Ko(e.flags)) {
|
|
11078
11217
|
if (qo(e.flags)) {
|
|
@@ -11080,8 +11219,8 @@ var bv = class {
|
|
|
11080
11219
|
if (e.renditionId !== 0) {
|
|
11081
11220
|
let e = le(t);
|
|
11082
11221
|
if (e && e.language !== void 0) {
|
|
11083
|
-
let t = new is().parse(e.content || ""), r = n / 1e3, a = b(
|
|
11084
|
-
if (x(
|
|
11222
|
+
let t = new is().parse(e.content || ""), r = n / 1e3, a = b(Lv, i).find((t) => t.language === e.language), o = r - b(Iv, i);
|
|
11223
|
+
if (x(Iv, i, r), a) {
|
|
11085
11224
|
if (a.cues) for (let e of a.cues) e.startTime -= o, e.endTime -= o;
|
|
11086
11225
|
for (let e of t) {
|
|
11087
11226
|
let t = new VTTCue(e.startTime - r, e.endTime - r, e.text);
|
|
@@ -11113,10 +11252,10 @@ var bv = class {
|
|
|
11113
11252
|
mimeType: s
|
|
11114
11253
|
}), i.emit("initialized media");
|
|
11115
11254
|
} else {
|
|
11116
|
-
let t =
|
|
11255
|
+
let t = Av(e, n, i.sizes.get(e.renditionId));
|
|
11117
11256
|
i.modules.jitter.recordSample(t);
|
|
11118
11257
|
let a = i.sampleProcessingSesssions.get(r);
|
|
11119
|
-
if (!a) a =
|
|
11258
|
+
if (!a) a = Tv(i.modules.sync.processSample(t)), i.sampleProcessingSesssions.set(r, a);
|
|
11120
11259
|
else {
|
|
11121
11260
|
let e = i.willUseMediaSource() && i.isSwitchingRenditionLevel && t.type === "video", n = a(i.modules.sync.processSample(t), e), r = t;
|
|
11122
11261
|
n.forEach((e) => {
|
|
@@ -11224,7 +11363,7 @@ var bv = class {
|
|
|
11224
11363
|
this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
|
|
11225
11364
|
}
|
|
11226
11365
|
set textTrack(e) {
|
|
11227
|
-
e !== this.textTrack && (b(
|
|
11366
|
+
e !== this.textTrack && (b(Lv, this).forEach((t) => {
|
|
11228
11367
|
if (t.label === e) t.mode = "showing";
|
|
11229
11368
|
else {
|
|
11230
11369
|
if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
|
|
@@ -11233,11 +11372,11 @@ var bv = class {
|
|
|
11233
11372
|
}), this.emitter.emit("text track", e));
|
|
11234
11373
|
}
|
|
11235
11374
|
get textTracks() {
|
|
11236
|
-
return b(
|
|
11375
|
+
return b(Lv, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
|
|
11237
11376
|
}
|
|
11238
11377
|
get textTrack() {
|
|
11239
11378
|
var e;
|
|
11240
|
-
return (e = b(
|
|
11379
|
+
return (e = b(Lv, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
|
|
11241
11380
|
}
|
|
11242
11381
|
get channelId() {
|
|
11243
11382
|
var e, t;
|
|
@@ -11371,7 +11510,7 @@ var bv = class {
|
|
|
11371
11510
|
return this.modules.subscription.getTargetSubscription();
|
|
11372
11511
|
}
|
|
11373
11512
|
resolvedDecoder(e) {
|
|
11374
|
-
return
|
|
11513
|
+
return kv(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
|
|
11375
11514
|
}
|
|
11376
11515
|
willUseMediaSource() {
|
|
11377
11516
|
return this.resolvedDecoder() === "mse";
|
|
@@ -11390,6 +11529,6 @@ var bv = class {
|
|
|
11390
11529
|
return t === void 0 ? this.shouldUseWebCodecs(e) : t;
|
|
11391
11530
|
}
|
|
11392
11531
|
};
|
|
11393
|
-
e(
|
|
11532
|
+
e(zv, "MAX_POOL_SIZE", 10), e(zv, "DISCONNECT_TIMEOUT", 15 * 1e3), e(zv, "REMOVE_CUE_THRESHOLD", 1e3 * 10);
|
|
11394
11533
|
//#endregion
|
|
11395
|
-
export { $e as _, ut as a, lt as c, wt as d, St as f, Tt as g, xt as h, mt as i, ft as l, _t as m, O as n, pt as o, bt as p, dt as r, yt as s,
|
|
11534
|
+
export { $e as _, ut as a, lt as c, wt as d, St as f, Tt as g, xt as h, mt as i, ft as l, _t as m, O as n, pt as o, bt as p, dt as r, yt as s, zv as t, gt as u, Qe as v };
|