@vindral/web-sdk 4.5.0 → 4.5.1-10-g5556eb794

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.
package/api-client.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./DeYmk5AL.js";
1
+ import { t as e } from "./BOdyvABa.js";
2
2
  export { e as ApiClient };
package/cast-sender.d.ts CHANGED
@@ -177,11 +177,20 @@ interface Options {
177
177
  */
178
178
  mseOpusEnabled?: boolean;
179
179
  /**
180
- * Enable or disable support for playing audio in the background for iOS devices.
180
+ * Keep playback running while the page is in the background. Enabled by default.
181
+ * When disabled, the session disconnects while hidden and reconnects when visible.
181
182
  *
182
- * Is false (disabled) by default.
183
+ * Browser media policies still apply; iOS Safari pauses hidden video regardless.
184
+ * Call `play()` again from a user gesture or media-control action to resume.
183
185
  *
184
- * Note: This may be enabled by default in a future (major) release
186
+ * When enabled, hidden sessions that are muted outside Picture-in-Picture or browser-paused
187
+ * are disconnected after the inactivity timeout; an explicit `pause()` disconnects at once.
188
+ */
189
+ backgroundPlayEnabled?: boolean;
190
+ /**
191
+ * @deprecated Use `backgroundPlayEnabled` instead.
192
+ *
193
+ * Legacy alias kept for backwards compatibility.
185
194
  */
186
195
  iosBackgroundPlayEnabled?: boolean;
187
196
  /**
@@ -386,6 +395,10 @@ export interface CastSenderEvents {
386
395
  * When the remote connection receives a server wallclock time event
387
396
  */
388
397
  "server wallclock time": number;
398
+ /**
399
+ * When receiver availability changes. True when at least one receiver is reachable.
400
+ */
401
+ "devices available": boolean;
389
402
  }
390
403
  /**
391
404
  * Used for initializing the CastSender
@@ -412,6 +425,9 @@ export declare class CastSender extends Emitter<CastSenderEvents> {
412
425
  private state;
413
426
  private config;
414
427
  private unloaded;
428
+ private logger;
429
+ /** Last reported availability, undefined until the Cast API tells us */
430
+ private devicesAvailable;
415
431
  constructor(config: CastConfig);
416
432
  /**
417
433
  * True if the instance is casting right now
@@ -471,6 +487,9 @@ export declare class CastSender extends Emitter<CastSenderEvents> {
471
487
  private send;
472
488
  private onMessage;
473
489
  private onSessionStarted;
490
+ private onCastStateChanged;
491
+ /** Emits on change only, since connecting and connected are all "available" */
492
+ private updateDevicesAvailable;
474
493
  private onSessionStateChanged;
475
494
  private getInstance;
476
495
  private getSession;
package/cast-sender.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./BdFcdkj1.js";
1
+ import { t as e } from "./xYchr7Lz.js";
2
2
  export { e as CastSender };
package/core.d.ts CHANGED
@@ -272,11 +272,20 @@ export interface Options {
272
272
  */
273
273
  mseOpusEnabled?: boolean;
274
274
  /**
275
- * Enable or disable support for playing audio in the background for iOS devices.
275
+ * Keep playback running while the page is in the background. Enabled by default.
276
+ * When disabled, the session disconnects while hidden and reconnects when visible.
276
277
  *
277
- * Is false (disabled) by default.
278
+ * Browser media policies still apply; iOS Safari pauses hidden video regardless.
279
+ * Call `play()` again from a user gesture or media-control action to resume.
278
280
  *
279
- * Note: This may be enabled by default in a future (major) release
281
+ * When enabled, hidden sessions that are muted outside Picture-in-Picture or browser-paused
282
+ * are disconnected after the inactivity timeout; an explicit `pause()` disconnects at once.
283
+ */
284
+ backgroundPlayEnabled?: boolean;
285
+ /**
286
+ * @deprecated Use `backgroundPlayEnabled` instead.
287
+ *
288
+ * Legacy alias kept for backwards compatibility.
280
289
  */
281
290
  iosBackgroundPlayEnabled?: boolean;
282
291
  /**
@@ -653,6 +662,7 @@ export declare const CONNECTION_FAILED_AFTER_RETRIES_CODE = "connection_failed_w
653
662
  export declare const AUTHENTICATION_FAILED_CODE = "authentication_error";
654
663
  export declare const AUTHENTICATION_EXPIRED_CODE = "authentication_expired";
655
664
  export declare const CHANNEL_NOT_FOUND_CODE = "channel_not_found";
665
+ export declare const CHANNEL_NOT_LIVE_CODE = "channel_not_live";
656
666
  export declare const NO_INCOMING_DATA = "no_incoming_data_error";
657
667
  export declare const INACTIVITY_CODE = "connection_inactivity";
658
668
  export declare const DISCONNECTED_BY_EDGE = "disconnected_by_edge";
@@ -1096,11 +1106,47 @@ export type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["get
1096
1106
  */
1097
1107
  timeshiftAdjustmentsPerMinute: number;
1098
1108
  };
