@vindral/web-sdk 4.7.2-15-gf5e093ee → 4.7.2-16-gab36cbe5

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.
@@ -11387,7 +11387,7 @@ var yx = class t {
11387
11387
  e(yx, "MAX_REMEMBERED_RENDITIONS", 32);
11388
11388
  //#endregion
11389
11389
  //#region ../../libs/web-sdk/src/modules/SyncModule.ts
11390
- var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx = (e) => (t) => t > e, Tx = 100, Ex = 1e3, Dx = 1e3, Ox = 1e3, kx = 100, Ax = 50, jx = {
11390
+ var bx, xx = 5e3, Sx = .5, Cx = 3e3, wx = () => Fe() || Me(), Tx = (e) => e && wx() ? 100 : 0, Ex = (e) => (t) => t > e, Dx = 100, Ox = 1e3, kx = 1e3, Ax = 1e3, jx = 100, Mx = 50, Nx = {
11391
11391
  seek: {
11392
11392
  toleranceMs: 200,
11393
11393
  toleranceMaxMs: 2500,
@@ -11419,7 +11419,7 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11419
11419
  decayCooldownMultiplier: 3,
11420
11420
  decayCheckInterval: 15e3
11421
11421
  }
11422
- }, Mx = class {
11422
+ }, Px = class {
11423
11423
  get driftSamplesToCollect() {
11424
11424
  return this._driftSamplesToCollect;
11425
11425
  }
@@ -11427,8 +11427,8 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11427
11427
  this._driftSamplesToCollect = e, this.driftSamples = new r(e);
11428
11428
  }
11429
11429
  constructor(t, n, i, a, o, s = !0) {
11430
- 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", Tx), 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", O.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 yx()), 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", () => {
11431
- this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? Ex : Tx);
11430
+ 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", Dx), 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", O.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 yx()), 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", () => {
11431
+ this.emitter.on("page active", this.onPageActive), this.emitter.on("pageshow", this.onPageShow), this.setSyncInterval(document.visibilityState === "hidden" ? Ox : Dx);
11432
11432
  }), e(this, "unload", () => {
11433
11433
  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");
11434
11434
  }), e(this, "suspend", () => {
@@ -11446,7 +11446,7 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11446
11446
  var e;
11447
11447
  return (e = this.timestampOffset) == null ? 0 : e;
11448
11448
  }), e(this, "getCurrentChannelId", () => this.currentChannelId), e(this, "resetSyncState", () => {
11449
- 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();
11449
+ 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();
11450
11450
  }), 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", () => {
11451
11451
  this.hasObservedBFrames = !1;
11452
11452
  }), e(this, "latchBFramesIfDetected", () => {
@@ -11478,8 +11478,8 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11478
11478
  t = Math.min(t, e);
11479
11479
  });
11480
11480
  let n = e.timestamp / e.timescale * 1e3;
11481
- this.currentChannelId = e.channelId, this.timestampOffset = n - t;
11482
- } else (n || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync();
11481
+ this.currentChannelId = e.channelId, this.timestampOffset = n - t, this.timeshiftDeferralStartedAt = void 0;
11482
+ } else (n || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync(this.usesMse);
11483
11483
  let r = this.timestampOffset * e.timescale / 1e3;
11484
11484
  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;
11485
11485
  }), e(this, "processFragment", (e, t, n) => {
@@ -11500,12 +11500,12 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11500
11500
  let t = 2 ** 53 - 1;
11501
11501
  console.assert(this.highestSeenTimestamps.size !== 0, "no known timestamps"), this.highestSeenTimestamps.forEach((e) => {
11502
11502
  t = Math.min(t, e);
11503
- }), this.currentChannelId = e;
11504
- } else (a || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync();
11503
+ }), this.currentChannelId = e, this.timeshiftDeferralStartedAt = void 0;
11504
+ } else (a || this.allowTimeshiftOnAudio) && this.tryTimeshiftSync(this.usesMse);
11505
11505
  let o = this.timestampOffset * t.timescale() / 1e3;
11506
11506
  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;
11507
11507
  }), e(this, "forceSeek", () => {
11508
- this.logger.debug("Forcing seek", { amount: this.serverCurrentTime - this.playbackSource.currentTime }), this.clearRecoverySeekFlags(), this.playbackSource.currentTime = this.serverCurrentTime, this.positionSetBySeek = this.playbackSource.currentTime;
11508
+ 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;
11509
11509
  }), e(this, "forceTimeshift", () => {
11510
11510
  this.queuedTimeshift = !0;
11511
11511
  }), e(this, "setPlaybackRateAdjustmentEnabled", (e) => {
@@ -11592,31 +11592,47 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11592
11592
  })), !0;
11593
11593
  }
11594
11594
  return !t && n < this.config.playbackRate.startDiff ? !0 : t;
