@vindral/web-sdk 4.1.8 → 4.1.9-10-g6fb644c9

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/core.d.ts CHANGED
@@ -20,17 +20,6 @@ interface Channel {
20
20
  */
21
21
  timeshiftUrls?: string[];
22
22
  }
23
- interface ClientOverrides {
24
- maxVideoBitRate?: number;
25
- minBufferTime?: number;
26
- maxBufferTime?: number;
27
- burstEnabled?: boolean;
28
- sizeBasedResolutionCapEnabled?: boolean;
29
- separateVideoSocketEnabled?: boolean;
30
- videoCodecs?: string[];
31
- }
32
- export type AudioCodec = "aac" | "opus" | "mp3";
33
- export type VideoCodec = "h264" | "av1";
34
23
  interface MinMaxAverage {
35
24
  last: number;
36
25
  /**
@@ -103,44 +92,19 @@ type Tagged<BaseType, Tag extends PropertyKey> = BaseType & {
103
92
  [K in Tag]: void;
104
93
  };
105
94
  };
106
- type Namespace = Tagged<Array<string>, "Namespace">;
107
- interface TrackObject {
108
- namespace?: Namespace;
109
- name: string;
110
- format: string;
111
- label?: string;
112
- renderGroup?: number;
113
- altGroup?: number;
114
- initData?: string;
115
- initTrack?: string;
116
- depends?: Array<string>;
117
- temporalId?: number;
118
- spatialId?: number;
119
- codec?: string;
120
- mimeType?: string;
121
- framerate?: [
122
- number,
123
- number
124
- ];
125
- bitrate?: number;
126
- width?: number;
127
- height?: number;
128
- samplerate?: number;
129
- channelConfig?: string;
130
- displayWidth?: number;
131
- displayHeight?: number;
132
- language?: string;
133
- ["com.vindral.variant_uid"]?: string;
134
- ["com.vindral.drm"]?: string;
135
- }
136
- interface CatalogRoot {
137
- version: number;
138
- streamingFormat?: number;
139
- streamingFormatVersion?: string;
140
- }
141
- interface TracksCatalog extends CatalogRoot {
142
- namespace: Namespace;
143
- tracks: Array<TrackObject>;
95
+ export type AudioCodec = "aac" | "opus" | "mp3";
96
+ export type VideoCodec = "h264" | "av1";
97
+ /**
98
+ * The current reconnect state to use to decide whether to kep reconnecting or not
99
+ */
100
+ export interface ReconnectState {
101
+ /**
102
+ * The number or retry attempts so far.
103
+ * This gets reset on every successful connect, so it will start from zero every
104
+ * time the client instance gets disconnected and will increment until the
105
+ * client instance makes a connection attempt is successful.
106
+ */
107
+ reconnectRetries: number;
144
108
  }
145
109
  interface RenditionProps {
146
110
  id: number;
@@ -189,85 +153,6 @@ export type VideoRendition = VideoRenditionProps & RenditionProps;
189
153
  export type AudioRendition = AudioRenditionProps & RenditionProps;
190
154
  type TextRendition = TextRenditionProps & RenditionProps;
191
155
  type Rendition = VideoRendition | AudioRendition | TextRendition;
192
- interface Telemetry {
193
- url: string;
194
- probability?: number;
195
- includeErrors?: boolean;
196
- includeEvents?: boolean;
197
- includeStats?: boolean;
198
- maxRetries?: number;
199
- maxErrorReports?: number;
200
- interval?: number;
201
- }
202
- interface ChannelWithCatalog extends Channel {
203
- catalog: TracksCatalog;
204
- renditions: Rendition[];
205
- overrides?: ClientOverrides;
206
- }
207
- interface ChannelWithRenditions extends Channel {
208
- renditions: Rendition[];
209
- overrides?: ClientOverrides;
210
- }
211
- interface ServerCertificateHash {
212
- algorithm: string;
213
- value: string;
214
- }
215
- interface Edge {
216
- moqUrl?: string;
217
- moqWsUrl: string;
218
- serverCertificateHashes?: ServerCertificateHash[];
219
- }
220
- interface MoQConnectInfo {
221
- logsUrl?: string;
222
- statsUrl?: string;
223
- telemetry?: Telemetry;
224
- channels: ChannelWithCatalog[];
225
- edges: Edge[];
226
- timeshift: {
227
- urls: string[];
228
- duration: string;
229
- };
230
- }
231
- interface VindralConnectInfo {
232
- logsUrl?: string;
233
- statsUrl?: string;
234
- telemetry?: Telemetry;
235
- channels: ChannelWithRenditions[];
236
- edges: string[];
237
- }
238
- type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
239
- /**
240
- * Represents a timed metadata event
241
- */
242
- export interface Metadata {
243
- /**
244
- * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
245
- */
246
- content: string;
247
- /**
248
- * Timestamp in ms
249
- */
250
- timestamp: number;
251
- }
252
- /** */
253
- export interface TimeRange {
254
- /** */
255
- start: number;
256
- /** */
257
- end: number;
258
- }
259
- /**
260
- * The current reconnect state to use to decide whether to kep reconnecting or not
261
- */
262
- export interface ReconnectState {
263
- /**
264
- * The number or retry attempts so far.
265
- * This gets reset on every successful connect, so it will start from zero every
266
- * time the client instance gets disconnected and will increment until the
267
- * client instance makes a connection attempt is successful.
268
- */
269
- reconnectRetries: number;
270
- }
271
156
  /**
272
157
  * Represents a size with a width and height.
273
158
  */
@@ -331,6 +216,7 @@ export interface DrmOptions {
331
216
  * Type of media.
332
217
  */
333
218
  export type Media = "audio" | "video" | "audio+video";
219
+ type WebCodecsHardwareAccelerationPreference = "no-preference" | "prefer-hardware" | "prefer-software";
334
220
  /**
335
221
  * Options for the Vindral instance
336
222
  *
@@ -535,6 +421,38 @@ export interface Options {
535
421
  * Enables iOS devices to use a media element for playback. This enables fullscreen and picture in picture support on iOS.
536
422
  */
537
423
  iosMediaElementEnabled?: boolean;
424
+ /**
425
+ * Enable WebCodecs API for hardware-accelerated decoding.
426
+ *
427
+ * When enabled, the browser's native VideoDecoder and AudioDecoder APIs will be used instead
428
+ * of WASM decoding on supported browsers (Chrome 94+, Edge 94+, Safari 16.4+). This provides:
429
+ * - Hardware-accelerated decoding (uses GPU for video)
430
+ * - Better performance at higher resolutions
431
+ * - Lower CPU usage and battery consumption
432
+ *
433
+ * Disabled by default to allow gradual rollout and testing.
434
+ *
435
+ * Note: Automatically falls back to WASM decoding if:
436
+ * - The browser doesn't support WebCodecs
437
+ * - WebCodecs initialization fails
438
+ * - This option is set to false or undefined
439
+ */
440
+ webcodecsEnabled?: boolean;
441
+ /**
442
+ * Hardware acceleration preference for WebCodecs video decoding.
443
+ *
444
+ * Defaults to `"no-preference"`.
445
+ */
446
+ webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
447
+ /**
448
+ * Enable OffscreenCanvas rendering in worker thread (requires webcodecsEnabled: true).
449
+ *
450
+ * When enabled, video rendering happens in the worker thread using OffscreenCanvas.
451
+ * Disabled by default to allow gradual rollout and testing.
452
+ *
453
+ * Note: Requires browser support for OffscreenCanvas and webcodecsEnabled must be true, and iosMediaElementEnabled must be false.
454
+ */
455
+ offscreenCanvasEnabled?: boolean;
538
456
  /**
539
457
  * Advanced options to override default behaviour.
540
458
  */
@@ -546,6 +464,124 @@ export interface Options {
546
464
  */
547
465
  drm?: DrmOptions;
548
466
  }
467
+ interface ClientOverrides {
468
+ maxVideoBitRate?: number;
469
+ minBufferTime?: number;
470
+ maxBufferTime?: number;
471
+ burstEnabled?: boolean;
472
+ sizeBasedResolutionCapEnabled?: boolean;
473
+ separateVideoSocketEnabled?: boolean;
474
+ webcodecsEnabled?: boolean;
475
+ webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
476
+ offscreenCanvasEnabled?: boolean;
477
+ videoCodecs?: string[];
478
+ }
479
+ type Namespace = Tagged<Array<string>, "Namespace">;
480
+ interface TrackObject {
481
+ namespace?: Namespace;
482
+ name: string;
483
+ format: string;
484
+ label?: string;
485
+ renderGroup?: number;
486
+ altGroup?: number;
487
+ initData?: string;
488
+ initTrack?: string;
489
+ depends?: Array<string>;
490
+ temporalId?: number;
491
+ spatialId?: number;
492
+ codec?: string;
493
+ mimeType?: string;
494
+ framerate?: [
495
+ number,
496
+ number
497
+ ];
498
+ bitrate?: number;
499
+ width?: number;
500
+ height?: number;
501
+ samplerate?: number;
502
+ channelConfig?: string;
503
+ displayWidth?: number;
504
+ displayHeight?: number;
505
+ language?: string;
506
+ ["com.vindral.variant_uid"]?: string;
507
+ ["com.vindral.drm"]?: string;
508
+ }
509
+ interface CatalogRoot {
510
+ version: number;
511
+ streamingFormat?: number;
512
+ streamingFormatVersion?: string;
513
+ }
514
+ interface TracksCatalog extends CatalogRoot {
515
+ namespace: Namespace;
516
+ tracks: Array<TrackObject>;
517
+ }
518
+ interface Telemetry {
519
+ url: string;
520
+ probability?: number;
521
+ includeErrors?: boolean;
522
+ includeEvents?: boolean;
523
+ includeStats?: boolean;
524
+ maxRetries?: number;
525
+ maxErrorReports?: number;
526
+ interval?: number;
527
+ }
528
+ interface ChannelWithCatalog extends Channel {
529
+ catalog: TracksCatalog;
530
+ renditions: Rendition[];
531
+ overrides?: ClientOverrides;
532
+ }
533
+ interface ChannelWithRenditions extends Channel {
534
+ renditions: Rendition[];
535
+ overrides?: ClientOverrides;
536
+ }
537
+ interface ServerCertificateHash {
538
+ algorithm: string;
539
+ value: string;
540
+ }
541
+ interface Edge {
542
+ moqUrl?: string;
543
+ moqWsUrl: string;
544
+ serverCertificateHashes?: ServerCertificateHash[];
545
+ }
546
+ interface MoQConnectInfo {
547
+ logsUrl?: string;
548
+ statsUrl?: string;
549
+ telemetry?: Telemetry;
550
+ channels: ChannelWithCatalog[];
551
+ edges: Edge[];
552
+ timeshift: {
553
+ urls: string[];
554
+ duration: string;
555
+ };
556
+ }
557
+ interface VindralConnectInfo {
558
+ logsUrl?: string;
559
+ statsUrl?: string;
560
+ telemetry?: Telemetry;
561
+ channels: ChannelWithRenditions[];
562
+ edges: string[];
563
+ }
564
+ type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
565
+ /**
566
+ * Represents a timed metadata event
567
+ */
568
+ export interface Metadata {
569
+ /**
570
+ * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
571
+ */
572
+ content: string;
573
+ /**
574
+ * Timestamp in ms
575
+ */
576
+ timestamp: number;
577
+ }
578
+ /** */
579
+ export interface TimeRange {
580
+ /** */
581
+ start: number;
582
+ /** */
583
+ end: number;
584
+ }
549
585
  /**
550
586
  * Represents a rendition (quality level).
551
587
  */
package/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as C, e as I, f as _, a as O, C as D, D as T, I as a, N as A, V as s, g as r } from "./47j9Rb9g.js";
1
+ import { c as C, e as I, f as _, a as O, C as D, D as T, I as a, N as A, V as s, g as r } from "./C6dcH4vo.js";
2
2
  export {
3
3
  C as AUTHENTICATION_EXPIRED_CODE,
4
4
  I as AUTHENTICATION_FAILED_CODE,
package/legacy.d.ts CHANGED
@@ -23,17 +23,6 @@ export interface Channel {
23
23
  */
24
24
  timeshiftUrls?: string[];
25
25
  }
26
- interface ClientOverrides {
27
- maxVideoBitRate?: number;
28
- minBufferTime?: number;
29
- maxBufferTime?: number;
30
- burstEnabled?: boolean;
31
- sizeBasedResolutionCapEnabled?: boolean;
32
- separateVideoSocketEnabled?: boolean;
33
- videoCodecs?: string[];
34
- }
35
- export type AudioCodec = "aac" | "opus" | "mp3";
36
- export type VideoCodec = "h264" | "av1";
37
26
  interface MinMaxAverage {
38
27
  last: number;
39
28
  /**
@@ -106,44 +95,19 @@ type Tagged<BaseType, Tag extends PropertyKey> = BaseType & {
106
95
  [K in Tag]: void;
107
96
  };
108
97
  };
109
- type Namespace = Tagged<Array<string>, "Namespace">;
110
- interface TrackObject {
111
- namespace?: Namespace;
112
- name: string;
113
- format: string;
114
- label?: string;
115
- renderGroup?: number;
116
- altGroup?: number;
117
- initData?: string;
118
- initTrack?: string;
119
- depends?: Array<string>;
120
- temporalId?: number;
121
- spatialId?: number;
122
- codec?: string;
123
- mimeType?: string;
124
- framerate?: [
125
- number,
126
- number
127
- ];
128
- bitrate?: number;
129
- width?: number;
130
- height?: number;
131
- samplerate?: number;
132
- channelConfig?: string;
133
- displayWidth?: number;
134
- displayHeight?: number;
135
- language?: string;
136
- ["com.vindral.variant_uid"]?: string;
137
- ["com.vindral.drm"]?: string;
138
- }
139
- interface CatalogRoot {
140
- version: number;
141
- streamingFormat?: number;
142
- streamingFormatVersion?: string;
143
- }
144
- interface TracksCatalog extends CatalogRoot {
145
- namespace: Namespace;
146
- tracks: Array<TrackObject>;
98
+ export type AudioCodec = "aac" | "opus" | "mp3";
99
+ export type VideoCodec = "h264" | "av1";
100
+ /**
101
+ * The current reconnect state to use to decide whether to kep reconnecting or not
102
+ */
103
+ export interface ReconnectState {
104
+ /**
105
+ * The number or retry attempts so far.
106
+ * This gets reset on every successful connect, so it will start from zero every
107
+ * time the client instance gets disconnected and will increment until the
108
+ * client instance makes a connection attempt is successful.
109
+ */
110
+ reconnectRetries: number;
147
111
  }
148
112
  interface RenditionProps {
149
113
  id: number;
@@ -192,85 +156,6 @@ export type VideoRendition = VideoRenditionProps & RenditionProps;
192
156
  export type AudioRendition = AudioRenditionProps & RenditionProps;
193
157
  type TextRendition = TextRenditionProps & RenditionProps;
194
158
  type Rendition = VideoRendition | AudioRendition | TextRendition;
195
- interface Telemetry {
196
- url: string;
197
- probability?: number;
198
- includeErrors?: boolean;
199
- includeEvents?: boolean;
200
- includeStats?: boolean;
201
- maxRetries?: number;
202
- maxErrorReports?: number;
203
- interval?: number;
204
- }
205
- interface ChannelWithCatalog extends Channel {
206
- catalog: TracksCatalog;
207
- renditions: Rendition[];
208
- overrides?: ClientOverrides;
209
- }
210
- interface ChannelWithRenditions extends Channel {
211
- renditions: Rendition[];
212
- overrides?: ClientOverrides;
213
- }
214
- interface ServerCertificateHash {
215
- algorithm: string;
216
- value: string;
217
- }
218
- interface Edge {
219
- moqUrl?: string;
220
- moqWsUrl: string;
221
- serverCertificateHashes?: ServerCertificateHash[];
222
- }
223
- interface MoQConnectInfo {
224
- logsUrl?: string;
225
- statsUrl?: string;
226
- telemetry?: Telemetry;
227
- channels: ChannelWithCatalog[];
228
- edges: Edge[];
229
- timeshift: {
230
- urls: string[];
231
- duration: string;
232
- };
233
- }
234
- interface VindralConnectInfo {
235
- logsUrl?: string;
236
- statsUrl?: string;
237
- telemetry?: Telemetry;
238
- channels: ChannelWithRenditions[];
239
- edges: string[];
240
- }
241
- export type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
242
- /**
243
- * Represents a timed metadata event
244
- */
245
- export interface Metadata {
246
- /**
247
- * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
248
- */
249
- content: string;
250
- /**
251
- * Timestamp in ms
252
- */
253
- timestamp: number;
254
- }
255
- /** */
256
- export interface TimeRange {
257
- /** */
258
- start: number;
259
- /** */
260
- end: number;
261
- }
262
- /**
263
- * The current reconnect state to use to decide whether to kep reconnecting or not
264
- */
265
- export interface ReconnectState {
266
- /**
267
- * The number or retry attempts so far.
268
- * This gets reset on every successful connect, so it will start from zero every
269
- * time the client instance gets disconnected and will increment until the
270
- * client instance makes a connection attempt is successful.
271
- */
272
- reconnectRetries: number;
273
- }
274
159
  /**
275
160
  * Represents a size with a width and height.
276
161
  */
@@ -334,6 +219,7 @@ export interface DrmOptions {
334
219
  * Type of media.
335
220
  */
336
221
  export type Media = "audio" | "video" | "audio+video";
222
+ type WebCodecsHardwareAccelerationPreference = "no-preference" | "prefer-hardware" | "prefer-software";
337
223
  /**
338
224
  * Options for the Vindral instance
339
225
  *
@@ -538,6 +424,38 @@ export interface Options {
538
424
  * Enables iOS devices to use a media element for playback. This enables fullscreen and picture in picture support on iOS.
539
425
  */
540
426
  iosMediaElementEnabled?: boolean;
427
+ /**
428
+ * Enable WebCodecs API for hardware-accelerated decoding.
429
+ *
430
+ * When enabled, the browser's native VideoDecoder and AudioDecoder APIs will be used instead
431
+ * of WASM decoding on supported browsers (Chrome 94+, Edge 94+, Safari 16.4+). This provides:
432
+ * - Hardware-accelerated decoding (uses GPU for video)
433
+ * - Better performance at higher resolutions
434
+ * - Lower CPU usage and battery consumption
435
+ *
436
+ * Disabled by default to allow gradual rollout and testing.
437
+ *
438
+ * Note: Automatically falls back to WASM decoding if:
439
+ * - The browser doesn't support WebCodecs
440
+ * - WebCodecs initialization fails
441
+ * - This option is set to false or undefined
442
+ */
443
+ webcodecsEnabled?: boolean;
444
+ /**
445
+ * Hardware acceleration preference for WebCodecs video decoding.
446
+ *
447
+ * Defaults to `"no-preference"`.
448
+ */
449
+ webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
450
+ /**
451
+ * Enable OffscreenCanvas rendering in worker thread (requires webcodecsEnabled: true).
452
+ *
453
+ * When enabled, video rendering happens in the worker thread using OffscreenCanvas.
454
+ * Disabled by default to allow gradual rollout and testing.
455
+ *
456
+ * Note: Requires browser support for OffscreenCanvas and webcodecsEnabled must be true, and iosMediaElementEnabled must be false.
457
+ */
458
+ offscreenCanvasEnabled?: boolean;
541
459
  /**
542
460
  * Advanced options to override default behaviour.
543
461
  */
@@ -549,6 +467,124 @@ export interface Options {
549
467
  */
550
468
  drm?: DrmOptions;
551
469
  }
470
+ interface ClientOverrides {
471
+ maxVideoBitRate?: number;
472
+ minBufferTime?: number;
473
+ maxBufferTime?: number;
474
+ burstEnabled?: boolean;
475
+ sizeBasedResolutionCapEnabled?: boolean;
476
+ separateVideoSocketEnabled?: boolean;
477
+ webcodecsEnabled?: boolean;
478
+ webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
479
+ offscreenCanvasEnabled?: boolean;
480
+ videoCodecs?: string[];
481
+ }
482
+ type Namespace = Tagged<Array<string>, "Namespace">;
483
+ interface TrackObject {
484
+ namespace?: Namespace;
485
+ name: string;
486
+ format: string;
487
+ label?: string;
488
+ renderGroup?: number;
489
+ altGroup?: number;
490
+ initData?: string;
491
+ initTrack?: string;
492
+ depends?: Array<string>;
493
+ temporalId?: number;
494
+ spatialId?: number;
495
+ codec?: string;
496
+ mimeType?: string;
497
+ framerate?: [
498
+ number,
499
+ number
500
+ ];
501
+ bitrate?: number;
502
+ width?: number;
503
+ height?: number;
504
+ samplerate?: number;
505
+ channelConfig?: string;
506
+ displayWidth?: number;
507
+ displayHeight?: number;
508
+ language?: string;
509
+ ["com.vindral.variant_uid"]?: string;
510
+ ["com.vindral.drm"]?: string;
511
+ }
512
+ interface CatalogRoot {
513
+ version: number;
514
+ streamingFormat?: number;
515
+ streamingFormatVersion?: string;
516
+ }
517
+ interface TracksCatalog extends CatalogRoot {
518
+ namespace: Namespace;
519
+ tracks: Array<TrackObject>;
520
+ }
521
+ interface Telemetry {
522
+ url: string;
523
+ probability?: number;
524
+ includeErrors?: boolean;
525
+ includeEvents?: boolean;
526
+ includeStats?: boolean;
527
+ maxRetries?: number;
528
+ maxErrorReports?: number;
529
+ interval?: number;
530
+ }
531
+ interface ChannelWithCatalog extends Channel {
532
+ catalog: TracksCatalog;
533
+ renditions: Rendition[];
534
+ overrides?: ClientOverrides;
535
+ }
536
+ interface ChannelWithRenditions extends Channel {
537
+ renditions: Rendition[];
538
+ overrides?: ClientOverrides;
539
+ }
540
+ interface ServerCertificateHash {
541
+ algorithm: string;
542
+ value: string;
543
+ }
544
+ interface Edge {
545
+ moqUrl?: string;
546
+ moqWsUrl: string;
547
+ serverCertificateHashes?: ServerCertificateHash[];
548
+ }
549
+ interface MoQConnectInfo {
550
+ logsUrl?: string;
551
+ statsUrl?: string;
552
+ telemetry?: Telemetry;
553
+ channels: ChannelWithCatalog[];
554
+ edges: Edge[];
555
+ timeshift: {
556
+ urls: string[];
557
+ duration: string;
558
+ };
559
+ }
560
+ interface VindralConnectInfo {
561
+ logsUrl?: string;
562
+ statsUrl?: string;
563
+ telemetry?: Telemetry;
564
+ channels: ChannelWithRenditions[];
565
+ edges: string[];
566
+ }
567
+ export type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
568
+ /**
569
+ * Represents a timed metadata event
570
+ */
571
+ export interface Metadata {
572
+ /**
573
+ * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
574
+ */
575
+ content: string;
576
+ /**
577
+ * Timestamp in ms
578
+ */
579
+ timestamp: number;
580
+ }
581
+ /** */
582
+ export interface TimeRange {
583
+ /** */
584
+ start: number;
585
+ /** */
586
+ end: number;
587
+ }
552
588
  /**
553
589
  * Represents a rendition (quality level).
554
590
  */