@vindral/web-sdk 4.1.10 → 4.2.0

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,6 +1,6 @@
1
1
  var c = Object.defineProperty;
2
- var d = (r, s, e) => s in r ? c(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
- var o = (r, s, e) => d(r, typeof s != "symbol" ? s + "" : s, e);
2
+ var d = (l, s, e) => s in l ? c(l, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[s] = e;
3
+ var o = (l, s, e) => d(l, typeof s != "symbol" ? s + "" : s, e);
4
4
  class u {
5
5
  constructor() {
6
6
  o(this, "listeners", {});
@@ -8,13 +8,13 @@ class u {
8
8
  emit(s, e) {
9
9
  const i = this.listeners[s];
10
10
  if (i) {
11
- let l = !1;
11
+ let r = !1;
12
12
  for (let t = 0; t < i.length; t++)
13
13
  if (i[t].once) {
14
- l = !0;
14
+ r = !0;
15
15
  break;
16
16
  }
17
- l && (this.listeners[s] = i.filter((t) => !t.once));
17
+ r && (this.listeners[s] = i.filter((t) => !t.once));
18
18
  let n;
19
19
  const h = i.length;
20
20
  for (let t = 0; t < h; t++) {
@@ -28,7 +28,7 @@ class u {
28
28
  }
29
29
  off(s, e) {
30
30
  const i = this.listeners[s];
31
- i && (this.listeners[s] = i.filter((l) => l.fn !== e));
31
+ i && (this.listeners[s] = i.filter((r) => r.fn !== e));
32
32
  }
33
33
  on(s, e) {
34
34
  this.add(s, e, !1);
@@ -36,6 +36,13 @@ class u {
36
36
  once(s, e) {
37
37
  this.add(s, e, !0);
38
38
  }
39
+ /**
40
+ * Check whether there are any listeners registered for the given event.
41
+ */
42
+ hasListeners(s) {
43
+ const e = this.listeners[s];
44
+ return e !== void 0 && e.length > 0;
45
+ }
39
46
  /**
40
47
  * Reset the event emitter
41
48
  */
@@ -43,8 +50,8 @@ class u {
43
50
  this.listeners = {};
44
51
  }
45
52
  add(s, e, i) {
46
- const l = this.listeners[s], n = { fn: e, once: i };
47
- l ? l.push(n) : this.listeners[s] = [n];
53
+ const r = this.listeners[s], n = { fn: e, once: i };
54
+ r ? r.push(n) : this.listeners[s] = [n];
48
55
  }
49
56
  }
50
57
  export {
@@ -27,7 +27,7 @@ var X = (B, g, A) => new Promise((J, k) => {
27
27
  }, o = (h) => h.done ? J(h.value) : Promise.resolve(h.value).then(y, a);
28
28
  o((A = A.apply(B, g)).next());
29
29
  });
30
- import { F as RA, d as JA, n as kA } from "./BWE6d-4K.js";
30
+ import { F as RA, d as JA, n as kA } from "./DBHv5ggB.js";
31
31
  var hA = (function() {
32
32
  var B = typeof document != "undefined" && document.currentScript ? document.currentScript.src : void 0;
33
33
  return (function(g) {
package/api-client.d.ts CHANGED
@@ -31,47 +31,6 @@ type Tagged<BaseType, Tag extends PropertyKey> = BaseType & {
31
31
  };
32
32
  type AudioCodec = "aac" | "opus" | "mp3";
33
33
  type VideoCodec = "h264" | "av1";
34
- interface RenditionProps {
35
- id: number;
36
- /** */
37
- bitRate: number;
38
- /** */
39
- codecString?: string;
40
- /** */
41
- language?: string;
42
- /** */
43
- meta?: Record<string, string>;
44
- }
45
- interface VideoRenditionProps {
46
- /** */
47
- codec: VideoCodec;
48
- /** */
49
- frameRate: [
50
- number,
51
- number
52
- ];
53
- /** */
54
- width: number;
55
- /** */
56
- height: number;
57
- }
58
- interface AudioRenditionProps {
59
- /** */
60
- codec: AudioCodec;
61
- /** */
62
- channels: number;
63
- /** */
64
- sampleRate: number;
65
- }
66
- interface TextRenditionProps {
67
- codec: "webvtt";
68
- kind: "subtitles" | "captions";
69
- label?: string;
70
- }
71
- type VideoRendition = VideoRenditionProps & RenditionProps;
72
- type AudioRendition = AudioRenditionProps & RenditionProps;
73
- type TextRendition = TextRenditionProps & RenditionProps;
74
- type Rendition = VideoRendition | AudioRendition | TextRendition;
75
34
  type WebCodecsHardwareAccelerationPreference = "no-preference" | "prefer-hardware" | "prefer-software";
76
35
  interface ClientOverrides {
77
36
  maxVideoBitRate?: number;
@@ -80,7 +39,6 @@ interface ClientOverrides {
80
39
  burstEnabled?: boolean;
81
40
  sizeBasedResolutionCapEnabled?: boolean;
82
41
  separateVideoSocketEnabled?: boolean;
83
- webcodecsEnabled?: boolean;
84
42
  webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
85
43
  offscreenCanvasEnabled?: boolean;
86
44
  videoCodecs?: string[];
@@ -124,6 +82,47 @@ interface TracksCatalog extends CatalogRoot {
124
82
  namespace: Namespace;
125
83
  tracks: Array<TrackObject>;
126
84
  }
85
+ interface RenditionProps {
86
+ id: number;
87
+ /** */
88
+ bitRate: number;
89
+ /** */
90
+ codecString?: string;
91
+ /** */
92
+ language?: string;
93
+ /** */
94
+ meta?: Record<string, string>;
95
+ }
96
+ interface VideoRenditionProps {
97
+ /** */
98
+ codec: VideoCodec;
99
+ /** */
100
+ frameRate: [
101
+ number,
102
+ number
103
+ ];
104
+ /** */
105
+ width: number;
106
+ /** */
107
+ height: number;
108
+ }
109
+ interface AudioRenditionProps {
110
+ /** */
111
+ codec: AudioCodec;
112
+ /** */
113
+ channels: number;
114
+ /** */
115
+ sampleRate: number;
116
+ }
117
+ interface TextRenditionProps {
118
+ codec: "webvtt";
119
+ kind: "subtitles" | "captions";
120
+ label?: string;
121
+ }
122
+ type VideoRendition = VideoRenditionProps & RenditionProps;
123
+ type AudioRendition = AudioRenditionProps & RenditionProps;
124
+ type TextRendition = TextRenditionProps & RenditionProps;
125
+ type Rendition = VideoRendition | AudioRendition | TextRendition;
127
126
  interface Telemetry {
128
127
  url: string;
129
128
  probability?: number;
package/api-client.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as o } from "./CPEMXA01.js";
1
+ import { A as o } from "./CuhQLT-7.js";
2
2
  export {
3
3
  o as ApiClient
4
4
  };
package/cast-sender.d.ts CHANGED
@@ -26,6 +26,10 @@ declare class Emitter<TEvents, TEmits = TEvents, ArgLessEvents extends VoidKeys<
26
26
  */
27
27
  once<T extends ArgLessEvents>(eventName: T, fn: () => void): void;
28
28
  once<T extends ArgEvents>(eventName: T, fn: (args: TEvents[T]) => void): void;
29
+ /**
30
+ * Check whether there are any listeners registered for the given event.
31
+ */
32
+ hasListeners<T extends keyof TEvents | keyof TEmits>(eventName: T): boolean;
29
33
  /**
30
34
  * Reset the event emitter
31
35
  */
@@ -65,25 +69,7 @@ interface Size {
65
69
  /** */
66
70
  height: number;
67
71
  }
68
- interface VideoConstraint {
69
- /** */
70
- width: number;
71
- /** */
72
- height: number;
73
- /** */
74
- bitRate: number;
75
- /** */
76
- codec?: VideoCodec;
77
- /** */
78
- codecString?: string;
79
- }
80
72
  interface AdvancedOptions {
81
- /**
82
- * Constrains wasm decoding to this resolution.
83
- * By default it is set to 1280 in width and height.
84
- * This guarantees better performance on older devices and reduces battery drain in general.
85
- */
86
- wasmDecodingConstraint: Partial<VideoConstraint>;
87
73
  }
88
74
  interface DrmOptions {
89
75
  /**
@@ -111,6 +97,7 @@ interface DrmOptions {
111
97
  }
112
98
  type Media = "audio" | "video" | "audio+video";
113
99
  type WebCodecsHardwareAccelerationPreference = "no-preference" | "prefer-hardware" | "prefer-software";
100
+ type DecoderType = "mse" | "webcodecs" | "wasm";
114
101
  interface Options {
115
102
  /**
116
103
  * URL to use when connecting to the stream
@@ -177,11 +164,9 @@ interface Options {
177
164
  */
178
165
  burstEnabled?: boolean;
179
166
  /**
180
- * Enable usage of the MediaSource API on supported browsers.
181
- *
182
- * Is enabled by default.
183
- *
184
- * Note: We recommend to keep this at the default value unless you have very specific needs.
167
+ * @deprecated Use `decoders` instead.
168
+ * Setting `mseEnabled: false` is equivalent to `decoders: ["wasm"]`.
169
+ * When both `mseEnabled` and `decoders` are provided, `decoders` takes precedence.
185
170
  */
186
171
  mseEnabled?: boolean;
187
172
  /**
@@ -298,7 +283,7 @@ interface Options {
298
283
  * The wake lock requires that the audio has been activated at least once for the instance, othwerwise it will not work.
299
284
  * Other devices already provide wake lock by default.
300
285
  *
301
- * This option is redundant and has no effect if iosMediaElementEnabled is enabled since that automatically enables wake lock.
286
+ * This option is redundant and has no effect if streamToMediaElementEnabled is enabled since that automatically enables wake lock.
302
287
  *
303
288
  * Disabled by default.
304
289
  */
@@ -308,26 +293,20 @@ interface Options {
308
293
  */
309
294
  pauseSupportEnabled?: boolean;
310
295
  /**
311
- * Enables iOS devices to use a media element for playback. This enables fullscreen and picture in picture support on iOS.
312
- */
313
- iosMediaElementEnabled?: boolean;
314
- /**
315
- * Enable WebCodecs API for hardware-accelerated decoding.
296
+ * Stream canvas-rendered video/audio to a media element via captureStream.
316
297
  *
317
- * When enabled, the browser's native VideoDecoder and AudioDecoder APIs will be used instead
318
- * of WASM decoding on supported browsers (Chrome 94+, Edge 94+, Safari 16.4+). This provides:
319
- * - Hardware-accelerated decoding (uses GPU for video)
320
- * - Better performance at higher resolutions
321
- * - Lower CPU usage and battery consumption
298
+ * This enables platform media features such as fullscreen and picture-in-picture
299
+ * for non-MSE playback by routing the canvas output through a `<video>` element.
322
300
  *
323
- * Disabled by default to allow gradual rollout and testing.
301
+ * Disabled by default.
302
+ */
303
+ streamToMediaElementEnabled?: boolean;
304
+ /**
305
+ * @deprecated Use `streamToMediaElementEnabled` instead.
324
306
  *
325
- * Note: Automatically falls back to WASM decoding if:
326
- * - The browser doesn't support WebCodecs
327
- * - WebCodecs initialization fails
328
- * - This option is set to false or undefined
307
+ * Legacy alias kept for backwards compatibility.
329
308
  */
330
- webcodecsEnabled?: boolean;
309
+ iosMediaElementEnabled?: boolean;
331
310
  /**
332
311
  * Hardware acceleration preference for WebCodecs video decoding.
333
312
  *
@@ -335,14 +314,29 @@ interface Options {
335
314
  */
336
315
  webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
337
316
  /**
338
- * Enable OffscreenCanvas rendering in worker thread (requires webcodecsEnabled: true).
317
+ * Enable OffscreenCanvas rendering in worker thread.
339
318
  *
340
319
  * When enabled, video rendering happens in the worker thread using OffscreenCanvas.
341
- * Disabled by default to allow gradual rollout and testing.
320
+ * Automatically enabled when `decoders` resolves to WebCodecs. Set to `false`
321
+ * to explicitly disable even when WebCodecs is active.
342
322
  *
343
- * Note: Requires browser support for OffscreenCanvas and webcodecsEnabled must be true, and iosMediaElementEnabled must be false.
323
+ * Requires browser support for OffscreenCanvas and WebCodecs.
324
+ * Works with `streamToMediaElementEnabled` for fullscreen/PiP support.
344
325
  */
345
326
  offscreenCanvasEnabled?: boolean;
327
+ /**
328
+ * Ordered list of decoders to try.
329
+ *
330
+ * The runtime walks the list and uses the first decoder that is available on the
331
+ * current platform. When DRM is active, MSE is forced regardless of order.
332
+ *
333
+ * When omitted, the platform default order is used (`["mse", "wasm"]`).
334
+ *
335
+ * @example
336
+ * // Prefer WebCodecs over MSE
337
+ * decoders: ["webcodecs", "mse", "wasm"]
338
+ */
339
+ decoders?: DecoderType[];
346
340
  /**
347
341
  * Advanced options to override default behaviour.
348
342
  */
package/cast-sender.js CHANGED
@@ -17,7 +17,7 @@ var h = (n, i, e) => new Promise((t, a) => {
17
17
  }, c = (r) => r.done ? t(r.value) : Promise.resolve(r.value).then(o, d);
18
18
  c((e = e.apply(n, i)).next());
19
19
  });
20
- import { E as g } from "./uEFjK_x4.js";
20
+ import { E as g } from "./DGo74EDo.js";
21
21
  class p extends g {
22
22
  constructor(e) {
23
23
  super();