@vindral/web-sdk 4.2.1-7-g15dd6d62 → 4.2.1-9-gb6e43bd0

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.
@@ -7999,11 +7999,17 @@ var Mg = /* @__PURE__ */ new WeakMap(), Ng = /* @__PURE__ */ new WeakMap(), Pg =
7999
7999
  throw o.emitter.emit("error", te(e instanceof Error ? e : void 0)), e;
8000
8000
  }
8001
8001
  })), v(this, Kg, t(function* () {
8002
- let e = Date.now(), t = () => Date.now() - e, r = globalThis.AbortController ? new AbortController() : void 0, i = fetch(new URL("/api/v4/connect/ping", o.config.options.get("url")).toString(), {
8003
- method: "HEAD",
8004
- signal: r == null ? void 0 : r.signal
8005
- }).then(() => t(), () => void 0);
8006
- return Promise.race([mn(n.PING_TIMEOUT).then(() => (r == null || r.abort(), t())), i]);
8002
+ let e = Date.now(), t = () => Date.now() - e, r = globalThis.AbortController ? new AbortController() : void 0, i = setTimeout(() => r == null ? void 0 : r.abort(), n.PING_TIMEOUT);
8003
+ try {
8004
+ return yield fetch(new URL("/api/v4/connect/ping", o.config.options.get("url")).toString(), {
8005
+ method: "HEAD",
8006
+ signal: r == null ? void 0 : r.signal
8007
+ }), t();
8008
+ } catch (e) {
8009
+ return r != null && r.signal.aborted ? t() : void 0;
8010
+ } finally {
8011
+ clearTimeout(i);
8012
+ }
8007
8013
  })), this.logger = i, this.emitter = r, this.config = a, this.apiClient = new ge({
8008
8014
  publicEndpoint: this.config.options.get("url").toString(),
8009
8015
  tokenFactory: () => this.config.options.get("authenticationToken")
@@ -9288,9 +9294,16 @@ var H_ = class {
9288
9294
  });
9289
9295
  this.trackContexts.set(n, r);
9290
9296
  });
