@vindral/web-sdk 4.1.9 → 4.1.10

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/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,51 @@ 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;
98
+ declare class UserAgentInformation {
99
+ private highEntropyValues?;
100
+ constructor();
101
+ getUserAgentInformation(): {
102
+ locationOrigin: string;
103
+ locationPath: string;
104
+ ancestorOrigins: string[] | undefined;
105
+ hardwareConcurrency: number;
106
+ deviceMemory: number | undefined;
107
+ userAgentLegacy: string;
108
+ ua: {
109
+ browser: {
110
+ brands: string[];
111
+ fullVersionBrands: string[];
112
+ majorVersions: string[];
113
+ };
114
+ device: string;
115
+ os: {
116
+ family: string;
117
+ version: string;
118
+ major_version: number;
119
+ };
120
+ };
121
+ } | {
122
+ locationOrigin: string;
123
+ locationPath: string;
124
+ ancestorOrigins: string[] | undefined;
125
+ hardwareConcurrency: number;
126
+ deviceMemory: number | undefined;
127
+ userAgent: string;
128
+ };
143
129
  }
144
- interface TracksCatalog extends CatalogRoot {
145
- namespace: Namespace;
146
- tracks: Array<TrackObject>;
130
+ export type AudioCodec = "aac" | "opus" | "mp3";
131
+ export type VideoCodec = "h264" | "av1";
132
+ /**
133
+ * The current reconnect state to use to decide whether to kep reconnecting or not
134
+ */
135
+ export interface ReconnectState {
136
+ /**
137
+ * The number or retry attempts so far.
138
+ * This gets reset on every successful connect, so it will start from zero every
139
+ * time the client instance gets disconnected and will increment until the
140
+ * client instance makes a connection attempt is successful.
141
+ */
142
+ reconnectRetries: number;
147
143
  }
148
144
  interface RenditionProps {
149
145
  id: number;
@@ -192,85 +188,6 @@ export type VideoRendition = VideoRenditionProps & RenditionProps;
192
188
  export type AudioRendition = AudioRenditionProps & RenditionProps;
193
189
  type TextRendition = TextRenditionProps & RenditionProps;
194
190
  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
191
  /**
275
192
  * Represents a size with a width and height.
276
193
  */
@@ -334,6 +251,7 @@ export interface DrmOptions {
334
251
  * Type of media.
335
252
  */
336
253
  export type Media = "audio" | "video" | "audio+video";
254
+ type WebCodecsHardwareAccelerationPreference = "no-preference" | "prefer-hardware" | "prefer-software";
337
255
  /**
338
256
  * Options for the Vindral instance
339
257
  *
@@ -538,6 +456,38 @@ export interface Options {
538
456
  * Enables iOS devices to use a media element for playback. This enables fullscreen and picture in picture support on iOS.
539
457
  */
540
458
  iosMediaElementEnabled?: boolean;
459
+ /**
460
+ * Enable WebCodecs API for hardware-accelerated decoding.
461
+ *
462
+ * When enabled, the browser's native VideoDecoder and AudioDecoder APIs will be used instead
463
+ * of WASM decoding on supported browsers (Chrome 94+, Edge 94+, Safari 16.4+). This provides:
464
+ * - Hardware-accelerated decoding (uses GPU for video)
465
+ * - Better performance at higher resolutions
466
+ * - Lower CPU usage and battery consumption
467
+ *
468
+ * Disabled by default to allow gradual rollout and testing.
469
+ *
470
+ * Note: Automatically falls back to WASM decoding if:
471
+ * - The browser doesn't support WebCodecs
472
+ * - WebCodecs initialization fails
473
+ * - This option is set to false or undefined
474
+ */
475
+ webcodecsEnabled?: boolean;
476
+ /**
477
+ * Hardware acceleration preference for WebCodecs video decoding.
478
+ *
479
+ * Defaults to `"no-preference"`.
480
+ */
481
+ webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
482
+ /**
483
+ * Enable OffscreenCanvas rendering in worker thread (requires webcodecsEnabled: true).
484
+ *
485
+ * When enabled, video rendering happens in the worker thread using OffscreenCanvas.
486
+ * Disabled by default to allow gradual rollout and testing.
487
+ *
488
+ * Note: Requires browser support for OffscreenCanvas and webcodecsEnabled must be true, and iosMediaElementEnabled must be false.
489
+ */
490
+ offscreenCanvasEnabled?: boolean;
541
491
  /**
542
492
  * Advanced options to override default behaviour.
543
493
  */
@@ -549,6 +499,124 @@ export interface Options {
549
499
  */
550
500
  drm?: DrmOptions;
551
501
  }
502
+ interface ClientOverrides {
503
+ maxVideoBitRate?: number;
504
+ minBufferTime?: number;
505
+ maxBufferTime?: number;
506
+ burstEnabled?: boolean;
507
+ sizeBasedResolutionCapEnabled?: boolean;
508
+ separateVideoSocketEnabled?: boolean;
509
+ webcodecsEnabled?: boolean;
510
+ webcodecsHardwareAcceleration?: WebCodecsHardwareAccelerationPreference;
511
+ offscreenCanvasEnabled?: boolean;
512
+ videoCodecs?: string[];
513
+ }
514
+ type Namespace = Tagged<Array<string>, "Namespace">;
515
+ interface TrackObject {
516
+ namespace?: Namespace;
517
+ name: string;
518
+ format: string;
519
+ label?: string;
520
+ renderGroup?: number;
521
+ altGroup?: number;
522
+ initData?: string;
523
+ initTrack?: string;
524
+ depends?: Array<string>;
525
+ temporalId?: number;
526
+ spatialId?: number;
527
+ codec?: string;
528
+ mimeType?: string;
529
+ framerate?: [
530
+ number,
531
+ number
532
+ ];
533
+ bitrate?: number;
534
+ width?: number;
535
+ height?: number;
536
+ samplerate?: number;
537
+ channelConfig?: string;
538
+ displayWidth?: number;
539
+ displayHeight?: number;
540
+ language?: string;
541
+ ["com.vindral.variant_uid"]?: string;
542
+ ["com.vindral.drm"]?: string;
543
+ }
544
+ interface CatalogRoot {
545
+ version: number;
546
+ streamingFormat?: number;
547
+ streamingFormatVersion?: string;
548
+ }
549
+ interface TracksCatalog extends CatalogRoot {
550
+ namespace: Namespace;
551
+ tracks: Array<TrackObject>;
552
+ }
553
+ interface Telemetry {
554
+ url: string;
555
+ probability?: number;
556
+ includeErrors?: boolean;
557
+ includeEvents?: boolean;
558
+ includeStats?: boolean;
559
+ maxRetries?: number;
560
+ maxErrorReports?: number;
561
+ interval?: number;
562
+ }
563
+ interface ChannelWithCatalog extends Channel {
564
+ catalog: TracksCatalog;
565
+ renditions: Rendition[];
566
+ overrides?: ClientOverrides;
567
+ }
568
+ interface ChannelWithRenditions extends Channel {
569
+ renditions: Rendition[];
570
+ overrides?: ClientOverrides;
571
+ }
572
+ interface ServerCertificateHash {
573
+ algorithm: string;
574
+ value: string;
575
+ }
576
+ interface Edge {
577
+ moqUrl?: string;
578
+ moqWsUrl: string;
579
+ serverCertificateHashes?: ServerCertificateHash[];
580
+ }
581
+ interface MoQConnectInfo {
582
+ logsUrl?: string;
583
+ statsUrl?: string;
584
+ telemetry?: Telemetry;
585
+ channels: ChannelWithCatalog[];
586
+ edges: Edge[];
587
+ timeshift: {
588
+ urls: string[];
589
+ duration: string;
590
+ };
591
+ }
592
+ interface VindralConnectInfo {
593
+ logsUrl?: string;
594
+ statsUrl?: string;
595
+ telemetry?: Telemetry;
596
+ channels: ChannelWithRenditions[];
597
+ edges: string[];
598
+ }
599
+ export type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
600
+ /**
601
+ * Represents a timed metadata event
602
+ */
603
+ export interface Metadata {
604
+ /**
605
+ * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
606
+ */
607
+ content: string;
608
+ /**
609
+ * Timestamp in ms
610
+ */
611
+ timestamp: number;
612
+ }
613
+ /** */
614
+ export interface TimeRange {
615
+ /** */
616
+ start: number;
617
+ /** */
618
+ end: number;
619
+ }
552
620
  /**
553
621
  * Represents a rendition (quality level).
554
622
  */
@@ -928,38 +996,6 @@ interface VideoPlayerStatistics {
928
996
  contextLostCount: number;
929
997
  contextRestoredCount: number;
930
998
  }
931
- declare class UserAgentInformation {
932
- private highEntropyValues?;
933
- constructor();
934
- getUserAgentInformation(): {
935
- locationOrigin: string;
936
- locationPath: string;
937
- ancestorOrigins: string[] | undefined;
938
- hardwareConcurrency: number;
939
- deviceMemory: number | undefined;
940
- userAgentLegacy: string;
941
- ua: {
942
- browser: {
943
- brands: string[];
944
- fullVersionBrands: string[];
945
- majorVersions: string[];
946
- };
947
- device: string;
948
- os: {
949
- family: string;
950
- version: string;
951
- major_version: number;
952
- };
953
- };
954
- } | {
955
- locationOrigin: string;
956
- locationPath: string;
957
- ancestorOrigins: string[] | undefined;
958
- hardwareConcurrency: number;
959
- deviceMemory: number | undefined;
960
- userAgent: string;
961
- };
962
- }
963
999
  type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & JitterModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
964
1000
  /**
965
1001
  * Contains internal statistics.