@vindral/web-sdk 4.6.0 → 4.7.0-1-gb0d0369b

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.
@@ -1,7 +1,7 @@
1
1
  import { n as e, t } from "./BsfwXDui.js";
2
2
  import { t as n } from "./DrWNJwZx.js";
3
- import { t as r } from "./BKeRxR4O.js";
4
- import { i, n as a, t as o } from "./CbyVl6wP.js";
3
+ import { i as r, n as i, t as a } from "./BdMchGeH.js";
4
+ import { t as o } from "./D1kpe8tT.js";
5
5
  //#region ../../libs/web-sdk/src/decoders/WebCodecsAudioDecoderContext.ts
6
6
  var s, c = globalThis, l = (e) => {
7
7
  var t, n;
@@ -34,26 +34,26 @@ var s, c = globalThis, l = (e) => {
34
34
  return;
35
35
  }
36
36
  this.doneCount++;
37
- let { sample: n, decodeStartTime: i, priming: a } = t;
37
+ let { sample: n, decodeStartTime: r, priming: i } = t;
38
38
  try {
39
- let t = e.numberOfFrames, o = e.numberOfChannels, s = e.sampleRate, c = e.duration, l = Math.min(t, Math.round(a.remaining * s / 48e3));
40
- if (a.remaining = Math.max(0, a.remaining - Math.round(l * 48e3 / s)), l === t && t > 0) return;
41
- let u = new Float32Array((t - l) * o);
39
+ let t = e.numberOfFrames, a = e.numberOfChannels, s = e.sampleRate, c = e.duration, l = Math.min(t, Math.round(i.remaining * s / 48e3));
40
+ if (i.remaining = Math.max(0, i.remaining - Math.round(l * 48e3 / s)), l === t && t > 0) return;
41
+ let u = new Float32Array((t - l) * a);
42
42
  e.copyTo(u, {
43
43
  planeIndex: 0,
44
44
  format: "f32",
45
45
  frameOffset: l
46
46
  });
47
- let d = l > 0 ? Math.round((t - l) * n.timescale / s) : typeof c == "number" && Number.isFinite(c) ? Math.max(0, Math.round(c * n.timescale / 1e6)) : n.duration, f = r(r({}, n), {}, {
47
+ let d = l > 0 ? Math.round((t - l) * n.timescale / s) : typeof c == "number" && Number.isFinite(c) ? Math.max(0, Math.round(c * n.timescale / 1e6)) : n.duration, f = o(o({}, n), {}, {
48
48
  timestamp: n.timestamp + Math.round(l * n.timescale / s),
49
49
  duration: d,
50
50
  type: "audio",
51
51
  format: "f32",
52
52
  data: u,
53
53
  sampleRate: s,
54
- channels: o,
54
+ channels: a,
55
55
  statistics: {
56
- decodeTime: Math.max(performance.now() - i, 0),
56
+ decodeTime: Math.max(performance.now() - r, 0),
57
57
  transportTimeFromWorker: 0,
58
58
  transportTimeToWorker: 0,
59
59
  samplesInBatch: 1
@@ -67,11 +67,11 @@ var s, c = globalThis, l = (e) => {
67
67
  error: (e) => {
68
68
  this.logger.error("Decoder error:", e.name, e.message), this.resetDecoderState(), this.errors.push(e);
69
69
  }
70
- })), e(this, "buildCodecString", o), e(this, "getDescription", (e, t) => {
70
+ })), e(this, "buildCodecString", a), e(this, "getDescription", (e, t) => {
71
71
  let n = this.initSegments.get(t.renditionId);
72
72
  if (n && n.data.byteLength > 0 && n.codec === e) return n.data;
73
- if (e === "opus") return a(t.channels, t.sampleRate);
74
- if (e === "aac") return i(t.channels, t.sampleRate);
73
+ if (e === "opus") return i(t.channels, t.sampleRate);
74
+ if (e === "aac") return r(t.channels, t.sampleRate);
75
75
  }), e(this, "reset", () => {
76
76
  this.decodedSamples = [], this.decoder && this.decoder.state !== "closed" && this.decoder.reset(), this.resetDecoderState();
77
77
  }), e(this, "unload", () => {
package/api-client.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./BOdyvABa.js";
1
+ import { t as e } from "./D40eQS8l.js";
2
2
  export { e as ApiClient };
package/cast-sender.d.ts CHANGED
@@ -170,7 +170,12 @@ interface Options {
170
170
  * Enable bursting for initial connection and channel switches. This makes time to first frame faster at the
171
171
  * cost of stability (more demanding due to the sudden burst of live content)
172
172
  *
173
- * Is disabled by default.
173
+ * With bursting and adaptive bit rate on, playback starts at a rendition whose bit rate is at most half the
174
+ * estimated bandwidth, so the link can catch up with the burst, and adaptive bit rate then steps up. It never
175
+ * starts below the lowest rendition. If the rendition it starts at still needs more than half the estimated
176
+ * bandwidth (the lowest one on a slow link, or the fixed one with adaptive bit rate off), the burst is skipped.
177
+ *
178
+ * Is enabled by default.
174
179
  *
175
180
  */
176
181
  burstEnabled?: boolean;
package/cast-sender.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./xYchr7Lz.js";
1
+ import { t as e } from "./DQ5kuB8C.js";
2
2
  export { e as CastSender };
package/core.d.ts CHANGED
@@ -35,6 +35,15 @@ interface MinMaxAverage {
35
35
  */
36
36
  min: number;
37
37
  }
38
+ type NavigatorEffectiveType = "2g" | "3g" | "4g" | "slow-2g";
39
+ type NavigatorConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
40
+ interface NavigatorConnectionStatistics {
41
+ navigatorRtt?: number;
42
+ navigatorEffectiveType?: NavigatorEffectiveType;
43
+ navigatorConnectionType?: NavigatorConnectionType;
44
+ navigatorSaveData?: boolean;
45
+ navigatorDownlink?: number;
46
+ }
38
47
  type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
39
48
  type VoidKeys<Record> = MatchingKeys<Record, void>;
40
49
  type EventListenerReturnType = (() => void) | void;
@@ -266,7 +275,12 @@ export interface Options {
266
275
  * Enable bursting for initial connection and channel switches. This makes time to first frame faster at the
267
276
  * cost of stability (more demanding due to the sudden burst of live content)
268
277
  *
269
- * Is disabled by default.
278
+ * With bursting and adaptive bit rate on, playback starts at a rendition whose bit rate is at most half the
279
+ * estimated bandwidth, so the link can catch up with the burst, and adaptive bit rate then steps up. It never
280
+ * starts below the lowest rendition. If the rendition it starts at still needs more than half the estimated
281
+ * bandwidth (the lowest one on a slow link, or the fixed one with adaptive bit rate off), the burst is skipped.
282
+ *
283
+ * Is enabled by default.
270
284
  *
271
285
  */
272
286
  burstEnabled?: boolean;
@@ -901,18 +915,13 @@ interface DecoderStatistics {
901
915
  audioRenderer?: "AudioContext" | "MSE";
902
916
  audioDecoder?: "WebCodecs" | "WASM" | "MSE";
903
917
  }
904
- interface DocumentStateModulesStatistics {
918
+ interface DocumentStateModulesStatistics extends NavigatorConnectionStatistics {
905
919
  isVisible: boolean;
906
920
  isOnline: boolean;
907
921
  isVisibleCount: number;
908
922
  isHiddenCount: number;
909
923
  isOnlineCount: number;
910
924
  isOfflineCount: number;
911
- navigatorRtt?: number;
912
- navigatorEffectiveType?: EffectiveConnectionType;
913
- navigatorConnectionType?: ConnectionType;
914
- navigatorSaveData?: boolean;
915
- navigatorDownlink?: number;
916
925
  }
917
926
  interface IncomingDataModuleStatistics {
918
927
  /**
@@ -1371,6 +1380,11 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1371
1380
  * setting targetBufferTime within that range for consistancy if using both min/max.
1372
1381
  */
1373
1382
  set targetBufferTime(bufferTimeMs: number);
1383
+ /**
1384
+ * Set the burst for joins and channel switches from `burstEnabled` as resolved for the channel, so a channel
1385
+ * override can turn it off as well as on
1386
+ */
1387
+ private applyBurstEnabled;
1374
1388
  /**
1375
1389
  * Update the dynamic buffer time configuration at runtime.
1376
1390
  * Allows adjusting min and max buffer time without recreating the Vindral instance.
@@ -1544,6 +1558,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1544
1558
  private updateTextTracks;
1545
1559
  private cleanupTextTracks;
1546
1560
  private filterRenditions;
1561
+ /** Whether the bandwidth leaves room for a join burst of the video and audio the player starts at. */
1562
+ private burstFits;
1547
1563
  /**
1548
1564
  * Patch the subscription with properties from the channel that isn't known until connection
1549
1565
  * @param channel Channel with the renditions to patch the subscription based on
@@ -1706,6 +1722,10 @@ interface ConnectionStatistics {
1706
1722
  * A very rough initial estimation of minimum available bandwidth.
1707
1723
  */
1708
1724
  estimatedBandwidth: number;
1725
+ /**
1726
+ * Origin of the edge the client is connected to, or is trying while it reconnects. Once disconnected, the last
1727
+ * edge it was connected to.
1728
+ */
1709
1729
  edgeUrl?: string;
1710
1730
  /**
1711
1731
  * Total number of connections that have been established since instantiation.
@@ -1726,6 +1746,7 @@ interface ConnectionStatistics {
1726
1746
  * Does not wait for player bootstrap or media to start.
1727
1747
  */
1728
1748
  timeToConnected?: number;
1749
+ /** Protocol of the current connection. Unset while reconnecting; once disconnected, the last connection's. */
1729
1750
  connectionProtocol: "vindral_ws" | "moq" | "moq_ws" | undefined;
1730
1751
  /**
1731
1752
  * When connectionProtocol is "moq_ws", indicates why WebSocket was used instead of WebTransport.
@@ -1733,6 +1754,7 @@ interface ConnectionStatistics {
1733
1754
  * - "disabled": webtransportEnabled option is false
1734
1755
  * - "unavailable": edge did not offer a WebTransport endpoint
1735
1756
  * - "fallback": WebTransport was attempted but failed or timed out
1757
+ * Unset while reconnecting; once disconnected, the last connection's.
1736
1758
  */
1737
1759
  transportSelectionReason: TransportSelectionReason | undefined;
1738
1760
  }
package/core.js CHANGED
@@ -1,3 +1,2 @@
1
- import { t as e } from "./CN8w7_en.js";
2
- import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, r as l, s as u } from "./BBVSf5AB.js";
3
- export { s as AUTHENTICATION_EXPIRED_CODE, l as AUTHENTICATION_FAILED_CODE, a as CHANNEL_NOT_FOUND_CODE, t as CHANNEL_NOT_LIVE_CODE, c as CONNECTION_FAILED_AFTER_RETRIES_CODE, u as CONNECTION_FAILED_CODE, n as DISCONNECTED_BY_EDGE, o as INACTIVITY_CODE, r as NO_INCOMING_DATA, e as Vindral, i as VindralError };
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 "./CXHN3nqn.js";
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
@@ -38,6 +38,15 @@ interface MinMaxAverage {
38
38
  */
39
39
  min: number;
40
40
  }
41
+ type NavigatorEffectiveType = "2g" | "3g" | "4g" | "slow-2g";
42
+ type NavigatorConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
43
+ interface NavigatorConnectionStatistics {
44
+ navigatorRtt?: number;
45
+ navigatorEffectiveType?: NavigatorEffectiveType;
46
+ navigatorConnectionType?: NavigatorConnectionType;
47
+ navigatorSaveData?: boolean;
48
+ navigatorDownlink?: number;
49
+ }
41
50
  type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
42
51
  type VoidKeys<Record> = MatchingKeys<Record, void>;
43
52
  type EventListenerReturnType = (() => void) | void;
@@ -269,7 +278,12 @@ export interface Options {
269
278
  * Enable bursting for initial connection and channel switches. This makes time to first frame faster at the
270
279
  * cost of stability (more demanding due to the sudden burst of live content)
271
280
  *
272
- * Is disabled by default.
281
+ * With bursting and adaptive bit rate on, playback starts at a rendition whose bit rate is at most half the
282
+ * estimated bandwidth, so the link can catch up with the burst, and adaptive bit rate then steps up. It never
283
+ * starts below the lowest rendition. If the rendition it starts at still needs more than half the estimated
284
+ * bandwidth (the lowest one on a slow link, or the fixed one with adaptive bit rate off), the burst is skipped.
285
+ *
286
+ * Is enabled by default.
273
287
  *
274
288
  */
275
289
  burstEnabled?: boolean;
@@ -916,18 +930,13 @@ interface DecoderStatistics {
916
930
  audioRenderer?: "AudioContext" | "MSE";
917
931
  audioDecoder?: "WebCodecs" | "WASM" | "MSE";
918
932
  }
919
- interface DocumentStateModulesStatistics {
933
+ interface DocumentStateModulesStatistics extends NavigatorConnectionStatistics {
920
934
  isVisible: boolean;
921
935
  isOnline: boolean;
922
936
  isVisibleCount: number;
923
937
  isHiddenCount: number;
924
938
  isOnlineCount: number;
925
939
  isOfflineCount: number;
926
- navigatorRtt?: number;
927
- navigatorEffectiveType?: EffectiveConnectionType;
928
- navigatorConnectionType?: ConnectionType;
929
- navigatorSaveData?: boolean;
930
- navigatorDownlink?: number;
931
940
  }
932
941
  interface IncomingDataModuleStatistics {
933
942
  /**
@@ -1386,6 +1395,11 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1386
1395
  * setting targetBufferTime within that range for consistancy if using both min/max.
1387
1396
  */
1388
1397
  set targetBufferTime(bufferTimeMs: number);
1398
+ /**
1399
+ * Set the burst for joins and channel switches from `burstEnabled` as resolved for the channel, so a channel
1400
+ * override can turn it off as well as on
1401
+ */
1402
+ private applyBurstEnabled;
1389
1403
  /**
1390
1404
  * Update the dynamic buffer time configuration at runtime.
1391
1405
  * Allows adjusting min and max buffer time without recreating the Vindral instance.
@@ -1559,6 +1573,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1559
1573
  private updateTextTracks;
1560
1574
  private cleanupTextTracks;
1561
1575
  private filterRenditions;
1576
+ /** Whether the bandwidth leaves room for a join burst of the video and audio the player starts at. */
1577
+ private burstFits;
1562
1578
  /**
1563
1579
  * Patch the subscription with properties from the channel that isn't known until connection
1564
1580
  * @param channel Channel with the renditions to patch the subscription based on
@@ -1721,6 +1737,10 @@ interface ConnectionStatistics {
1721
1737
  * A very rough initial estimation of minimum available bandwidth.
1722
1738
  */
1723
1739
  estimatedBandwidth: number;
1740
+ /**
1741
+ * Origin of the edge the client is connected to, or is trying while it reconnects. Once disconnected, the last
1742
+ * edge it was connected to.
1743
+ */
1724
1744
  edgeUrl?: string;
1725
1745
  /**
1726
1746
  * Total number of connections that have been established since instantiation.
@@ -1741,6 +1761,7 @@ interface ConnectionStatistics {
1741
1761
  * Does not wait for player bootstrap or media to start.
1742
1762
  */
1743
1763
  timeToConnected?: number;
1764
+ /** Protocol of the current connection. Unset while reconnecting; once disconnected, the last connection's. */
1744
1765
  connectionProtocol: "vindral_ws" | "moq" | "moq_ws" | undefined;
1745
1766
  /**
1746
1767
  * When connectionProtocol is "moq_ws", indicates why WebSocket was used instead of WebTransport.
@@ -1748,6 +1769,7 @@ interface ConnectionStatistics {
1748
1769
  * - "disabled": webtransportEnabled option is false
1749
1770
  * - "unavailable": edge did not offer a WebTransport endpoint
1750
1771
  * - "fallback": WebTransport was attempted but failed or timed out
1772
+ * Unset while reconnecting; once disconnected, the last connection's.
1751
1773
  */
1752
1774
  transportSelectionReason: TransportSelectionReason | undefined;
1753
1775
  }