9291
- }), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "setSourceBuffers", function() {
9297
+ }), e(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), e(this, "initializeSourceBuffer", (e, t) => {
9298
+ let n = B_(e, {
9299
+ mimeType: t.mimeType,
9300
+ mediaSource: this.mediaSource,
9301
+ codec: t.codec
9302
+ });
9303
+ n.sourceBuffer.setErrorCallback(this.onSourceBufferError(t.type)), this.trackContexts.set(t.type, n);
9304
+ }), e(this, "setSourceBuffers", function() {
9292
9305
  var e = t(function* (e) {
9293
- if (u.mediaSource.isClosed()) {
9306
+ if (!u.mediaSource.isOpen()) {
9294
9307
  u.pendingTracksToAddSourceBuffers = e;
9295
9308
  return;
9296
9309
  }
@@ -9308,19 +9321,32 @@ var H_ = class {
9308
9321
  return;
9309
9322
  }
9310
9323
  for (let t of e) {
9311
- let e = u.trackContexts.get(t.type);
9312
- if (e || (e = V_({
9324
+ let n = u.trackContexts.get(t.type);
9325
+ if (n || (n = V_({
9313
9326
  pendingSamples: [],
9314
9327
  initSegments: new z_()
9315
- }), u.trackContexts.set(t.type, e)), e.state === "initialized") t.mimeType !== e.sourceBufferMimeType && (yield e.sourceBuffer.changeType(t.mimeType), e.sourceBufferMimeType = t.mimeType);
9316
- else {
9317
- let n = B_(e, {
9318
- mimeType: t.mimeType,
9319
- mediaSource: u.mediaSource,
9320
- codec: t.codec
9321
- });
9322
- n.sourceBuffer.setErrorCallback(u.onSourceBufferError(t.type)), u.trackContexts.set(t.type, n);
9323
- }
9328
+ }), u.trackContexts.set(t.type, n)), n.state === "initialized") {
9329
+ if (t.mimeType !== n.sourceBufferMimeType) try {
9330
+ yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
9331
+ } catch (r) {
9332
+ u.logger.warn("changeType failed, recreating source buffer", {
9333
+ from: n.sourceBufferMimeType,
9334
+ to: t.mimeType,
9335
+ error: r
9336
+ });
9337
+ try {
9338
+ u.mediaSource.removeSourceBuffer(n.sourceBuffer);
9339
+ } catch (t) {
9340
+ u.logger.warn("removeSourceBuffer failed", { removeError: t }), u.reopenMediaSource("changeType recovery failed"), u.pendingTracksToAddSourceBuffers = e;
9341
+ return;
9342
+ }
9343
+ let i = V_({
9344
+ pendingSamples: n.pendingSamples,
9345
+ initSegments: n.initSegments
9346
+ });
9347
+ i.pendingSamplesOffset = n.pendingSamplesOffset, u.initializeSourceBuffer(i, t);
9348
+ }
9349
+ } else u.initializeSourceBuffer(n, t);
9324
9350
  }
9325
9351
  });
9326
9352
  return function(t) {
@@ -10892,7 +10918,7 @@ var Tv = class {
10892
10918
  let e = this.modules.canvasModule instanceof A_ ? !0 : void 0;
10893
10919
  return C({
10894
10920
  uptime: Date.now() - this.createdAt,
10895
- version: "4.2.1-7-g15dd6d62",
10921
+ version: "4.2.1-9-gb6e43bd0",
10896
10922
  clientId: this.clientId,
10897
10923
  sessionId: this.sessionId,
10898
10924
  channelId: this.channelId,
@@ -1,5 +1,5 @@
1
1
  import { n as e, t } from "./BsfwXDui.js";
2
- import { _ as n, a as r, c as i, d as a, f as o, g as s, h as c, i as ee, l, m as te, n as u, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as ce } from "./CAI1oAka.js";
2
+ import { _ as n, a as r, c as i, d as a, f as o, g as s, h as c, i as ee, l, m as te, n as u, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as ce } from "./BN75TaoN.js";
3
3
  import { M as le } from "./C01DcfYu.js";
4
4
  import { a as d, i as f, n as p, r as m, t as h } from "./B7hT-BKr.js";
5
5
  import { n as ue, t as de } from "./DeYmk5AL.js";
package/core.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./CAI1oAka.js";
1
+ import { t as e } from "./BN75TaoN.js";
2
2
  import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, u as l } from "./C01DcfYu.js";
3
3
  export { a as AUTHENTICATION_EXPIRED_CODE, s as AUTHENTICATION_FAILED_CODE, r as CHANNEL_NOT_FOUND_CODE, t as CONNECTION_FAILED_AFTER_RETRIES_CODE, o as CONNECTION_FAILED_CODE, c as DISCONNECTED_BY_EDGE, n as INACTIVITY_CODE, i as NO_INCOMING_DATA, e as Vindral, l as VindralError };
package/legacy.es.js CHANGED
@@ -8911,11 +8911,17 @@ var Xv, Zv = /* @__PURE__ */ new WeakMap(), Qv = /* @__PURE__ */ new WeakMap(),
8911
8911
  throw i.emitter.emit("error", gi(e instanceof Error ? e : void 0)), e;
8912
8912
  }
8913
8913
  })), w(this, oy, M(function* () {
8914
- let t = Date.now(), n = () => Date.now() - t, r = globalThis.AbortController ? new AbortController() : void 0, a = fetch(new URL("/api/v4/connect/ping", i.config.options.get("url")).toString(), {
8915
- method: "HEAD",
8916
- signal: r == null ? void 0 : r.signal
8917
- }).then(() => n(), () => void 0);
8918
- return Promise.race([nr(e.PING_TIMEOUT).then(() => (r == null || r.abort(), n())), a]);
8914
+ let t = Date.now(), n = () => Date.now() - t, r = globalThis.AbortController ? new AbortController() : void 0, a = setTimeout(() => r == null ? void 0 : r.abort(), e.PING_TIMEOUT);
8915
+ try {
8916
+ return yield fetch(new URL("/api/v4/connect/ping", i.config.options.get("url")).toString(), {
8917
+ method: "HEAD",
8918
+ signal: r == null ? void 0 : r.signal
8919
+ }), n();
8920
+ } catch (e) {
8921
+ return r != null && r.signal.aborted ? n() : void 0;
8922
+ } finally {
8923
+ clearTimeout(a);
8924
+ }
8919
8925
  })), this.logger = n, this.emitter = t, this.config = r, this.apiClient = new Ol({
8920
8926
  publicEndpoint: this.config.options.get("url").toString(),
8921
8927
  tokenFactory: () => this.config.options.get("authenticationToken")
@@ -10777,9 +10783,16 @@ var Ab = class {
10777
10783
  });
10778
10784
  this.trackContexts.set(n, r);
10779
10785
  });
10780
- }), p(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), p(this, "setSourceBuffers", function() {
10786
+ }), p(this, "isCurrentTrackContext", (e, t) => this.trackContexts.get(e) === t), p(this, "initializeSourceBuffer", (e, t) => {
10787
+ let n = Ob(e, {
10788
+ mimeType: t.mimeType,
10789
+ mediaSource: this.mediaSource,
10790
+ codec: t.codec
10791
+ });
10792
+ n.sourceBuffer.setErrorCallback(this.onSourceBufferError(t.type)), this.trackContexts.set(t.type, n);
10793
+ }), p(this, "setSourceBuffers", function() {
10781
10794
  var e = M(function* (e) {
10782
- if (r.mediaSource.isClosed()) {
10795
+ if (!r.mediaSource.isOpen()) {
10783
10796
  r.pendingTracksToAddSourceBuffers = e;
10784
10797
  return;
10785
10798
  }
@@ -10797,19 +10810,32 @@ var Ab = class {
10797
10810
  return;
10798
10811
  }
10799
10812
  for (let t of e) {
10800
- let e = r.trackContexts.get(t.type);
10801
- if (e || (e = kb({
10813
+ let n = r.trackContexts.get(t.type);
10814
+ if (n || (n = kb({
10802
10815
  pendingSamples: [],
10803
10816
  initSegments: new Db()
10804
- }), r.trackContexts.set(t.type, e)), e.state === "initialized") t.mimeType !== e.sourceBufferMimeType && (yield e.sourceBuffer.changeType(t.mimeType), e.sourceBufferMimeType = t.mimeType);
10805
- else {
10806
- let n = Ob(e, {
10807
- mimeType: t.mimeType,
10808
- mediaSource: r.mediaSource,
10809
- codec: t.codec
10810
- });
10811
- n.sourceBuffer.setErrorCallback(r.onSourceBufferError(t.type)), r.trackContexts.set(t.type, n);
10812
- }
10817
+ }), r.trackContexts.set(t.type, n)), n.state === "initialized") {
10818
+ if (t.mimeType !== n.sourceBufferMimeType) try {
10819
+ yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
10820
+ } catch (i) {
10821
+ r.logger.warn("changeType failed, recreating source buffer", {
10822
+ from: n.sourceBufferMimeType,
10823
+ to: t.mimeType,
10824
+ error: i
10825
+ });
10826
+ try {
10827
+ r.mediaSource.removeSourceBuffer(n.sourceBuffer);
10828
+ } catch (t) {
10829
+ r.logger.warn("removeSourceBuffer failed", { removeError: t }), r.reopenMediaSource("changeType recovery failed"), r.pendingTracksToAddSourceBuffers = e;
10830
+ return;
10831
+ }
10832
+ let a = kb({
10833
+ pendingSamples: n.pendingSamples,
10834
+ initSegments: n.initSegments
10835
+ });
10836
+ a.pendingSamplesOffset = n.pendingSamplesOffset, r.initializeSourceBuffer(a, t);
10837
+ }
10838
+ } else r.initializeSourceBuffer(n, t);
10813
10839
  }
10814
10840
  });
10815
10841
  return function(t) {
@@ -12385,7 +12411,7 @@ var Ex = /* @__PURE__ */ new WeakMap(), Dx = /* @__PURE__ */ new WeakMap(), Ox =
12385
12411
  let e = this.modules.canvasModule instanceof vb ? !0 : void 0;
12386
12412
  return R({
12387
12413
  uptime: Date.now() - this.createdAt,
12388
- version: "4.2.1-7-g15dd6d62",
12414
+ version: "4.2.1-9-gb6e43bd0",
12389
12415
  clientId: this.clientId,
12390
12416
  sessionId: this.sessionId,
12391
12417
  channelId: this.channelId,