1109
+ /**
1110
+ * Represents a Vindral client instance
1111
+ *
1112
+ * The most most essential methods when using the Vindral class are:
1113
+ *
1114
+ * - connect() - this has to be called to actually start connecting
1115
+ * - attach() - to attach the Vindral video view to the DOM so that users can see it
1116
+ * - userInput() - to activate audio on browsers that require a user gesture to play audio
1117
+ * - unload() - unloads the instance, its very important that this is called when cleaning up the Vindral instance, otherwise background timers may leak.
1118
+ *
1119
+ * The Vindral instance will emit a variety of events during its lifetime. Use .on("event-name", callback) to listen to these events.
1120
+ * See [[PublicVindralEvents]] for the events types that can be emitted.
1121
+ *
1122
+ * ```typescript
1123
+ * // minimal configuration of a Vindral client instance
1124
+ * const instance = new Vindral({
1125
+ * url: "https://lb.cdn.vindral.com",
1126
+ * channelId: "vindral_demo1_ci_099ee1fa-80f3-455e-aa23-3d184e93e04f",
1127
+ * })
1128
+ *
1129
+ * // Will be called when timed metadata is received
1130
+ * instance.on("metadata", console.log)
1131
+ *
1132
+ * // Will be called when a user interaction is needed to activate audio
1133
+ * instance.on("needs user input", console.log)
1134
+ *
1135
+ * // Start connecting to the cdn
1136
+ * instance.connect()
1137
+ *
1138
+ * // Attach the video view to the DOM
1139
+ * instance.attach(document.getElementById("root"))
1140
+ *
1141
+ * // When done with the instance
1142
+ * instance.unload()
1143
+ * ```
1144
+ */
1099
1145
  export declare class Vindral extends Emitter<PublicVindralEvents> {
1100
1146
  #private;
1101
1147
  private static MAX_POOL_SIZE;
1102
- private static DISCONNECT_TIMEOUT;
1103
1148
  private static REMOVE_CUE_THRESHOLD;
1149
+ private static BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT;
1104
1150
  /**
1105
1151
  * Picture in picture
1106
1152
  */
@@ -1143,6 +1189,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1143
1189
  private offscreenCanvasElement?;
1144
1190
  private webCodecsRenditionSupport;
1145
1191
  private hasCalledConnect;
1192
+ private isUserPaused;
1146
1193
  private latestEmittedLanguages;
1147
1194
  private wakeLock;
1148
1195
  private pool;
@@ -1157,7 +1204,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1157
1204
  private readonly unextractableSamplesWarned;
1158
1205
  private sizes;
1159
1206
  private isSuspended;
1160
- private disconnectTimeout;
1207
+ private inactivityDisconnectInterval;
1161
1208
  private offscreenSubtitleInterval?;
1162
1209
  constructor(options: Options);
1163
1210
  /**
@@ -1520,8 +1567,14 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1520
1567
  */
1521
1568
  getStatistics: () => Statistics;
1522
1569
  private resetModules;
1570
+ private disconnectForInactivePage;
1571
+ private scheduleInactivityDisconnect;
1572
+ private clearInactivityDisconnect;
1573
+ private isHiddenWithBackgroundPlayback;
1574
+ private isHiddenWithBackgroundPlayDisabled;
1523
1575
  private suspend;
1524
1576
  private unsuspend;
1577
+ private resumeModules;
1525
1578
  private getRuntimeInfo;
1526
1579
  private getPlaybackBufferState;
1527
1580
  private onMediaElementBufferState;
@@ -1545,6 +1598,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1545
1598
  * is the optimal rendering path for WebCodecs (worker renders VideoFrames directly).
1546
1599
  */
1547
1600
  private shouldUseOffscreenCanvas;
1601
+ private isBackgroundPlayEnabled;
1602
+ private shouldAllowBackgroundPlayback;
1548
1603
  }
1549
1604
  interface TelemetryModuleStatistics {
1550
1605
  /**
@@ -1716,7 +1771,8 @@ export interface PublicVindralEvents {
1716
1771
  * Is emitted during connection whether the channel is live or not.
1717
1772
  *
1718
1773
  * If the channel is not live, the Vindral instance will try to reconnect until the `reconnectHandler`
1719
- * determines that no more retries should be made.
1774
+ * determines that no more retries should be made. Each attempt also emits a non-fatal `error` with
1775
+ * the code `channel_not_live`.
1720
1776
  *
1721
1777
  * Note: If the web-sdk is instantiated at the same time as you are starting the stream it is possible
1722
1778
  * that this emits false until the started state has propagated through the system.
package/core.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./zRKuZnIT.js";
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
- 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 };
1
+ import { t as e } from "./D25qKlGC.js";
2
+ import { a as t, c as n, d as r, i, l as a, n as o, o as s, r as c, s as l, u } from "./CiWlpwR0.js";
3
+ export { o as AUTHENTICATION_EXPIRED_CODE, c as AUTHENTICATION_FAILED_CODE, i as CHANNEL_NOT_FOUND_CODE, t as CHANNEL_NOT_LIVE_CODE, s as CONNECTION_FAILED_AFTER_RETRIES_CODE, l as CONNECTION_FAILED_CODE, n as DISCONNECTED_BY_EDGE, a as INACTIVITY_CODE, u as NO_INCOMING_DATA, e as Vindral, r as VindralError };