@vindral/web-sdk 4.7.2-8-gde5e8235 → 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.
@@ -8819,7 +8819,9 @@ var iy = /* @__PURE__ */ function(e) {
8819
8819
  connectionProtocol: "vindral_ws",
8820
8820
  transportSelectionReason: void 0
8821
8821
  })), e(this, "onMessage", (e) => {
8822
- if (this.pingCooldownExpired() && this.sendPing(), this.isContextSwitchInProgress) {
8822
+ this.routeMessage(e), this.pingCooldownExpired() && this.sendPing();
8823
+ }), e(this, "routeMessage", (e) => {
8824
+ if (this.isContextSwitchInProgress) {
8823
8825
  if (e instanceof ArrayBuffer) {
8824
8826
  this.dataBuffer.push(e);
8825
8827
  return;
@@ -8897,16 +8899,12 @@ var iy = /* @__PURE__ */ function(e) {
8897
8899
  }
8898
8900
  this.emitter.emit("connection state", this.getState());
8899
8901
  }), e(this, "reconnect", (e) => {
8900
- if (this.transport.isConnectInProgress) {
8901
- this.logger.debug("Stopping reconnect, already mid-connection");
8902
- return;
8903
- }
8904
- this.close(e);
8905
- }), 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", () => {
8906
8904
  this.missedPings = 0, this.isPingInFlight = !1;
8907
8905
  }), e(this, "pingCooldownExpired", () => performance.now() - this.lastPingSentTime > r.PING_INTERVAL), e(this, "sendPing", () => {
8908
8906
  if (this.isPingInFlight) {
8909
- 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");
8910
8908
  return;
8911
8909
  }
8912
8910
  this.isPingInFlight = !0, this.lastPingSentTime = performance.now(), this.missedPings = 0, this.sendSignal({ type: "ping" });
@@ -12231,7 +12229,16 @@ var Vx = class {
12231
12229
  return function(t) {
12232
12230
  return e.apply(this, arguments);
12233
12231
  };
12234
- }()), 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", () => {
12235
12242
  let e = this.modules.renditions.getLanguages(), t = this.latestEmittedLanguages;
12236
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));
12237
12244
  }), e(this, "updateTextTracks", (e) => {
@@ -12519,7 +12526,7 @@ var Vx = class {
12519
12526
  let e = this.modules.canvasModule instanceof Vb ? !0 : void 0;
12520
12527
  return y({
12521
12528
  uptime: this.uptime,
12522
- version: "4.7.2-8-gde5e8235",
12529
+ version: "4.7.2-9-g1ada5e22",
12523
12530
  clientId: this.clientId,
12524
12531
  sessionId: this.sessionId,
12525
12532
  channelId: this.channelId,
@@ -12770,7 +12777,7 @@ var Vx = class {
12770
12777
  video: y(y({}, this.targetSubscription.video), d == null ? void 0 : d.video),
12771
12778
  audio: y(y({}, this.targetSubscription.audio), d == null ? void 0 : d.audio)
12772
12779
  })), this.emitter.emit("adapted level");
12773
- }), this.emitter.on("text track data", (e) => {
12780
+ }), this.emitter.on("ping timeout", this.stepDownForRejoin), this.emitter.on("text track data", (e) => {
12774
12781
  let t = s(cS, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - s(sS, this);
12775
12782
  if (a(sS, this, n), t) {
12776
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 "./BfOOuD-G.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 "./BfOOuD-G.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
@@ -9790,7 +9790,9 @@ var Sx, Cx = 65536 * 8, wx = .9, Tx = 40, Ex = (e) => {
9790
9790
  connectionProtocol: "vindral_ws",
9791
9791
  transportSelectionReason: void 0
9792
9792
  })), p(this, "onMessage", (e) => {
9793
- if (this.pingCooldownExpired() && this.sendPing(), this.isContextSwitchInProgress) {
9793
+ this.routeMessage(e), this.pingCooldownExpired() && this.sendPing();
9794
+ }), p(this, "routeMessage", (e) => {
9795
+ if (this.isContextSwitchInProgress) {
9794
9796
  if (e instanceof ArrayBuffer) {
9795
9797
  this.dataBuffer.push(e);
9796
9798
  return;
@@ -9868,16 +9870,12 @@ var Sx, Cx = 65536 * 8, wx = .9, Tx = 40, Ex = (e) => {
9868
9870
  }
9869
9871
  this.emitter.emit("connection state", this.getState());
9870
9872
  }), p(this, "reconnect", (e) => {
9871
- if (this.transport.isConnectInProgress) {
9872
- this.logger.debug("Stopping reconnect, already mid-connection");
9873
- return;
9874
- }
9875
- this.close(e);
9876
- }), 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", () => {
9877
9875
  this.missedPings = 0, this.isPingInFlight = !1;
9878
9876
  }), p(this, "pingCooldownExpired", () => performance.now() - this.lastPingSentTime > e.PING_INTERVAL), p(this, "sendPing", () => {
9879
9877
  if (this.isPingInFlight) {
9880
- 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");
9881
9879
  return;
9882
9880
  }
9883
9881
  this.isPingInFlight = !0, this.lastPingSentTime = performance.now(), this.missedPings = 0, this.sendSignal({ type: "ping" });
@@ -13815,7 +13813,16 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
13815
13813
  return function(t) {
13816
13814
  return e.apply(this, arguments);
13817
13815
  };
13818
- }()), 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", () => {
13819
13826
  let e = this.modules.renditions.getLanguages(), t = this.latestEmittedLanguages;
13820
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));
13821
13828
  }), p(this, "updateTextTracks", (e) => {
@@ -14103,7 +14110,7 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
14103
14110
  let e = this.modules.canvasModule instanceof AC ? !0 : void 0;
14104
14111
  return L({
14105
14112
  uptime: this.uptime,
14106
- version: "4.7.2-8-gde5e8235",
14113
+ version: "4.7.2-9-g1ada5e22",
14107
14114
  clientId: this.clientId,
14108
14115
  sessionId: this.sessionId,
14109
14116
  channelId: this.channelId,
@@ -14354,7 +14361,7 @@ var Jw = 1e4, Yw = 1280 * 720, Xw = /* @__PURE__ */ new WeakMap(), Zw = /* @__PU
14354
14361
  video: L(L({}, this.targetSubscription.video), d == null ? void 0 : d.video),
14355
14362
  audio: L(L({}, this.targetSubscription.audio), d == null ? void 0 : d.audio)
14356
14363
  })), this.emitter.emit("adapted level");
14357
- }), this.emitter.on("text track data", (e) => {
14364
+ }), this.emitter.on("ping timeout", this.stepDownForRejoin), this.emitter.on("text track data", (e) => {
14358
14365
  let t = j(Zw, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - j(Xw, this);
14359
14366
  if (k(Xw, this, n), t) {
14360
14367
  if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;