@vindral/web-sdk 4.7.2-7-gbceb2a43 → 4.7.2-9-g1ada5e22

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.
@@ -4043,7 +4043,7 @@ var hc, gc = .15, _c = .2, vc = .4, yc = .5, bc = .6, xc = 1800, Sc = {
4043
4043
  maxCooldownRatio: 2
4044
4044
  }, Cc = (e) => (t) => t > e, wc = class {
4045
4045
  constructor(t, n, r, i, a) {
4046
- e(this, "qualityOfServiceSource", void 0), e(this, "incomingDataSource", void 0), e(this, "config", void 0), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "isSuspended", !1), e(this, "lastAdaptTime", performance.now()), e(this, "isEnabled", !0), e(this, "load", () => {
4046
+ e(this, "qualityOfServiceSource", void 0), e(this, "incomingDataSource", void 0), e(this, "config", void 0), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "isSuspended", !1), e(this, "lastAdaptTime", performance.now()), e(this, "reconnectHoldUntil", -Infinity), e(this, "isEnabled", !0), e(this, "load", () => {
4047
4047
  this.emitter.on("buffer state", this.onBufferState), this.emitter.on("adapted level", this.onAdaptedLevel);
4048
4048
  }), e(this, "unload", () => {
4049
4049
  this.emitter.off("buffer state", this.onBufferState), this.emitter.off("adapted level", this.onAdaptedLevel);
@@ -4053,6 +4053,8 @@ var hc, gc = .15, _c = .2, vc = .4, yc = .5, bc = .6, xc = 1800, Sc = {
4053
4053
  this.reset(), this.isSuspended = !1;
4054
4054
  }), e(this, "reset", (e = 0) => {
4055
4055
  this.lastAdaptTime = performance.now() + e;
4056
+ }), e(this, "holdReconnect", (e) => {
4057
+ this.reconnectHoldUntil = performance.now() + e;
4056
4058
  }), e(this, "getStatistics", () => ({ isAbrEnabled: this.isEnabled })), e(this, "isQoSOk", (e) => {
4057
4059
  let t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: n, downgradesFromLevel: r } = t == null ? {
4058
4060
  upgradesFromLevel: [],
@@ -4079,7 +4081,7 @@ var hc, gc = .15, _c = .2, vc = .4, yc = .5, bc = .6, xc = 1800, Sc = {
4079
4081
  }), e(this, "onBufferState", (e) => {
4080
4082
  if (!this.isEnabled || this.isSuspended || this.lastAdaptTime + this.config.cooldownTime > performance.now()) return;
4081
4083
  let { bufferFullness: t, general: n } = this.qualityOfServiceSource.getMetrics(), r = this.qualityOfServiceSource.getBufferFullnessRegression(), i = 10 * 1e3, a = 30 * 1e3, o = this.qualityOfServiceSource.timeSpentBufferingLast(a), s = this.qualityOfServiceSource.timeSpentActiveLast(a), c = this.qualityOfServiceSource.bufferingEventsLast(a), l = s > 0 ? o / s : 0, u = this.qualityOfServiceSource.getTargetBufferTime();
4082
- if (t < .15 && l > .8) {
4084
+ if (t < .15 && l > .8 && performance.now() >= this.reconnectHoldUntil) {
4083
4085
  this.adaptLevel("reconnect");
4084
4086
  return;
4085
4087
  }
@@ -4104,6 +4106,9 @@ var hc, gc = .15, _c = .2, vc = .4, yc = .5, bc = .6, xc = 1800, Sc = {
4104
4106
  this.reset();
4105
4107
  }), e(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e)), this.qualityOfServiceSource = r, this.incomingDataSource = i, this.config = y(y({}, Sc), a), this.emitter = t, this.logger = n;
4106
4108
  }
4109
+ updateConfig(e) {
4110
+ this.config = y(y({}, this.config), e);
4111
+ }
4107
4112
  tooMuchTimeBuffering(e) {
4108
4113
  let t = this.qualityOfServiceSource.timeSpentActiveLast(e);
4109
4114
  return (t ? this.qualityOfServiceSource.timeSpentBufferingLast(e) / t : 0) > this.config.maxBufferingRatio.last10Seconds;
@@ -8814,7 +8819,9 @@ var iy = /* @__PURE__ */ function(e) {
8814
8819
  connectionProtocol: "vindral_ws",
8815
8820
  transportSelectionReason: void 0
8816
8821
  })), e(this, "onMessage", (e) => {
8817
- if (this.pingCooldownExpired() && this.sendPing(), this.isContextSwitchInProgress) {
8822
+ this.routeMessage(e), this.pingCooldownExpired() && this.sendPing();
8823
+ }), e(this, "routeMessage", (e) => {
8824
+ if (this.isContextSwitchInProgress) {
8818
8825
  if (e instanceof ArrayBuffer) {
8819
8826
  this.dataBuffer.push(e);
8820
8827
  return;
@@ -8892,16 +8899,12 @@ var iy = /* @__PURE__ */ function(e) {
8892
8899
  }
8893
8900
  this.emitter.emit("connection state", this.getState());
8894
8901
  }), e(this, "reconnect", (e) => {
8895
- if (this.transport.isConnectInProgress) {
8896
- this.logger.debug("Stopping reconnect, already mid-connection");
8897
- return;
8898
- }
8899
- this.close(e);
8900
- }), e(this, "resetPingState", () => {
8902
+ this.closeUnlessConnecting(e);
8903
+ }), e(this, "closeUnlessConnecting", (e) => this.transport.isConnectInProgress ? (this.logger.debug("Stopping reconnect, already mid-connection"), !1) : (this.close(e), !0)), e(this, "resetPingState", () => {
8901
8904
  this.missedPings = 0, this.isPingInFlight = !1;
8902
8905
  }), e(this, "pingCooldownExpired", () => performance.now() - this.lastPingSentTime > r.PING_INTERVAL), e(this, "sendPing", () => {
8903
8906
  if (this.isPingInFlight) {
8904
- this.missedPings++, this.missedPings > r.MAX_MISSED_PINGS && this.reconnect("missed pings");
8907
+ this.missedPings++, this.missedPings > r.MAX_MISSED_PINGS && this.closeUnlessConnecting("missed pings") && this.emitter.emit("ping timeout");
8905
8908
  return;
8906
8909
  }
8907
8910
  this.isPingInFlight = !0, this.lastPingSentTime = performance.now(), this.missedPings = 0, this.sendSignal({ type: "ping" });
@@ -11024,6 +11027,8 @@ var ox, sx = () => ({
11024
11027
  this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("media delivery resumed", this.onMediaDeliveryResumed), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("connection state", this.onConnectionState), this.suspend();
11025
11028
  }), e(this, "suspend", () => {
11026
11029
  this.isSuspended = !0, this.timers.unload(), this.bufferFullness.clear(), this.bufferFullnessRegression = void 0, this.stopBuffering(), this.unsetActive(), this.hasPlayedInSession = !1;
11030
+ }), e(this, "reset", () => {
11031
+ this.bufferFullness.clear(), this.bufferFullnessRegression = void 0;
11027
11032
  }), e(this, "unsuspend", () => {
11028
11033
  this.isSuspended = !1, this.currentLevel && this.setActive();
11029
11034
  }), e(this, "fatalQosGraceTime", () => 1e4 * (this.fatalQosCount + 1)), e(this, "incrementFatalQosCount", () => {
@@ -12205,7 +12210,7 @@ var Vx = class {
12205
12210
  if ((s || c) && (o.modules.bufferTime.updateConfig({
12206
12211
  minBufferTime: o.options.get("minBufferTime", o.channelId),
12207
12212
  maxBufferTime: o.options.get("maxBufferTime", o.channelId)
12208
- }), o.targetBufferTime = o.options.get("minBufferTime", o.channelId)), o.applyBurstEnabled(o.channelId), o.emit("is live", i.isLive), !i.isLive) throw Zn();
12213
+ }), o.modules.adaptivity.updateConfig({ cooldownTime: Math.max(o.options.get("minBufferTime", o.channelId), 2e3) }), o.targetBufferTime = o.options.get("minBufferTime", o.channelId)), o.applyBurstEnabled(o.channelId), o.emit("is live", i.isLive), !i.isLive) throw Zn();
12209
12214
  let l = o.modules.connection.estimatedBandwidth;
12210
12215
  o.patchSubscription(i, l), yield o.initializeDecodingModule(), o.resetModules(), o.emit("rendition levels", o.modules.renditions.getRenditionLevels()), o.emit("channels", o.channels), o.emitLanguagesIfChanged(), o.sampleProcessingSesssions.clear();
12211
12216
  let u = o.options.get("burstEnabled", o.channelId) && o.burstFits(l);
@@ -12224,7 +12229,16 @@ var Vx = class {
12224
12229
  return function(t) {
12225
12230
  return e.apply(this, arguments);
12226
12231
  };
12227
- }()), e(this, "emitLanguagesIfChanged", () => {
12232
+ }()), e(this, "stepDownForRejoin", () => {
12233
+ var e;
12234
+ let t = this.targetSubscription, n = (e = this.modules.renditions.getRenditionLevel()) == null || (e = e.video) == null ? void 0 : e.bitRate;
12235
+ if (!this.abrEnabled || n === void 0 || t.channelId !== this.currentSubscription.channelId) return;
12236
+ let r = t.video.bitRate !== void 0 && t.video.bitRate > n, i = this.modules.renditions.getRenditionLevels(t).filter((e) => e.video && (r ? e.video.bitRate <= n : e.video.bitRate < n)).pop();
12237
+ !(i != null && i.video) || t.video.bitRate !== void 0 && t.video.bitRate <= i.video.bitRate || (this.logger.info("Stepping down a level for the rejoin after a ping timeout", { to: i }), this.alignSizeAndBitRate(y(y({}, t), {}, {
12238
+ video: y(y({}, t.video), i.video),
12239
+ audio: y(y({}, t.audio), i.audio)
12240
+ })), this.emitter.emit("adapted level"));
12241
+ }), e(this, "emitLanguagesIfChanged", () => {
12228
12242
  let e = this.modules.renditions.getLanguages(), t = this.latestEmittedLanguages;
12229
12243
  e.length === t.length && e.every((e) => t.includes(e)) || (this.logger.debug("Emitting new languages", { currentLanguages: e }), this.latestEmittedLanguages = e, this.emit("languages", this.latestEmittedLanguages));
12230
12244
  }), e(this, "updateTextTracks", (e) => {
@@ -12478,7 +12492,7 @@ var Vx = class {
12478
12492
  }), e(this, "resetModules", () => {
12479
12493
  Object.values(this.modules).forEach((e) => {
12480
12494
  e && "reset" in e && e.reset();
12481
- }), this.playbackSource instanceof dc && this.modules.adaptivity.reset(aS), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12495
+ }), this.playbackSource instanceof dc && this.modules.adaptivity.holdReconnect(aS), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
12482
12496
  }), e(this, "disconnectForInactivePage", (e) => {
12483
12497
  if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
12484
12498
  var t;
@@ -12512,7 +12526,7 @@ var Vx = class {
12512
12526
  let e = this.modules.canvasModule instanceof Vb ? !0 : void 0;
12513
12527
  return y({
12514
12528
  uptime: this.uptime,
12515
- version: "4.7.2-7-gbceb2a43",
12529
+ version: "4.7.2-9-g1ada5e22",
12516
12530
  clientId: this.clientId,
12517
12531
  sessionId: this.sessionId,
12518
12532
  channelId: this.channelId,
@@ -12763,7 +12777,7 @@ var Vx = class {
12763
12777
  video: y(y({}, this.targetSubscription.video), d == null ? void 0 : d.video),
12764
12778
  audio: y(y({}, this.targetSubscription.audio), d == null ? void 0 : d.audio)
12765
12779
  })), this.emitter.emit("adapted level");
12766
- }), this.emitter.on("text track data", (e) => {
12780
+ }), this.emitter.on("ping timeout", this.stepDownForRejoin), this.emitter.on("text track data", (e) => {
12767
12781
  let t = s(cS, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(sS, this);
12768
12782
  if (a(sS, this, n), t) {
12769
12783
  if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
@@ -1,5 +1,5 @@
1
1
  import { n as e, t } from "./BsfwXDui.js";
2
- import { C as n, D as r, E as i, O as a, S as o, T as s, _ as c, b as l, g as u, h as d, k as f, m as ee, p as te, t as ne, v as re, w as ie, x as ae, y as oe } from "./B7f7kAZQ.js";
2
+ import { C as n, D as r, E as i, O as a, S as o, T as s, _ as c, b as l, g as u, h as d, k as f, m as ee, p as te, t as ne, v as re, w as ie, x as ae, y as oe } from "./C4kCMnHV.js";
3
3
  import { t as se } from "./CuYn2z5X.js";
4
4
  import { i as p, n as m, r as h, t as g } from "./DSw1XhvD.js";
5
5
  import { c as ce, n as le, t as ue } from "./D40eQS8l.js";
package/core.d.ts CHANGED
@@ -1564,6 +1564,11 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1564
1564
  */
1565
1565
  getCastOptions: () => Options;
1566
1566
  private onConnectInfo;
1567
+ /**
1568
+ * The connection closed because media queued ahead of the pong for seconds, so the current level doesn't fit the
1569
+ * link. Lower the target below it before the rejoin, which otherwise asks for the same quality again.
1570
+ */
1571
+ private stepDownForRejoin;
1567
1572
  private emitLanguagesIfChanged;
1568
1573
  private updateTextTracks;
1569
1574
  private cleanupTextTracks;
package/core.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, o, r as s, s as c, t as l, u } from "./B7f7kAZQ.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, o, r as s, s as c, t as l, u } from "./C4kCMnHV.js";
2
2
  export { s as AUTHENTICATION_EXPIRED_CODE, i as AUTHENTICATION_FAILED_CODE, e as CHANNEL_NOT_FOUND_CODE, o as CHANNEL_NOT_LIVE_CODE, c as CONNECTION_FAILED_AFTER_RETRIES_CODE, t as CONNECTION_FAILED_CODE, a as DISCONNECTED_BY_EDGE, u as INACTIVITY_CODE, n as NO_INCOMING_DATA, l as Vindral, r as VindralError };
package/legacy.d.ts CHANGED
@@ -1579,6 +1579,11 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1579
1579
  */
1580
1580
  getCastOptions: () => Options;
1581
1581
  private onConnectInfo;
1582
+ /**
1583
+ * The connection closed because media queued ahead of the pong for seconds, so the current level doesn't fit the
1584
+ * link. Lower the target below it before the rejoin, which otherwise asks for the same quality again.
1585
+ */
1586
+ private stepDownForRejoin;
1582
1587
  private emitLanguagesIfChanged;
1583
1588
  private updateTextTracks;
1584
1589
  private cleanupTextTracks;
package/legacy.es.js CHANGED
@@ -4870,7 +4870,7 @@ var su, cu = .15, lu = .2, uu = .4, du = .5, fu = .6, pu = 1800, mu = {
4870
4870
  maxCooldownRatio: 2
4871
4871
  }, hu = (e) => (t) => t > e, gu = class {
4872
4872
  constructor(e, t, n, r, i) {
4873
- p(this, "qualityOfServiceSource", void 0), p(this, "incomingDataSource", void 0), p(this, "config", void 0), p(this, "emitter", void 0), p(this, "logger", void 0), p(this, "isSuspended", !1), p(this, "lastAdaptTime", performance.now()), p(this, "isEnabled", !0), p(this, "load", () => {
4873
+ p(this, "qualityOfServiceSource", void 0), p(this, "incomingDataSource", void 0), p(this, "config", void 0), p(this, "emitter", void 0), p(this, "logger", void 0), p(this, "isSuspended", !1), p(this, "lastAdaptTime", performance.now()), p(this, "reconnectHoldUntil", -Infinity), p(this, "isEnabled", !0), p(this, "load", () => {
4874
4874
  this.emitter.on("buffer state", this.onBufferState), this.emitter.on("adapted level", this.onAdaptedLevel);
4875
4875
  }), p(this, "unload", () => {
4876
4876
  this.emitter.off("buffer state", this.onBufferState), this.emitter.off("adapted level", this.onAdaptedLevel);
@@ -4880,6 +4880,8 @@ var su, cu = .15, lu = .2, uu = .4, du = .5, fu = .6, pu = 1800, mu = {
4880
4880
  this.reset(), this.isSuspended = !1;
4881
4881
  }), p(this, "reset", (e = 0) => {
4882
4882
  this.lastAdaptTime = performance.now() + e;
4883
+ }), p(this, "holdReconnect", (e) => {
4884
+ this.reconnectHoldUntil = performance.now() + e;
4883
4885
  }), p(this, "getStatistics", () => ({ isAbrEnabled: this.isEnabled })), p(this, "isQoSOk", (e) => {
4884
4886
  let t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: n, downgradesFromLevel: r } = t == null ? {
4885
4887
  upgradesFromLevel: [],
@@ -4906,7 +4908,7 @@ var su, cu = .15, lu = .2, uu = .4, du = .5, fu = .6, pu = 1800, mu = {
4906
4908
  }), p(this, "onBufferState", (e) => {
4907
4909
  if (!this.isEnabled || this.isSuspended || this.lastAdaptTime + this.config.cooldownTime > performance.now()) return;
4908
4910
  let { bufferFullness: t, general: n } = this.qualityOfServiceSource.getMetrics(), r = this.qualityOfServiceSource.getBufferFullnessRegression(), i = 10 * 1e3, a = 30 * 1e3, o = this.qualityOfServiceSource.timeSpentBufferingLast(a), s = this.qualityOfServiceSource.timeSpentActiveLast(a), c = this.qualityOfServiceSource.bufferingEventsLast(a), l = s > 0 ? o / s : 0, u = this.qualityOfServiceSource.getTargetBufferTime();
4909
- if (t < .15 && l > .8) {
4911
+ if (t < .15 && l > .8 && performance.now() >= this.reconnectHoldUntil) {
4910
4912
  this.adaptLevel("reconnect");
4911
4913
  return;
4912
4914
  }
@@ -4931,6 +4933,9 @@ var su, cu = .15, lu = .2, uu = .4, du = .5, fu = .6, pu = 1800, mu = {
4931
4933
  this.reset();
4932
4934
  }), p(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e)), this.qualityOfServiceSource = n, this.incomingDataSource = r, this.config = L(L({}, mu), i), this.emitter = e, this.logger = t;
4933
4935
  }
4936
+ updateConfig(e) {
4937
+ this.config = L(L({}, this.config), e);
4938
+ }
4934
4939
  tooMuchTimeBuffering(e) {
4935
4940
  let t = this.qualityOfServiceSource.timeSpentActiveLast(e);
4936
4941
  return (t ? this.qualityOfServiceSource.timeSpentBufferingLast(e) / t : 0) > this.config.maxBufferingRatio.last10Seconds;
@@ -9785,7 +9790,9 @@ var Sx, Cx = 65536 * 8, wx = .9, Tx = 40, Ex = (e) => {
9785
9790
  connectionProtocol: "vindral_ws",
9786
9791
  transportSelectionReason: void 0
9787
9792
  })), p(this, "onMessage", (e) => {
9788
- if (this.pingCooldownExpired() && this.sendPing(), this.isContextSwitchInProgress) {
9793
+ this.routeMessage(e), this.pingCooldownExpired() && this.sendPing();
9794
+ }), p(this, "routeMessage", (e) => {
9795
+ if (this.isContextSwitchInProgress) {
9789
9796
  if (e instanceof ArrayBuffer) {
9790
9797
  this.dataBuffer.push(e);
9791
9798
  return;
@@ -9863,16 +9870,12 @@ var Sx, Cx = 65536 * 8, wx = .9, Tx = 40, Ex = (e) => {
9863
9870
  }
9864
9871
  this.emitter.emit("connection state", this.getState());
9865
9872
  }), p(this, "reconnect", (e) => {
9866
- if (this.transport.isConnectInProgress) {
9867
- this.logger.debug("Stopping reconnect, already mid-connection");
9868
- return;
9869
- }
9870
- this.close(e);
9871
- }), p(this, "resetPingState", () => {
9873
+ this.closeUnlessConnecting(e);
9874
+ }), p(this, "closeUnlessConnecting", (e) => this.transport.isConnectInProgress ? (this.logger.debug("Stopping reconnect, already mid-connection"), !1) : (this.close(e), !0)), p(this, "resetPingState", () => {
9872
9875
  this.missedPings = 0, this.isPingInFlight = !1;
9873
9876
  }), p(this, "pingCooldownExpired", () => performance.now() - this.lastPingSentTime > e.PING_INTERVAL), p(this, "sendPing", () => {
9874
9877
  if (this.isPingInFlight) {
9875
- this.missedPings++, this.missedPings > e.MAX_MISSED_PINGS && this.reconnect("missed pings");
9878
+ this.missedPings++, this.missedPings > e.MAX_MISSED_PINGS && this.closeUnlessConnecting("missed pings") && this.emitter.emit("ping timeout");
9876
9879
  return;
9877
9880
  }
9878
9881
  this.isPingInFlight = !0, this.lastPingSentTime = performance.now(), this.missedPings = 0, this.sendSignal({ type: "ping" });
@@ -12600,6 +12603,8 @@ var YC, XC = () => ({
12600
12603
  this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("media delivery resumed", this.onMediaDeliveryResumed), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("connection state", this.onConnectionState), this.suspend();
12601
12604
  }), p(this, "suspend", () => {
12602
12605
  this.isSuspended = !0, this.timers.unload(), this.bufferFullness.clear(), this.bufferFullnessRegression = void 0, this.stopBuffering(), this.unsetActive(), this.hasPlayedInSession = !1;
12606
+ }), p(this, "reset", () => {
12607
+ this.bufferFullness.clear(), this.bufferFullnessRegression = void 0;
12603
12608
  }), p(this, "unsuspend", () => {
12604
12609
  this.isSuspended = !1, this.currentLevel && this.setActive();
12605
12610
  }), p(this, "fatalQosGraceTime", () => 1e4 * (this.fatalQosCount + 1)), p(this, "incrementFatalQosCount", () => {
@@ -13789,7 +13794,7 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
13789
13794
  if ((o || s) && (n.modules.bufferTime.updateConfig({
13790
13795
  minBufferTime: n.options.get("minBufferTime", n.channelId),
13791
13796
  maxBufferTime: n.options.get("maxBufferTime", n.channelId)
13792
- }), n.targetBufferTime = n.options.get("minBufferTime", n.channelId)), n.applyBurstEnabled(n.channelId), n.emit("is live", i.isLive), !i.isLive) throw Gi();
13797
+ }), n.modules.adaptivity.updateConfig({ cooldownTime: Math.max(n.options.get("minBufferTime", n.channelId), 2e3) }), n.targetBufferTime = n.options.get("minBufferTime", n.channelId)), n.applyBurstEnabled(n.channelId), n.emit("is live", i.isLive), !i.isLive) throw Gi();
13793
13798
  let c = n.modules.connection.estimatedBandwidth;
13794
13799
  n.patchSubscription(i, c), yield n.initializeDecodingModule(), n.resetModules(), n.emit("rendition levels", n.modules.renditions.getRenditionLevels()), n.emit("channels", n.channels), n.emitLanguagesIfChanged(), n.sampleProcessingSesssions.clear();
13795
13800
  let l = n.options.get("burstEnabled", n.channelId) && n.burstFits(c);
@@ -13808,7 +13813,16 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
13808
13813
  return function(t) {
13809
13814
  return e.apply(this, arguments);
13810
13815
  };
13811
- }()), p(this, "emitLanguagesIfChanged", () => {
13816
+ }()), p(this, "stepDownForRejoin", () => {
13817
+ var e;
13818
+ let t = this.targetSubscription, n = (e = this.modules.renditions.getRenditionLevel()) == null || (e = e.video) == null ? void 0 : e.bitRate;
13819
+ if (!this.abrEnabled || n === void 0 || t.channelId !== this.currentSubscription.channelId) return;
13820
+ let r = t.video.bitRate !== void 0 && t.video.bitRate > n, i = this.modules.renditions.getRenditionLevels(t).filter((e) => e.video && (r ? e.video.bitRate <= n : e.video.bitRate < n)).pop();
13821
+ !(i != null && i.video) || t.video.bitRate !== void 0 && t.video.bitRate <= i.video.bitRate || (this.logger.info("Stepping down a level for the rejoin after a ping timeout", { to: i }), this.alignSizeAndBitRate(L(L({}, t), {}, {
13822
+ video: L(L({}, t.video), i.video),
13823
+ audio: L(L({}, t.audio), i.audio)
13824
+ })), this.emitter.emit("adapted level"));
13825
+ }), p(this, "emitLanguagesIfChanged", () => {
13812
13826
  let e = this.modules.renditions.getLanguages(), t = this.latestEmittedLanguages;
13813
13827
  e.length === t.length && e.every((e) => t.includes(e)) || (this.logger.debug("Emitting new languages", { currentLanguages: e }), this.latestEmittedLanguages = e, this.emit("languages", this.latestEmittedLanguages));
13814
13828
  }), p(this, "updateTextTracks", (e) => {
@@ -14062,7 +14076,7 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
14062
14076
  }), p(this, "resetModules", () => {
14063
14077
  Object.values(this.modules).forEach((e) => {
14064
14078
  e && "reset" in e && e.reset();
14065
- }), this.playbackSource instanceof ru && this.modules.adaptivity.reset(Jw), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
14079
+ }), this.playbackSource instanceof ru && this.modules.adaptivity.holdReconnect(Jw), this.sampleProcessingSesssions.clear(), this.cleanupTextTracks(Infinity), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
14066
14080
  }), p(this, "disconnectForInactivePage", (e) => {
14067
14081
  if (this.clearInactivityDisconnect(), this.emitter.emit("flush buffers"), !this.isBackgroundPlayEnabled(this.channelId)) {
14068
14082
  var t;
@@ -14096,7 +14110,7 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
14096
14110
  let e = this.modules.canvasModule instanceof AC ? !0 : void 0;
14097
14111
  return L({
14098
14112
  uptime: this.uptime,
14099
- version: "4.7.2-7-gbceb2a43",
14113
+ version: "4.7.2-9-g1ada5e22",
14100
14114
  clientId: this.clientId,
14101
14115
  sessionId: this.sessionId,
14102
14116
  channelId: this.channelId,
@@ -14347,7 +14361,7 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
14347
14361
  video: L(L({}, this.targetSubscription.video), d == null ? void 0 : d.video),
14348
14362
  audio: L(L({}, this.targetSubscription.audio), d == null ? void 0 : d.audio)
14349
14363
  })), this.emitter.emit("adapted level");
14350
- }), this.emitter.on("text track data", (e) => {
14364
+ }), this.emitter.on("ping timeout", this.stepDownForRejoin), this.emitter.on("text track data", (e) => {
14351
14365
  let t = j(Zw, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - j(Xw, this);
14352
14366
  if (k(Xw, this, n), t) {
14353
14367
  if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;