11595
- }), e(this, "tryTimeshiftSync", () => {
11596
- var e;
11595
+ }), e(this, "tryTimeshiftSync", (e = !1) => {
11596
+ var t;
11597
11597
  if (!this.config.timeshift.enabled) return;
11598
11598
  if (this.isTimeshiftUnsafe()) {
11599
11599
  this.queuedTimeshift && this.hasObservedBFrames && (this.queuedTimeshift = !1, this.logger.info("Dropping forced timeshift: suppressed for B-frame stream, use forceSeek to resync"));
11600
11600
  return;
11601
11601
  }
11602
11602
  if (this.hasPendingRecoverySeek() || !this.isAllowedToSync() || this.playbackSource.playbackRate !== 1) return;
11603
- let t = (e = this.drift) == null ? 0 : e;
11604
- this.driftSamples.push(t);
11605
- let n = bt(this.driftSamples.items());
11606
- if (this.queuedTimeshift && n > 0) {
11607
- this.queuedTimeshift = !1, this.applyTimeshift(n);
11603
+ let n = (t = this.drift) == null ? 0 : t;
11604
+ this.driftSamples.push(n);
11605
+ let r = bt(this.driftSamples.items());
11606
+ if (this.queuedTimeshift && r > 0) {
11607
+ this.queuedTimeshift = !1, this.applyTimeshift(r);
11608
11608
  return;
11609
11609
  }
11610
- if (n >= this.getEffectiveSeekToleranceMs() || n < this.currentTimeshiftToleranceMs()) return;
11611
- let r = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, i = this.timeshiftAdjustmentTimestamps.filter(wx(r)).length;
11612
- if (i && this.state.timeshiftToleranceMultiplier > 2) {
11610
+ if (r >= this.getEffectiveSeekToleranceMs()) return;
11611
+ if (r < this.currentTimeshiftToleranceMs()) {
11612
+ this.timeshiftDeferralStartedAt = void 0;
11613
+ return;
11614
+ }
11615
+ let i = performance.now() - this.config.seek.timeoutMs * this.state.timeshiftToleranceMultiplier, a = this.timeshiftAdjustmentTimestamps.filter(Ex(i)).length;
11616
+ if (a && this.state.timeshiftToleranceMultiplier > 2) {
11613
11617
  this.logger.debug("Too many timeshifts within sliding window", {
11614
- timeshiftCooldownThreshold: r,
11615
- recentTimeshiftCount: i
11618
+ timeshiftCooldownThreshold: i,
11619
+ recentTimeshiftCount: a
11616
11620
  });
11617
11621
  return;
11618
11622
  }
11619
- this.applyTimeshift(n);
11623
+ if (e) {
11624
+ var o, s;
11625
+ 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);
11626
+ if (n - r < this.bufferSource.getTargetBufferTime() * Sx) {
11627
+ let e = performance.now();
11628
+ if (this.timeshiftDeferralStartedAt === void 0 && (this.timeshiftDeferralStartedAt = e, this.logger.debug("Deferring timeshift while buffered ahead is thin", {
11629
+ drift: r,
11630
+ bufferedAhead: n
11631
+ })), e - this.timeshiftDeferralStartedAt < Cx) return;
11632
+ }
11633
+ this.timeshiftDeferralStartedAt !== void 0 && this.logger.debug("Releasing timeshift deferral", { deferredMs: performance.now() - this.timeshiftDeferralStartedAt });
11634
+ }
11635
+ this.applyTimeshift(r);
11620
11636
  }), e(this, "clearRecoverySeekFlags", () => {
11621
11637
  this.shouldSeekAfterBuffering = !1, this.shouldSeekWhileStuck = !1;
11622
11638
  }), e(this, "hasActiveRecoveryTrigger", () => this.playbackState === "buffering"), e(this, "hasPendingRecoverySeek", () => (this.refreshRecoverySeekState(), this.getRecoverySeekReason() !== void 0)), e(this, "refreshRecoverySeekState", () => {
@@ -11632,20 +11648,20 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11632
11648
  let n = (e = (t = this.bufferSource).getNextBufferedRangeStart) == null ? void 0 : e.call(t, this.playbackSource.currentTime);
11633
11649
  return this.shouldSeekAfterBuffering = n !== void 0, n;
11634
11650
  }), e(this, "observePlayheadProgress", () => {
11635
- let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > Ax);
11651
+ let e = this.playbackSource.currentTime, t = e !== this.lastPlayheadPosition, n = t && (this.positionSetBySeek === void 0 || e - this.positionSetBySeek > Mx);
11636
11652
  this.positionSetBySeek = void 0, (n || this.playbackSource.isPaused) && (this.hasPerformedStuckSeekInCurrentStillness = !1), (t || this.playbackSource.isPaused || this.isSeeking()) && (this.lastPlayheadPosition = e, this.lastPlayheadProgressAt = performance.now());
11637
11653
  }), e(this, "isPlayheadStuckInBuffer", () => {
11638
11654
  var e, t;
11639
- if (performance.now() - this.lastPlayheadProgressAt < Dx) return !1;
11655
+ if (performance.now() - this.lastPlayheadProgressAt < kx) return !1;
11640
11656
  let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n);
11641
- return r !== void 0 && r - n >= Ox;
11657
+ return r !== void 0 && r - n >= Ax;
11642
11658
  }), e(this, "getRecoverySeekReason", () => {
11643
11659
  if (this.needsMediaSourceRecovery) return "media source reopen";
11644
11660
  if (this.shouldSeekWhileStuck) return "stuck in buffer";
11645
11661
  if (this.shouldSeekAfterBuffering) return "buffering";
11646
11662
  }), 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", () => {
11647
11663
  var e, t;
11648
- let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, kx);
11664
+ let n = this.playbackSource.currentTime, r = (e = (t = this.bufferSource).getBufferedEndAt) == null ? void 0 : e.call(t, n), i = n + Math.max(this.seekOvershoot, jx);
11649
11665
  if (r === void 0 || i >= r) return;
11650
11666
  let a = this.findKeyframeCloseToTimestamp(i);
11651
11667
  return {
@@ -11693,7 +11709,7 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11693
11709
  let i = performance.now();
11694
11710
  this.lastSeekTime = i, t && t !== "stuck in buffer" && (this.hasPerformedRecoverySeekInCurrentRecoveryState = !0), this.clearRecoverySeekFlags(), this.driftSamples.clear(), this.seekAdjustmentTimestamps.push(i), this.seekAdjustmentCount++;
11695
11711
  let a = t === "stuck in buffer" ? 0 : Math.min(n, this.bufferSource.getTargetBufferTime());
11696
- 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();
11712
+ 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();
11697
11713
  }), e(this, "applyTimeshift", (e) => {
11698
11714
  var t;
11699
11715
  let n = (t = e == null ? this.drift : e) == null ? 0 : t;
@@ -11705,7 +11721,7 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11705
11721
  currentTime: this.playbackSource.currentTime,
11706
11722
  rtt: this.rtt,
11707
11723
  timeshiftToleranceMultiplier: this.state.timeshiftToleranceMultiplier
11708
- }), this.timestampOffset += r;
11724
+ }), this.timestampOffset += r, this.timeshiftDeferralStartedAt = void 0;
11709
11725
  let i = performance.now();
11710
11726
  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)) {
11711
11727
  let e = this.state.timeshiftToleranceMultiplier, t = this.config.timeshift.toleranceMaxMs / this.config.timeshift.toleranceMs;
@@ -11719,10 +11735,14 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11719
11735
  var e;
11720
11736
  this.tryDecayMultipliers(), this.refreshRecoverySeekState();
11721
11737
  let t = (e = this.drift) == null ? 0 : e, n = this.getRecoverySeekReason(), r = n !== void 0;
11722
- 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.driftSamplesToCollect && Math.abs(t) < 2e3) return;
11738
+ if (!r && !this.isAllowedToSyncIgnoringCooldown()) {
11739
+ this.timeshiftDeferralStartedAt = void 0;
11740
+ return;
11741
+ }
11742
+ 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;
11723
11743
  let i = r ? t : bt(this.driftSamples.items());
11724
11744
  if (!r && this.tryPlaybackRateSync(i) || !r && this.shouldSkipNormalSeek(i)) return;
11725
- let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(wx(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
11745
+ let a = performance.now() - this.config.seek.timeoutMs * this.state.seekToleranceMultiplier, o = this.seekAdjustmentTimestamps.filter(Ex(a)).length, s = this.currentEmergencySeekToleranceMs(), c = i > 0 && i >= s;
11726
11746
  if (o && this.state.seekToleranceMultiplier > 2 && !r && !c) {
11727
11747
  this.logger.debug("Too many seek adjustments within sliding window", {
11728
11748
  seekCooldownThreshold: a,
@@ -11751,9 +11771,9 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11751
11771
  return;
11752
11772
  }
11753
11773
  }), e(this, "onPageActive", (e) => {
11754
- this.setSyncInterval(e ? Tx : Ex), e && this.onSync();
11774
+ this.setSyncInterval(e ? Dx : Ox), e && this.onSync();
11755
11775
  }), e(this, "onPageShow", (e) => {
11756
- e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? Ex : Tx), this.onSync());
11776
+ e.persisted && (this.setSyncInterval(document.visibilityState === "hidden" ? Ox : Dx), this.onSync());
11757
11777
  }), e(this, "setSyncInterval", (e) => {
11758
11778
  this.syncInterval !== void 0 && this.currentSyncIntervalMs === e || (this.clearSyncInterval(), this.currentSyncIntervalMs = e, this.syncInterval = this.timers.setInterval(this.onSync, e));
11759
11779
  }), e(this, "clearSyncInterval", () => {
@@ -11764,11 +11784,11 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11764
11784
  let t = n >= e - this.config.seek.keyframeSearchBeforeMs, r = n <= e + this.config.seek.keyframeSearchAfterMs;
11765
11785
  if (t && r) return n;
11766
11786
  }
11767
- }), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot = Cx(s), this.config = {
11768
- seek: y({}, jx.seek),
11769
- timeshift: y({}, jx.timeshift),
11770
- playbackRate: y({}, jx.playbackRate),
11771
- backoff: y({}, jx.backoff)
11787
+ }), this.logger = n, this.emitter = t, this.playbackSource = i, this.bufferSource = a, this.usesMse = s, this.seekOvershoot = Tx(s), this.config = {
11788
+ seek: y({}, Nx.seek),
11789
+ timeshift: y({}, Nx.timeshift),
11790
+ playbackRate: y({}, Nx.playbackRate),
11791
+ backoff: y({}, Nx.backoff)
11772
11792
  }, this.config.timeshift.enabled = o, s || (this.config.seek.toleranceMs = 50, this.config.timeshift.toleranceMs = 20, this.config.seek.aheadToleranceMs = 40), this.state = {
11773
11793
  seekToleranceMultiplier: 1,
11774
11794
  timeshiftToleranceMultiplier: 1
@@ -11830,10 +11850,10 @@ var bx, xx = 5e3, Sx = () => Fe() || Me(), Cx = (e) => e && Sx() ? 100 : 0, wx =
11830
11850
  return this.serverCurrentTime - this.playbackSource.currentTime;
11831
11851
  }
11832
11852
  };
11833
- bx = Mx, e(Mx, "create", (e, t, n, r, i, a = !0) => new bx(e, t, n, r, i, a));
11853
+ bx = Px, e(Px, "create", (e, t, n, r, i, a = !0) => new bx(e, t, n, r, i, a));
11834
11854
  //#endregion
11835
11855
  //#region ../../libs/web-sdk/src/modules/TelemetryModule.ts
11836
- var Nx, Px = {
11856
+ var Fx, Ix = {
11837
11857
  enabled: !0,
11838
11858
  interval: 3e4,
11839
11859
  includeErrors: !0,
@@ -11842,11 +11862,11 @@ var Nx, Px = {
11842
11862
  maxRetries: 10,
11843
11863
  maxErrorReports: 50,
11844
11864
  maxEvents: 50
11845
- }, Fx = (e, t) => y(y({}, t), {}, {
11865
+ }, Lx = (e, t) => y(y({}, t), {}, {
11846
11866
  type: e,
11847
11867
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11848
11868
  discriminator: "web"
11849
- }), Ix = class {
11869
+ }), Rx = class {
11850
11870
  constructor(n, i, a, o) {
11851
11871
  var s = this;
11852
11872
  e(this, "logger", void 0), e(this, "timers", new O()), 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", () => {
@@ -11863,7 +11883,7 @@ var Nx, Px = {
11863
11883
  initiator: "interval"
11864
11884
  }, n = {}) => {
11865
11885
  if (!this.options.includeStats) return;
11866
- let r = this.parentContext.getStatistics(), i = Fx("stats", y(y(y({}, n), r), {}, {
11886
+ let r = this.parentContext.getStatistics(), i = Lx("stats", y(y(y({}, n), r), {}, {
11867
11887
  isFinal: e,
11868
11888
  initiator: t,
11869
11889
  count: this.statsCount++
@@ -11871,7 +11891,7 @@ var Nx, Px = {
11871
11891
  this.unsentLines.push(i);
11872
11892
  }), e(this, "addEvent", (e) => {
11873
11893
  if (!this.options.includeEvents || this.eventCount > this.options.maxEvents) return;
11874
- let t = Fx("event", y(y({}, this.parentContext.getStatistics()), e));
11894
+ let t = Lx("event", y(y({}, this.parentContext.getStatistics()), e));
11875
11895
  this.eventCount++, this.unsentLines.push(t);
11876
11896
  }), e(this, "getStatistics", () => ({ errorCount: this.errorCount })), e(this, "send", function() {
11877
11897
  var e = t(function* (e) {
@@ -11916,14 +11936,14 @@ var Nx, Px = {
11916
11936
  let { includeErrors: t, maxErrorReports: n } = this.options;
11917
11937
  if (!(e instanceof k) || e.code() === "channel_not_live" || !t || (this.errorCount++, this.errorCount > n)) return;
11918
11938
  let r = this.parentContext.getStatistics();
11919
- this.unsentLines.push(Fx("error", y(y({}, r), e.toStringifiable())));
11920
- }), this.logger = n, this.emitter = i, this.options = y(y({}, Px), a), this.parentContext = o;
11939
+ this.unsentLines.push(Lx("error", y(y({}, r), e.toStringifiable())));
11940
+ }), this.logger = n, this.emitter = i, this.options = y(y({}, Ix), a), this.parentContext = o;
11921
11941
  }
11922
11942
  };
11923
- Nx = Ix, e(Ix, "create", (e, t, n, r) => new Nx(e, t, n, r));
11943
+ Fx = Rx, e(Rx, "create", (e, t, n, r) => new Fx(e, t, n, r));
11924
11944
  //#endregion
11925
11945
  //#region ../../libs/web-sdk/src/modules/UnpauseModule.ts
11926
- var Lx, Rx = class {
11946
+ var zx, Bx = class {
11927
11947
  constructor(t, n, r) {
11928
11948
  e(this, "logger", void 0), e(this, "elements", void 0), e(this, "documentState", void 0), e(this, "timers", new O()), e(this, "unload", () => {
11929
11949
  this.timers.unload();
@@ -11932,10 +11952,10 @@ var Lx, Rx = class {
11932
11952
  }), this.logger = t, this.elements = n, this.documentState = r, this.timers.setInterval(this.unpause, 100);
11933
11953
  }
11934
11954
  };
11935
- Lx = Rx, e(Rx, "create", (e, t, n) => new Lx(e, t, n));
11955
+ zx = Bx, e(Bx, "create", (e, t, n) => new zx(e, t, n));
11936
11956
  //#endregion
11937
11957
  //#region ../../libs/web-sdk/src/OptionsProvider.ts
11938
- var zx = [
11958
+ var Vx = [
11939
11959
  "minBufferTime",
11940
11960
  "maxBufferTime",
11941
11961
  "burstEnabled",
@@ -11944,10 +11964,10 @@ var zx = [
11944
11964
  "offscreenCanvasEnabled",
11945
11965
  "videoCodecs"
11946
11966
  ];
11947
- function Bx(e) {
11948
- return zx.includes(e);
11967
+ function Hx(e) {
11968
+ return Vx.includes(e);
11949
11969
  }
11950
- var Vx = class {
11970
+ var Ux = class {
11951
11971
  constructor(t) {
11952
11972
  e(this, "options", void 0), e(this, "overrides", /* @__PURE__ */ new Map()), this.options = t;
11953
11973
  }
@@ -11961,7 +11981,7 @@ var Vx = class {
11961
11981
  this.options[e] = t;
11962
11982
  }
11963
11983
  get(e, t) {
11964
- if (t && Bx(e)) {
11984
+ if (t && Hx(e)) {
11965
11985
  var n;
11966
11986
  let r = (n = this.overrides.get(t)) == null ? void 0 : n[e];
11967
11987
  if (r !== void 0) return r;
@@ -11972,7 +11992,7 @@ var Vx = class {
11972
11992
  var n;
11973
11993
  return (n = this.overrides.get(t)) == null ? void 0 : n[e];
11974
11994
  }
11975
- }, Hx = 6, Ux = (e) => {
11995
+ }, Wx = 6, Gx = (e) => {
11976
11996
  let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
11977
11997
  var i, a;
11978
11998
  if (e.flags && Ls(e.flags)) {
@@ -11984,7 +12004,7 @@ var Vx = class {
11984
12004
  return u > 0 && (r = u), y(y({}, e), {}, { duration: u > 0 ? u : r });
11985
12005
  };
11986
12006
  return (e, n = !1) => {
11987
- if (e.flags && Ls(e.flags) && n && (i = !i), !(n && t.length < Hx && i) && t.length > 0) {
12007
+ if (e.flags && Ls(e.flags) && n && (i = !i), !(n && t.length < Wx && i) && t.length > 0) {
11988
12008
  i = !1;
11989
12009
  let n = e;
11990
12010
  for (let e = t.length - 1; e > 0; e--) {
@@ -11997,13 +12017,13 @@ var Vx = class {
11997
12017
  }
11998
12018
  return t.push(e), [];
11999
12019
  };
12000
- }, Wx = ["mse", "wasm"], Gx = (e) => e == null ? Wx : e, Kx = (e) => {
12020
+ }, Kx = ["mse", "wasm"], qx = (e) => e == null ? Kx : e, Jx = (e) => {
12001
12021
  if (!e) return !1;
12002
12022
  let t = e.headers && Object.keys(e.headers).length > 0, n = e.queryParams && Object.keys(e.queryParams).length > 0;
12003
12023
  return !!(t || n);
12004
- }, qx = (e, t, n) => {
12005
- if (Kx(n)) return "mse";
12006
- let r = Gx(e);
12024
+ }, Yx = (e, t, n) => {
12025
+ if (Jx(n)) return "mse";
12026
+ let r = qx(e);
12007
12027
  for (let e of r) switch (e) {
12008
12028
  case "mse":
12009
12029
  if (t) return "mse";
@@ -12014,7 +12034,7 @@ var Vx = class {
12014
12034
  case "wasm": return "wasm";
12015
12035
  }
12016
12036
  return "wasm";
12017
- }, Jx = (e, t, n) => {
12037
+ }, Xx = (e, t, n) => {
12018
12038
  if (dn(t)) return y(y({}, e), {}, {
12019
12039
  type: "video",
12020
12040
  codec: t.codec,
@@ -12035,12 +12055,12 @@ var Vx = class {
12035
12055
  data: e.payload,
12036
12056
  duration: 0
12037
12057
  });
12038
- }, Yx = ({ average: e, last: t, max: n, min: r }) => ({
12058
+ }, Zx = ({ average: e, last: t, max: n, min: r }) => ({
12039
12059
  average: Math.round(e),
12040
12060
  last: Math.round(t),
12041
12061
  max: Math.round(n),
12042
12062
  min: Math.round(r)
12043
- }), Xx = [
12063
+ }), Qx = [
12044
12064
  "timeSpentBuffering",
12045
12065
  "timePerBufferingEvent",
12046
12066
  "drift",
@@ -12052,24 +12072,24 @@ var Vx = class {
12052
12072
  "videoKeyframeIntervalMs",
12053
12073
  "timeToConnected",
12054
12074
  "mediaSourceOpenTime"
12055
- ], Zx = [
12075
+ ], $x = [
12056
12076
  "videoDecodeTime",
12057
12077
  "audioDecodeTime",
12058
12078
  "videoTransportTime",
12059
12079
  "rtt"
12060
- ], Qx = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, $x = (e) => {
12080
+ ], eS = (e) => typeof e == "object" && !!e && "min" in e && "max" in e && "average" in e && "last" in e, tS = (e) => {
12061
12081
  let t = y({}, e);
12062
- for (let e of Xx) {
12082
+ for (let e of Qx) {
12063
12083
  let n = t[e];
12064
12084
  typeof n == "number" && (t[e] = Math.round(n));
12065
12085
  }
12066
- for (let e of Zx) {
12086
+ for (let e of $x) {
12067
12087
  let n = t[e];
12068
- Qx(n) && (t[e] = Yx(n));
12088
+ eS(n) && (t[e] = Zx(n));
12069
12089
  }
12070
12090
  return t;
12071
- }, eS = (e, t) => e && typeof e == "object" && t in e, tS = (e) => !(typeof e != "object" || !eS(e, "channelId") || typeof e.channelId != "string" || !eS(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), nS = (e) => {
12072
- if (!tS(e)) throw new k("Invalid options", {
12091
+ }, nS = (e, t) => e && typeof e == "object" && t in e, rS = (e) => !(typeof e != "object" || !nS(e, "channelId") || typeof e.channelId != "string" || !nS(e, "url") || typeof e.url != "string" || e.channelId.length === 0 || e.url.length === 0), iS = (e) => {
12092
+ if (!rS(e)) throw new k("Invalid options", {
12073
12093
  isFatal: !0,
12074
12094
  code: "invalid_options"
12075
12095
  });
@@ -12078,13 +12098,13 @@ var Vx = class {
12078
12098
  let n = t;
12079
12099
  n[e] === void 0 && delete n[e];
12080
12100
  }), t;
12081
- }, rS = (e) => {
12101
+ }, aS = (e) => {
12082
12102
  if (typeof e != "object" || !e) throw Error("not an object");
12083
12103
  if (!("video" in e)) throw Error("missing video in subscription");
12084
12104
  if (!("audio" in e)) throw Error("missing audio in subscription");
12085
12105
  if (!("channelId" in e)) throw Error("missing channelId");
12086
12106
  return !0;
12087
- }, iS = class {
12107
+ }, oS = class {
12088
12108
  constructor(n) {
12089
12109
  var r = this;
12090
12110
  e(this, "cache", /* @__PURE__ */ new Map()), e(this, "inFlight", /* @__PURE__ */ new Map()), e(this, "checkVideoSupport", function() {
@@ -12145,10 +12165,10 @@ var Vx = class {
12145
12165
  return this.inFlight.set(e, o), o;
12146
12166
  }), this.logger = n;
12147
12167
  }
12148
- }, aS = 1e4, oS = 1280 * 720, sS = /* @__PURE__ */ new WeakMap(), cS = /* @__PURE__ */ new WeakMap(), lS = /* @__PURE__ */ new WeakMap(), uS = class n extends ie {
12168
+ }, sS = 1e4, cS = 1280 * 720, lS = /* @__PURE__ */ new WeakMap(), uS = /* @__PURE__ */ new WeakMap(), dS = /* @__PURE__ */ new WeakMap(), fS = class n extends ie {
12149
12169
  constructor(r) {
12150
12170
  var o, c, u;
12151
- 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", cn()), 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 sn()), e(this, "encryptedMediaExtensions", void 0), i(this, sS, 0), i(this, cS, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new eb()), e(this, "unextractableSamplesWarned", new eb()), 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, lS, void 0), e(this, "attach", (e) => {
12171
+ 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", cn()), 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 sn()), e(this, "encryptedMediaExtensions", void 0), i(this, lS, 0), i(this, uS, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "unbackedSamplesWarned", new eb()), e(this, "unextractableSamplesWarned", new eb()), 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, dS, void 0), e(this, "attach", (e) => {
12152
12172
  var t;
12153
12173
  (t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
12154
12174
  }), e(this, "setElement", (e) => {
@@ -12244,20 +12264,20 @@ var Vx = class {
12244
12264
  }), e(this, "updateTextTracks", (e) => {
12245
12265
  let t = e.filter((e) => e.codec === "webvtt");
12246
12266
  t.forEach((e) => {
12247
- if (!s(cS, this).find((t) => t.language === e.language)) {
12267
+ if (!s(uS, this).find((t) => t.language === e.language)) {
12248
12268
  if (this.modules.canvasModule) {
12249
12269
  let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
12250
- s(cS, this).push(t);
12270
+ s(uS, this).push(t);
12251
12271
  } else if (this.mediaElement instanceof HTMLVideoElement) {
12252
12272
  let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
12253
- s(cS, this).push(t);
12273
+ s(uS, this).push(t);
12254
12274
  }
12255
12275
  }
12256
12276
  });
12257
- for (let e of s(cS, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
12277
+ for (let e of s(uS, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
12258
12278
  this.emit("text tracks", this.textTracks);
12259
12279
  }), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
12260
- s(cS, this).forEach((t) => {
12280
+ s(uS, this).forEach((t) => {
12261
12281
  if (t.cues) for (let n of Array.from(t.cues)) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
12262
12282
  });
12263
12283
  }), e(this, "filterRenditions", function() {
@@ -12430,7 +12450,7 @@ var Vx = class {
12430
12450
  (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();
12431
12451
  })), e(this, "capturesCanvasOnWebKit", (e) => !!e && this.browser.platform.isWebKit && this.modules.canvasModule instanceof Vb), e(this, "connectWebKitVideoOutput", (e, t) => {
12432
12452
  let n = () => {
12433
- t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(oS);
12453
+ t.setVideoTrack(void 0), this.browser.platform.isIOS && e.setMaxVideoCanvasPixels(cS);
12434
12454
  };
12435
12455
  e.onVideoTrackLost((e) => {
12436
12456
  this.logger.warn("Worker video track lost, falling back to canvas capture", { error: e }), n();
@@ -12480,7 +12500,7 @@ var Vx = class {
12480
12500
  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();
12481
12501
  }), e(this, "getStatistics", () => {
12482
12502
  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;
12483
- return $x(y(y({}, e), {}, {
12503
+ return tS(y(y({}, e), {}, {
12484
12504
  averageBitRate: t,
12485
12505
  reconnectsPerHour: i,
12486
12506
  seekAdjustmentsPerMinute: s,
@@ -12489,7 +12509,7 @@ var Vx = class {
12489
12509
  }), e(this, "resetModules", () => {
12490
12510
  Object.values(this.modules).forEach((e) => {
12491
12511
  e && "reset" in e && e.reset();
12492
- }), this.playbackSource instanceof dc && this.modules.adaptivity.holdReconnect(aS), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12512
+ }), this.playbackSource instanceof dc && this.modules.adaptivity.holdReconnect(sS), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12493
12513
  }), e(this, "disconnectForInactivePage", (e) => {
12494
12514
  if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
12495
12515
  var t;
@@ -12523,7 +12543,7 @@ var Vx = class {
12523
12543
  let e = this.modules.canvasModule instanceof Vb ? !0 : void 0;
12524
12544
  return y({
12525
12545
  uptime: this.uptime,
12526
- version: "4.7.2-15-gf5e093ee",
12546
+ version: "4.7.2-16-gab36cbe5",
12527
12547
  clientId: this.clientId,
12528
12548
  sessionId: this.sessionId,
12529
12549
  channelId: this.channelId,
@@ -12568,7 +12588,7 @@ var Vx = class {
12568
12588
  if (this.browser.platform.isWebKit || !this.browser.isMobile) return !1;
12569
12589
  let t = (e = this.modules) == null ? void 0 : e.decoder;
12570
12590
  return t ? t.audioWebCodecsInUse : this.isWebCodecsAudioAvailable(this.channelId);
12571
- }), this.options = new Vx(y(y({}, ar), nS(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
12591
+ }), this.options = new Ux(y(y({}, ar), iS(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
12572
12592
  let d = {
12573
12593
  channelId: this.options.get("channelId"),
12574
12594
  audio: {
@@ -12581,7 +12601,7 @@ var Vx = class {
12581
12601
  height: this.options.get("maxSize").height
12582
12602
  }
12583
12603
  }, f = b.get();
12584
- f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new iS(f), r.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
12604
+ f.setLevel(this.options.get("logLevel")), f.setDebug(!1), this.logger = f, this.webCodecsRenditionSupport = new oS(f), r.iosMediaElementEnabled !== void 0 && this.logger.warn("Option iosMediaElementEnabled is deprecated and will be removed in a future release. Use streamToMediaElementEnabled instead.");
12585
12605
  let p = (c = r.streamToMediaElementEnabled) == null ? r.iosMediaElementEnabled : c;
12586
12606
  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.");
12587
12607
  let m = (u = r.backgroundPlayEnabled) == null ? r.iosBackgroundPlayEnabled : u;
@@ -12622,7 +12642,7 @@ var Vx = class {
12622
12642
  logger: this.logger.createContext("MediaElement"),
12623
12643
  poster: ue
12624
12644
  });
12625
- 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, Ci.isSupported() && this.encryptedMediaExtensions.attach(e.element), C = Kb.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (de = Rx.create(this.logger.createContext("UnpauseModule"), [e], ce)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
12645
+ 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, Ci.isSupported() && this.encryptedMediaExtensions.attach(e.element), C = Kb.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (de = Bx.create(this.logger.createContext("UnpauseModule"), [e], ce)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
12626
12646
  } else if (this.streamsToMediaElement()) {
12627
12647
  let e = Vb.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
12628
12648
  type: this.options.get("media") === "audio" ? "audio" : "video",
@@ -12636,7 +12656,7 @@ var Vx = class {
12636
12656
  });
12637
12657
  this.element = e.element().element, this.playbackSource = e, fe = e;
12638
12658
  let t = this.browser.platform.isIOS && this.browser.platform.iosVersion <= 15;
12639
- this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (de = Rx.create(this.logger.createContext("UnpauseModule"), e.elements(), ce));
12659
+ this.options.get("pictureInPictureEnabled") && !t && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (de = Bx.create(this.logger.createContext("UnpauseModule"), e.elements(), ce));
12640
12660
  } else {
12641
12661
  let e;
12642
12662
  e = Pb.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
@@ -12657,9 +12677,9 @@ var Vx = class {
12657
12677
  getTargetBufferTime: () => S.getTargetBufferTime(),
12658
12678
  getNextBufferedRangeStart: C ? (e) => C.getNextBufferedRangeStart(e) : void 0,
12659
12679
  getBufferedEndAt: C ? (e) => C.getBufferedEndAt(e) : void 0
12660
- }, ge = Mx.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, he, me, pe), _e = yb.create(this.logger.createContext("JitterModule")), ve = mc.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();
12680
+ }, ge = Px.create(this.emitter, this.logger.createContext("SyncModule"), this.playbackSource, he, me, pe), _e = yb.create(this.logger.createContext("JitterModule")), ve = mc.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();
12661
12681
  this.modules = {
12662
- telemetry: Ix.create(this.logger.createContext("TelemetryModule"), this.emitter, {
12682
+ telemetry: Rx.create(this.logger.createContext("TelemetryModule"), this.emitter, {
12663
12683
  url: w,
12664
12684
  enabled: this.options.get("telemetryEnabled"),
12665
12685
  includeStats: !1,
@@ -12744,7 +12764,7 @@ var Vx = class {
12744
12764
  let r = ((t = (n = e.telemetry) == null ? void 0 : n.probability) == null ? 1 : t) >= Math.random();
12745
12765
  if (e.telemetry) {
12746
12766
  var i;
12747
- (i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = Ix.create(this.logger.createContext("TelemetryModule"), this.emitter, y(y({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
12767
+ (i = this.modules.telemetry) == null || i.unload(), this.modules.telemetry = Rx.create(this.logger.createContext("TelemetryModule"), this.emitter, y(y({}, e.telemetry), {}, { enabled: this.options.get("telemetryEnabled") && r }), this), this.modules.telemetry.load();
12748
12768
  }
12749
12769
  }), this.emitter.on("adapt level", (e) => {
12750
12770
  let t = this.modules.renditions.getRenditionLevels(), n = this.modules.renditions.getRenditionLevel(), r = t.findIndex((e) => e === n), i = t.length - 1, a = r;
@@ -12786,8 +12806,8 @@ var Vx = class {
12786
12806
  audio: y(y({}, this.targetSubscription.audio), f == null ? void 0 : f.audio)
12787
12807
  })), this.emitter.emit("adapted level");
12788
12808
  }), this.emitter.on("ping timeout", this.stepDownForRejoin), this.emitter.on("text track data", (e) => {
12789
- let t = s(cS, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(sS, this);
12790
- if (a(sS, this, n), t) {
12809
+ let t = s(uS, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(lS, this);
12810
+ if (a(lS, this, n), t) {
12791
12811
  if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
12792
12812
  for (let r of e.cues) {
12793
12813
  let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
@@ -12803,19 +12823,19 @@ var Vx = class {
12803
12823
  this.clientIp = t.ip;
12804
12824
  break;
12805
12825
  case "renditions":
12806
- this.updateTextTracks(t.renditions), a(lS, this, this.filterRenditions(t.renditions, n.channelId).then((e) => {
12826
+ this.updateTextTracks(t.renditions), a(dS, this, this.filterRenditions(t.renditions, n.channelId).then((e) => {
12807
12827
  r === this.sessionId && (this.emitter.emit("renditions", {
12808
12828
  renditions: e,
12809
12829
  channelId: n.channelId
12810
12830
  }), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged());
12811
12831
  }).finally(() => {
12812
- a(lS, this, void 0);
12832
+ a(dS, this, void 0);
12813
12833
  }));
12814
12834
  break;
12815
12835
  case "subscription changed":
12816
12836
  var i;
12817
12837
  try {
12818
- rS(t.subscription);
12838
+ aS(t.subscription);
12819
12839
  } catch (e) {
12820
12840
  this.emitter.emit("error", new k("Subscription failed validation", {
12821
12841
  source: e instanceof Error ? e : void 0,
@@ -12946,7 +12966,7 @@ var Vx = class {
12946
12966
  let xe = function() {
12947
12967
  var e = t(function* (e) {
12948
12968
  let t = e.channelId;
12949
- s(lS, o) && (yield s(lS, o));
12969
+ s(dS, o) && (yield s(dS, o));
12950
12970
  let n = o.modules.renditions.getRendition(e.renditionId, t);
12951
12971
  if (!zs(e.flags)) {
12952
12972
  if (Bs(e.flags)) {
@@ -12960,8 +12980,8 @@ var Vx = class {
12960
12980
  } catch (e) {
12961
12981
  o.logger.warn("failed to parse WebVTT segment, dropping it", e);
12962
12982
  }
12963
- let i = n / 1e3, c = s(cS, o).find((t) => t.language === e.language), l = i - s(sS, o);
12964
- if (a(sS, o, i), c) {
12983
+ let i = n / 1e3, c = s(uS, o).find((t) => t.language === e.language), l = i - s(lS, o);
12984
+ if (a(lS, o, i), c) {
12965
12985
  if (c.cues) for (let e of c.cues) e.startTime -= l, e.endTime -= l;
12966
12986
  for (let e of r) {
12967
12987
  let t = new VTTCue(e.startTime - i, e.endTime - i, e.text);
@@ -12997,10 +13017,10 @@ var Vx = class {
12997
13017
  mimeType: s
12998
13018
  }), o.emit("initialized media");
12999
13019
  } else {
13000
- let t = Jx(e, n, o.sizes.get(e.renditionId));
13020
+ let t = Xx(e, n, o.sizes.get(e.renditionId));
13001
13021
  o.modules.jitter.recordSample(t);
13002
13022
  let i = o.sampleProcessingSesssions.get(r);
13003
- if (!i) i = Ux(o.modules.sync.processSample(t)), o.sampleProcessingSesssions.set(r, i);
13023
+ if (!i) i = Gx(o.modules.sync.processSample(t)), o.sampleProcessingSesssions.set(r, i);
13004
13024
  else {
13005
13025
  let e = o.willUseMediaSource() && o.isSwitchingRenditionLevel && t.type === "video", n = i(o.modules.sync.processSample(t), e), r = t;
13006
13026
  n.forEach((e) => {
@@ -13107,7 +13127,7 @@ var Vx = class {
13107
13127
  this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
13108
13128
  }
13109
13129
  set textTrack(e) {
13110
- e !== this.textTrack && (s(cS, this).forEach((t) => {
13130
+ e !== this.textTrack && (s(uS, this).forEach((t) => {
13111
13131
  if (t.label === e) t.mode = "showing";
13112
13132
  else {
13113
13133
  if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
@@ -13116,11 +13136,11 @@ var Vx = class {
13116
13136
  }), this.emitter.emit("text track", e));
13117
13137
  }
13118
13138
  get textTracks() {
13119
- return s(cS, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
13139
+ return s(uS, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
13120
13140
  }
13121
13141
  get textTrack() {
13122
13142
  var e;
13123
- return (e = s(cS, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
13143
+ return (e = s(uS, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
13124
13144
  }
13125
13145
  get channelId() {
13126
13146
  var e, t;
@@ -13258,7 +13278,7 @@ var Vx = class {
13258
13278
  return this.modules.subscription.getTargetSubscription();
13259
13279
  }
13260
13280
  resolvedDecoder(e) {
13261
- return qx(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
13281
+ return Yx(this.options.get("decoders", e), this.browser.supportsMediaSource, this.options.get("drm"));
13262
13282
  }
13263
13283
  usesSplitCanvasAudio() {
13264
13284
  return !this.willUseMediaSource() && this.options.get("streamToMediaElementEnabled") && gt(this.browser) && this.options.get("media") !== "audio" && this.options.get("media") !== "video" && this.browser.platform.isIOS;
@@ -13298,6 +13318,6 @@ var Vx = class {
13298
13318
  return this.hasCalledConnect && this.isBackgroundPlayEnabled(e) && !this.isUserPaused;
13299
13319
  }
13300
13320
  };
13301
- e(uS, "MAX_POOL_SIZE", 10), e(uS, "REMOVE_CUE_THRESHOLD", 1e3 * 10), e(uS, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 1e3 * 15), e(uS, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
13321
+ e(fS, "MAX_POOL_SIZE", 10), e(fS, "REMOVE_CUE_THRESHOLD", 1e3 * 10), e(fS, "BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT", 1e3 * 15), e(fS, "VISIBLE_PAUSE_DISCONNECT_DELAY", 1e3);
13302
13322
  //#endregion
13303
- export { ft as C, ht as D, dt as E, Ve as O, mt as S, st as T, rt as _, xn as a, nt as b, _n as c, Cn as d, k as f, et as g, it as h, yn as i, Be as k, On as l, tt as m, Pn as n, Sn as o, Jt as p, bn as r, vn as s, uS as t, wn as u, lt as v, ut as w, ot as x, $e as y };
13323
+ export { ft as C, ht as D, dt as E, Ve as O, mt as S, st as T, rt as _, xn as a, nt as b, _n as c, Cn as d, k as f, et as g, it as h, yn as i, Be as k, On as l, tt as m, Pn as n, Sn as o, Jt as p, bn as r, vn as s, fS as t, wn as u, lt as v, ut as w, ot as x, $e as y };