@vindral/web-sdk 3.4.4 → 4.0.0-101-g094c7a1b

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/player.d.ts ADDED
@@ -0,0 +1,1720 @@
1
+ interface Channel {
2
+ /**
3
+ * Channel ID for the channel
4
+ */
5
+ channelId: string;
6
+ /**
7
+ * Display name
8
+ */
9
+ name: string;
10
+ /**
11
+ * Indicates whether there is an incoming source feed for the channel
12
+ */
13
+ isLive: boolean;
14
+ /**
15
+ * URLs to fetch thumbnail from
16
+ */
17
+ thumbnailUrls: string[];
18
+ }
19
+ interface ClientOverrides {
20
+ maxVideoBitRate?: number;
21
+ minBufferTime?: number;
22
+ maxBufferTime?: number;
23
+ burstEnabled?: boolean;
24
+ sizeBasedResolutionCapEnabled?: boolean;
25
+ separateVideoSocketEnabled?: boolean;
26
+ videoCodecs?: string[];
27
+ }
28
+ type AudioCodec = "aac" | "opus" | "mp3";
29
+ type VideoCodec = "h264" | "av1";
30
+ type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
31
+ type VoidKeys<Record> = MatchingKeys<Record, void>;
32
+ type EventListenerReturnType = (() => void) | void;
33
+ declare class Emitter<TEvents, TEmits = TEvents, ArgLessEvents extends VoidKeys<TEvents> = VoidKeys<TEvents>, ArgEvents extends Exclude<keyof TEvents, ArgLessEvents> = Exclude<keyof TEvents, ArgLessEvents>, ArgLessEmits extends VoidKeys<TEmits> = VoidKeys<TEmits>, ArgEmits extends Exclude<keyof TEmits, ArgLessEmits> = Exclude<keyof TEmits, ArgLessEmits>> {
34
+ private listeners;
35
+ emit<T extends ArgLessEmits>(eventName: T): void;
36
+ emit<T extends ArgEmits>(eventName: T, args: TEmits[T]): void;
37
+ /**
38
+ * Remove an event listener from `eventName`
39
+ */
40
+ off<T extends ArgLessEvents>(eventName: T, fn: () => EventListenerReturnType): void;
41
+ off<T extends ArgEvents>(eventName: T, fn: (args: TEvents[T]) => EventListenerReturnType): void;
42
+ /**
43
+ * Add an event listener to `eventName`
44
+ *
45
+ * Event listeners may optionally return a "defer function" that will be called once all other listeners have been called.
46
+ * This is useful when one listener may want everone to have reacted to an event before calling something.
47
+ */
48
+ on<T extends ArgLessEvents>(eventName: T, fn: () => void): void;
49
+ on<T extends ArgEvents>(eventName: T, fn: (args: TEvents[T]) => void): void;
50
+ /**
51
+ * Add an event listener to `eventName` that will be called once only
52
+ *
53
+ * Event listeners may optionally return a "defer function" that will be called once all other listeners have been called.
54
+ * This is useful when one listener may want everone to have reacted to an event before calling something.
55
+ */
56
+ once<T extends ArgLessEvents>(eventName: T, fn: () => void): void;
57
+ once<T extends ArgEvents>(eventName: T, fn: (args: TEvents[T]) => void): void;
58
+ /**
59
+ * Reset the event emitter
60
+ */
61
+ reset(): void;
62
+ private add;
63
+ }
64
+ declare const LogLevels: readonly [
65
+ "off",
66
+ "error",
67
+ "warn",
68
+ "info",
69
+ "debug",
70
+ "trace"
71
+ ];
72
+ type LogLevel = (typeof LogLevels)[number];
73
+ declare const LogLevel: {
74
+ ERROR: "error";
75
+ WARN: "warn";
76
+ INFO: "info";
77
+ DEBUG: "debug";
78
+ TRACE: "trace";
79
+ OFF: "off";
80
+ };
81
+ interface MinMaxAverage {
82
+ last: number;
83
+ /**
84
+ * Average value over a given interval.
85
+ */
86
+ average: number;
87
+ /**
88
+ * Maximum value over a given interval.
89
+ */
90
+ max: number;
91
+ /**
92
+ * Minimum value over a given interval.
93
+ */
94
+ min: number;
95
+ }
96
+ declare const tags: unique symbol;
97
+ type Tagged<BaseType, Tag extends PropertyKey> = BaseType & {
98
+ [tags]: {
99
+ [K in Tag]: void;
100
+ };
101
+ };
102
+ type Namespace = Tagged<Array<string>, "Namespace">;
103
+ interface TrackObject {
104
+ namespace?: Namespace;
105
+ name: string;
106
+ format: string;
107
+ label?: string;
108
+ renderGroup?: number;
109
+ altGroup?: number;
110
+ initData?: string;
111
+ initTrack?: string;
112
+ depends?: Array<string>;
113
+ temporalId?: number;
114
+ spatialId?: number;
115
+ codec?: string;
116
+ mimeType?: string;
117
+ framerate?: [
118
+ number,
119
+ number
120
+ ];
121
+ bitrate?: number;
122
+ width?: number;
123
+ height?: number;
124
+ samplerate?: number;
125
+ channelConfig?: string;
126
+ displayWidth?: number;
127
+ displayHeight?: number;
128
+ language?: string;
129
+ ["com.vindral.variant_uid"]?: string;
130
+ }
131
+ interface CatalogRoot {
132
+ version: number;
133
+ streamingFormat?: number;
134
+ streamingFormatVersion?: string;
135
+ }
136
+ interface TracksCatalog extends CatalogRoot {
137
+ namespace: Namespace;
138
+ tracks: Array<TrackObject>;
139
+ }
140
+ interface RenditionProps {
141
+ id: number;
142
+ /** */
143
+ bitRate: number;
144
+ /** */
145
+ codecString?: string;
146
+ /** */
147
+ language?: string;
148
+ /** */
149
+ meta?: Record<string, string>;
150
+ }
151
+ interface VideoRenditionProps {
152
+ /** */
153
+ codec: VideoCodec;
154
+ /** */
155
+ frameRate: [
156
+ number,
157
+ number
158
+ ];
159
+ /** */
160
+ width: number;
161
+ /** */
162
+ height: number;
163
+ }
164
+ interface AudioRenditionProps {
165
+ /** */
166
+ codec: AudioCodec;
167
+ /** */
168
+ channels: number;
169
+ /** */
170
+ sampleRate: number;
171
+ }
172
+ interface TextRenditionProps {
173
+ codec: "webvtt";
174
+ kind: "subtitles" | "captions";
175
+ label?: string;
176
+ }
177
+ type VideoRendition = VideoRenditionProps & RenditionProps;
178
+ type AudioRendition = AudioRenditionProps & RenditionProps;
179
+ type TextRendition = TextRenditionProps & RenditionProps;
180
+ type Rendition = VideoRendition | AudioRendition | TextRendition;
181
+ interface Telemetry {
182
+ url: string;
183
+ probability?: number;
184
+ includeErrors?: boolean;
185
+ includeEvents?: boolean;
186
+ includeStats?: boolean;
187
+ maxRetries?: number;
188
+ maxErrorReports?: number;
189
+ interval?: number;
190
+ }
191
+ interface ChannelWithCatalog extends Channel {
192
+ catalog: TracksCatalog;
193
+ renditions: Rendition[];
194
+ overrides?: ClientOverrides;
195
+ }
196
+ interface ChannelWithRenditions extends Channel {
197
+ renditions: Rendition[];
198
+ overrides?: ClientOverrides;
199
+ }
200
+ interface ServerCertificateHash {
201
+ algorithm: string;
202
+ value: string;
203
+ }
204
+ interface Edge {
205
+ moqUrl?: string;
206
+ moqWsUrl: string;
207
+ serverCertificateHashes?: ServerCertificateHash[];
208
+ }
209
+ interface MoQConnectInfo {
210
+ logsUrl?: string;
211
+ statsUrl?: string;
212
+ telemetry?: Telemetry;
213
+ channels: ChannelWithCatalog[];
214
+ edges: Edge[];
215
+ }
216
+ interface VindralConnectInfo {
217
+ logsUrl?: string;
218
+ statsUrl?: string;
219
+ telemetry?: Telemetry;
220
+ channels: ChannelWithRenditions[];
221
+ edges: string[];
222
+ }
223
+ type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
224
+ interface Metadata {
225
+ /**
226
+ * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
227
+ */
228
+ content: string;
229
+ /**
230
+ * Timestamp in ms
231
+ */
232
+ timestamp: number;
233
+ }
234
+ interface TimeRange {
235
+ /** */
236
+ start: number;
237
+ /** */
238
+ end: number;
239
+ }
240
+ interface ReconnectState {
241
+ /**
242
+ * The number or retry attempts so far.
243
+ * This gets reset on every successful connect, so it will start from zero every
244
+ * time the client instance gets disconnected and will increment until the
245
+ * client instance makes a connection attempt is successful.
246
+ */
247
+ reconnectRetries: number;
248
+ }
249
+ interface Size {
250
+ /** */
251
+ width: number;
252
+ /** */
253
+ height: number;
254
+ }
255
+ interface VideoConstraint {
256
+ /** */
257
+ width: number;
258
+ /** */
259
+ height: number;
260
+ /** */
261
+ bitRate: number;
262
+ /** */
263
+ codec?: VideoCodec;
264
+ /** */
265
+ codecString?: string;
266
+ }
267
+ interface AdvancedOptions {
268
+ /**
269
+ * Constrains wasm decoding to this resolution.
270
+ * By default it is set to 1280 in width and height.
271
+ * This guarantees better performance on older devices and reduces battery drain in general.
272
+ */
273
+ wasmDecodingConstraint: Partial<VideoConstraint>;
274
+ }
275
+ interface DrmOptions {
276
+ /**
277
+ * Headers to be added to requests to license servers
278
+ */
279
+ headers?: Record<string, string>;
280
+ /**
281
+ * Query parameters to be added to requests to license servers
282
+ */
283
+ queryParams?: Record<string, string>;
284
+ }
285
+ type Media = "audio" | "video" | "audio+video";
286
+ interface Options {
287
+ /**
288
+ * URL to use when connecting to the stream
289
+ */
290
+ url: string;
291
+ /**
292
+ * Channel ID to connect to initially - can be changed later mid-stream when connected to a channel group.
293
+ */
294
+ channelId: string;
295
+ /**
296
+ * Channel group to connect to
297
+ * Note: Only needed for fast channel switching
298
+ */
299
+ channelGroupId?: string;
300
+ /**
301
+ * A container to attach the video view in - can be provided later with .attach() on the vindral core instance
302
+ */
303
+ container?: HTMLElement;
304
+ /**
305
+ * An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
306
+ * Note: If not supplied when needed, an "Authentication Failed" error will be raised.
307
+ */
308
+ authenticationToken?: string;
309
+ /**
310
+ * Language to use initially - can be changed during during runtime on the vindral instance
311
+ * Note: Only needed when multiple languages are provided - if no language is specified, one will be automatically selected.
312
+ */
313
+ language?: string;
314
+ /**
315
+ * TextTrack to use initially - can be changed during during runtime on the vindral instance
316
+ */
317
+ textTrack?: string;
318
+ /**
319
+ * Sets the log level - defaults to info
320
+ */
321
+ logLevel?: LogLevel;
322
+ /**
323
+ * Sets the minimum and initial buffer time
324
+ */
325
+ minBufferTime?: number;
326
+ /**
327
+ * Sets the maximum buffer time allowed. The vindral instance will automatically slowly increase
328
+ * the buffer time if the use experiences to much buffering with the initial buffer time.
329
+ */
330
+ maxBufferTime?: number;
331
+ /**
332
+ * Enables or disables user bandwidth savings by capping the video resolution to the size of the video element.
333
+ *
334
+ * Is enabled by default.
335
+ *
336
+ * Note: This is automatically set to false when abrEnabled is set to false.
337
+ */
338
+ sizeBasedResolutionCapEnabled?: boolean;
339
+ /**
340
+ * Enables or disables picture in picture support.
341
+ */
342
+ pictureInPictureEnabled?: boolean;
343
+ /**
344
+ * Enable bursting for initial connection and channel switches. This makes time to first frame faster at the
345
+ * cost of stability (more demanding due to the sudden burst of live content)
346
+ *
347
+ * Is disabled by default.
348
+ *
349
+ */
350
+ burstEnabled?: boolean;
351
+ /**
352
+ * Enable usage of the MediaSource API on supported browsers.
353
+ *
354
+ * Is enabled by default.
355
+ *
356
+ * Note: We recommend to keep this at the default value unless you have very specific needs.
357
+ */
358
+ mseEnabled?: boolean;
359
+ /**
360
+ * Enable Opus with the MediaSource API on supported browsers.
361
+ *
362
+ * Is enabled by default.
363
+ *
364
+ */
365
+ mseOpusEnabled?: boolean;
366
+ /**
367
+ * Enable or disable support for playing audio in the background for iOS devices.
368
+ *
369
+ * Is false (disabled) by default.
370
+ *
371
+ * Note: This may be enabled by default in a future (major) release
372
+ */
373
+ iosBackgroundPlayEnabled?: boolean;
374
+ /**
375
+ * Enable or disable Adaptive Bit Rate. This allows for automatically adapting the incoming bit rate based on
376
+ * the viewers bandwidth and thus avoiding buffering events. This also disables the
377
+ * sizeBasedResolutionCapEnabled option.
378
+ *
379
+ * Is enabled by default.
380
+ *
381
+ * Note: It is strongly recommended to keep this enabled as user experience can greatly suffer without ABR.
382
+ */
383
+ abrEnabled?: boolean;
384
+ /**
385
+ * Enable or disable telemetry. This allows for telemetry and errors being collected.
386
+ *
387
+ * Is enabled by default.
388
+ *
389
+ * We appreciate you turning it off during development/staging to not bloat real telemetry data.
390
+ *
391
+ * Note: It is strongly recommended to keep this enabled in production as it is required for insights and KPIs.
392
+ */
393
+ telemetryEnabled?: boolean;
394
+ /**
395
+ * Set a cap on the maximum video size.
396
+ * This can be used to provide user options to limit the video bandwidth usage.
397
+ *
398
+ * Note: This takes presedence over any size based resolution caps.
399
+ */
400
+ maxSize?: Size;
401
+ /**
402
+ * Maximum audio bit rate allowed.
403
+ * This can be used to provide user options to limit the audio bandwidth usage.
404
+ */
405
+ maxAudioBitRate?: number;
406
+ /**
407
+ * Maximum video bit rate allowed.
408
+ * This can be used to provide user options to limit the video bandwidth usage.
409
+ */
410
+ maxVideoBitRate?: number;
411
+ /**
412
+ * Controls video element background behaviour while loading.
413
+ * - If `false`, a black background will be shown.
414
+ * - If undefined or `true`, a live thumbnail will be shown.
415
+ * - If set to a string containing a URL (https://urltoimage), use that.
416
+ * Default `true` - meaning a live thumbnail is shown
417
+ */
418
+ poster?: boolean | string;
419
+ /**
420
+ * Whether to start the player muted or to try to start playing audio automatically.
421
+ */
422
+ muted?: boolean;
423
+ /**
424
+ * Provide a custom reconnect handler to control when the instance should stop trying to
425
+ * reconnect. The reconnect handler should either return true to allow the reconnect or
426
+ * false to stop reconnecting. It can also return a promise with true or false if it needs
427
+ * to make any async calls before determining wether to reconnect.
428
+ *
429
+ * The default reconnect handler allows 30 reconnects before stopping.
430
+ *
431
+ * Note: the ReconnectState gets reset every time the client instance makes a successful connection.
432
+ * This means the default reconnect handler will only stop reconnecting after 30 _consecutive_ failed connections.
433
+ *
434
+ * ```typescript
435
+ * // An example reconnect handler that will reconnect forever
436
+ * const reconnectHandler = (state: ReconnectState) => true
437
+ *
438
+ * // An example reconnect handler that will fetch an url and determine whether to reconnect
439
+ * const reconnectHandler = async (state: ReconnectState) => {
440
+ * const result = await fetch("https://should-i-reconnect-now.com")
441
+ * return result.ok
442
+ * },
443
+ * ```
444
+ */
445
+ reconnectHandler?: (state: ReconnectState) => Promise<boolean> | boolean;
446
+ tags?: string[];
447
+ ownerSessionId?: string;
448
+ edgeUrl?: string;
449
+ logShippingEnabled?: boolean;
450
+ statsShippingEnabled?: boolean;
451
+ webtransportEnabled?: boolean;
452
+ /**
453
+ * Enable wake lock for iOS devices.
454
+ * The wake lock requires that the audio has been activated at least once for the instance, othwerwise it will not work.
455
+ * Other devices already provide wake lock by default.
456
+ *
457
+ * This option is redundant and has no effect if iosMediaElementEnabled is enabled since that automatically enables wake lock.
458
+ *
459
+ * Disabled by default.
460
+ */
461
+ iosWakeLockEnabled?: boolean;
462
+ /**
463
+ * Disabling this will revert to legacy behaviour where Vindral will try to always keep the video element playing.
464
+ */
465
+ pauseSupportEnabled?: boolean;
466
+ /**
467
+ * Enables iOS devices to use a media element for playback. This enables fullscreen and picture in picture support on iOS.
468
+ */
469
+ iosMediaElementEnabled?: boolean;
470
+ /**
471
+ * Advanced options to override default behaviour.
472
+ */
473
+ advanced?: AdvancedOptions;
474
+ media?: Media;
475
+ videoCodecs?: VideoCodec[];
476
+ /**
477
+ * DRM options to provide to the Vindral instance
478
+ */
479
+ drm?: DrmOptions;
480
+ }
481
+ interface RenditionLevel {
482
+ /** */
483
+ audio?: AudioRendition;
484
+ /** */
485
+ video?: VideoRendition;
486
+ }
487
+ interface VindralErrorProps {
488
+ isFatal: boolean;
489
+ type?: ErrorType;
490
+ code: string;
491
+ source?: Error | MediaError;
492
+ }
493
+ type ErrorType = "internal" | "external";
494
+ declare class VindralError extends Error {
495
+ private props;
496
+ private extra;
497
+ constructor(message: string, props: VindralErrorProps, extra?: {});
498
+ /**
499
+ * The error code is a stable string that represents the error type - this should be treated as an
500
+ * opaque string that can be used as a key for looking up localized strings for displaying error messages.
501
+ * @returns the error code
502
+ */
503
+ code: () => string;
504
+ /**
505
+ * Indicates whether the error is fatal - if it is that means the Vindral instance will be unloaded because of this error.
506
+ */
507
+ isFatal: () => boolean;
508
+ /**
509
+ * The underlying error that caused the Vindral error
510
+ * @returns the underlying error
511
+ */
512
+ source: () => Error | MediaError | undefined;
513
+ type: () => ErrorType;
514
+ /**
515
+ * @returns a stringifiable represenation of the error
516
+ */
517
+ toStringifiable: () => Record<string, unknown>;
518
+ }
519
+ type PlaybackState = "buffering" | "playing" | "paused";
520
+ type BufferStateEvent = "filled" | "drained";
521
+ interface PlaybackModuleStatistics {
522
+ /**
523
+ * Current target buffer time if using dynamic buffer. Otherwise, this is the statically set buffer time from instantiation.
524
+ */
525
+ bufferTime: number;
526
+ needsInputForAudioCount: number;
527
+ needsInputForVideoCount: number;
528
+ }
529
+ interface NeedsUserInputContext {
530
+ /**
531
+ * True if user input is needed for audio
532
+ */
533
+ forAudio: boolean;
534
+ /**
535
+ * True if user input is needed for video
536
+ */
537
+ forVideo: boolean;
538
+ }
539
+ interface ApiClientOptions {
540
+ /**
541
+ * String representing the URL to the public CDN API.
542
+ */
543
+ publicEndpoint: string;
544
+ /**
545
+ * Function that should return a string containing a signed authentication token.
546
+ */
547
+ tokenFactory?: AuthorizationTokenFactory;
548
+ }
549
+ interface AuthorizationContext {
550
+ /**
551
+ * The channelGroupId that might need authorization.
552
+ */
553
+ channelGroupId?: string;
554
+ /**
555
+ * The channelId that might need authorization.
556
+ */
557
+ channelId?: string;
558
+ }
559
+ interface ConnectOptions {
560
+ channelGroupId?: string;
561
+ channelId: string;
562
+ }
563
+ type AuthorizationTokenFactory = (context: AuthorizationContext) => string | undefined;
564
+ declare class ApiClient {
565
+ private baseUrl;
566
+ private tokenFactory?;
567
+ constructor(options: ApiClientOptions);
568
+ /**
569
+ * @ignore
570
+ * Returns everything needed to setup the connection of Vindral instance.
571
+ */
572
+ connect(options: ConnectOptions): Promise<ConnectInfo>;
573
+ /**
574
+ * Fetches information regarding a single channel.
575
+ *
576
+ * @param channelId the channel to fetch
577
+ * @returns a [[Channel]] containing information about the requested channel.
578
+ */
579
+ getChannel(channelId: string): Promise<Channel>;
580
+ /**
581
+ * Fetches channels within a channel group
582
+ *
583
+ * Note: The returned list includes inactive channels - check isLive to filter out only active channels
584
+ *
585
+ * @param channelGroupId the channel group to fetch channels from
586
+ * @returns an array of [[Channel]] that belong to the channel group
587
+ */
588
+ getChannels(channelGroupId: string): Promise<Channel[]>;
589
+ private getHeaders;
590
+ private getAuthToken;
591
+ private toChannels;
592
+ private toChannel;
593
+ }
594
+ interface AdaptivityStatistics {
595
+ /**
596
+ * True if adaptive bitrate (ABR) is enabled.
597
+ */
598
+ isAbrEnabled: boolean;
599
+ }
600
+ interface BufferTimeStatistics {
601
+ /**
602
+ * Number of time buffer time has been adjusted. This will only happen when using dynamic buffer time
603
+ * (different min/max values of bufferTime).
604
+ */
605
+ bufferTimeAdjustmentCount: number;
606
+ }
607
+ interface RenditionsModuleStatistics {
608
+ /**
609
+ * Id of current video rendition subscribed to.
610
+ */
611
+ videoRenditionId?: number;
612
+ /**
613
+ * Id of current audio rendition subscribed to.
614
+ */
615
+ audioRenditionId?: number;
616
+ /**
617
+ * Current video codec being used.
618
+ */
619
+ videoCodec?: string;
620
+ /**
621
+ * Current audio codec being used.
622
+ */
623
+ audioCodec?: string;
624
+ /**
625
+ * Width of current video rendition (if any).
626
+ */
627
+ videoWidth?: number;
628
+ /**
629
+ * Height of current video rendition (if any).
630
+ */
631
+ videoHeight?: number;
632
+ /**
633
+ * Currently expected video bit rate according to metadata in bits/s.
634
+ */
635
+ expectedVideoBitRate?: number;
636
+ /**
637
+ * Currently expected audio bit rate according to metadata in bits/s.
638
+ */
639
+ expectedAudioBitRate?: number;
640
+ /**
641
+ * Current language. For non-multi language streams, this will often be unset.
642
+ */
643
+ language?: string;
644
+ /**
645
+ * Frame rate. Example: `"frameRate": [24000, 1001]`.
646
+ */
647
+ frameRate?: [
648
+ number,
649
+ number
650
+ ];
651
+ /**
652
+ * Total count of rendition level changes (quality downgrades/upgrades).
653
+ */
654
+ renditionLevelChangeCount: number;
655
+ }
656
+ interface VideoConstraintCap {
657
+ width: number;
658
+ height: number;
659
+ bitRate: number;
660
+ }
661
+ interface AudioConstraintCap {
662
+ bitRate: number;
663
+ }
664
+ interface ConstraintCap {
665
+ video: VideoConstraintCap;
666
+ audio: AudioConstraintCap;
667
+ }
668
+ interface ConstraintCapStatistics {
669
+ constraintCap?: ConstraintCap;
670
+ windowInnerWidth: number;
671
+ windowInnerHeight: number;
672
+ elementWidth: number;
673
+ elementHeight: number;
674
+ pixelRatio: number;
675
+ }
676
+ interface DecoderStatistics {
677
+ videoDecodeRate: number;
678
+ videoDecodeTime: MinMaxAverage;
679
+ audioDecodeTime: MinMaxAverage;
680
+ videoTransportTime: MinMaxAverage;
681
+ }
682
+ interface DocumentStateModulesStatistics {
683
+ isVisible: boolean;
684
+ isOnline: boolean;
685
+ isVisibleCount: number;
686
+ isHiddenCount: number;
687
+ isOnlineCount: number;
688
+ isOfflineCount: number;
689
+ navigatorRtt?: number;
690
+ navigatorEffectiveType?: EffectiveConnectionType;
691
+ navigatorConnectionType?: ConnectionType;
692
+ navigatorSaveData?: boolean;
693
+ navigatorDownlink?: number;
694
+ }
695
+ interface IncomingDataModuleStatistics {
696
+ /**
697
+ * Current video bitrate in bits/second.
698
+ */
699
+ videoBitRate?: number;
700
+ /**
701
+ * Current audio bitrate in bits/second.
702
+ */
703
+ audioBitRate?: number;
704
+ /**
705
+ * Counter of number of bytes received.
706
+ */
707
+ bytesReceived: number;
708
+ }
709
+ interface MseModuleStatistics {
710
+ quotaErrorCount: number;
711
+ mediaSourceOpenTime: number;
712
+ totalVideoFrames?: number;
713
+ droppedVideoFrames?: number;
714
+ successfulVideoAppendCalls?: number;
715
+ successfulAudioAppendsCalls?: number;
716
+ }
717
+ interface QualityOfServiceModuleStatistics {
718
+ /**
719
+ * Time in milliseconds spent in buffering state. Note that this value will increase while in background if
720
+ * buffering when leaving foreground.
721
+ */
722
+ timeSpentBuffering: number;
723
+ /**
724
+ * Total number of buffering events since instantiation.
725
+ */
726
+ bufferingEventsCount: number;
727
+ /**
728
+ * Number of fatal quality of service events.
729
+ */
730
+ fatalQosCount: number;
731
+ /**
732
+ * Ratio of time being spent on different bitrates.
733
+ * Example: `"timeSpentRatio": { "1160000": 0.2, "2260000": 0.8 }` shows 20% spent on 1.16 Mbps, 80% spent on 2.26 Mbps.
734
+ */
735
+ timeSpentRatio: {
736
+ [bitRate: string]: number;
737
+ };
738
+ }
739
+ interface SyncModuleStatistics {
740
+ drift: number | undefined;
741
+ driftAdjustmentCount: number;
742
+ timeshiftDriftAdjustmentCount: number;
743
+ seekTime: number;
744
+ }
745
+ interface VideoPlayerStatistics {
746
+ renderedFrameCount: number;
747
+ rendererDroppedFrameCount: number;
748
+ contextLostCount: number;
749
+ contextRestoredCount: number;
750
+ }
751
+ declare class UserAgentInformation {
752
+ private highEntropyValues?;
753
+ constructor();
754
+ getUserAgentInformation(): {
755
+ locationOrigin: string;
756
+ locationPath: string;
757
+ ancestorOrigins: string[] | undefined;
758
+ hardwareConcurrency: number;
759
+ deviceMemory: number | undefined;
760
+ userAgentLegacy: string;
761
+ ua: {
762
+ browser: {
763
+ brands: string[];
764
+ fullVersionBrands: string[];
765
+ majorVersions: string[];
766
+ };
767
+ device: string;
768
+ os: {
769
+ family: string;
770
+ version: string;
771
+ major_version: number;
772
+ };
773
+ };
774
+ } | {
775
+ locationOrigin: string;
776
+ locationPath: string;
777
+ ancestorOrigins: string[] | undefined;
778
+ hardwareConcurrency: number;
779
+ deviceMemory: number | undefined;
780
+ userAgent: string;
781
+ };
782
+ }
783
+ type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
784
+ type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["getUserAgentInformation"]> & {
785
+ /**
786
+ * Version of the @vindral/web-sdk being used.
787
+ */
788
+ version: string;
789
+ /**
790
+ * IP of the client.
791
+ */
792
+ ip?: string;
793
+ /**
794
+ * URL being used for connecting to the stream.
795
+ */
796
+ url: string;
797
+ /**
798
+ * A session is bound to a connection. If the client reconnects for any reason (e.g. coming back from inactivity
799
+ * or a problem with network on client side), a new sessionId will be used.
800
+ *
801
+ */
802
+ sessionId?: string;
803
+ /**
804
+ * Unlike `sessionId`, `clientId` will remain the same even after reconnections and represents this unique Vindral instance.
805
+ */
806
+ clientId: string;
807
+ /**
808
+ * How long in milliseconds since the instance was created.
809
+ */
810
+ uptime: number;
811
+ /**
812
+ * Current channel ID being subscribed to.
813
+ */
814
+ channelId: string;
815
+ /**
816
+ * Channel group being subscribed to.
817
+ */
818
+ channelGroupId?: string;
819
+ /**
820
+ * Time in milliseconds from instantiation to playback of video and audio being started.
821
+ * Note that an actual frame render often happens much quicker, but that is not counted as TTFF.
822
+ */
823
+ timeToFirstFrame?: number;
824
+ iosMediaElementEnabled?: boolean;
825
+ };
826
+ declare class Vindral extends Emitter<PublicVindralEvents> {
827
+ #private;
828
+ private static MAX_POOL_SIZE;
829
+ private static INITIAL_MAX_BIT_RATE;
830
+ private static DISCONNECT_TIMEOUT;
831
+ private static REMOVE_CUE_THRESHOLD;
832
+ /**
833
+ * Picture in picture
834
+ */
835
+ readonly pictureInPicture: {
836
+ /**
837
+ * Enters picture in picture
838
+ * @returns a promise that resolves if successful
839
+ */
840
+ enter: () => Promise<void>;
841
+ /**
842
+ * Exits picture in picture
843
+ * @returns a promise that resolves if successful
844
+ */
845
+ exit: () => Promise<void>;
846
+ /**
847
+ * returns whether picture in picture is currently active
848
+ */
849
+ isActive: () => boolean;
850
+ /**
851
+ * returns whether picture in picture is supported
852
+ */
853
+ isSupported: () => boolean;
854
+ };
855
+ private browser;
856
+ private options;
857
+ private element;
858
+ private playbackSource;
859
+ private emitter;
860
+ private logger;
861
+ private modules;
862
+ private clientIp?;
863
+ private sessionId?;
864
+ private clientId;
865
+ private _channels;
866
+ private createdAt;
867
+ private hasCalledConnect;
868
+ private latestEmittedLanguages;
869
+ private wakeLock;
870
+ private pool;
871
+ private userAgentInformation;
872
+ private encryptedMediaExtensions;
873
+ private sampleProcessingSesssions;
874
+ private sizes;
875
+ private isSuspended;
876
+ private disconnectTimeout;
877
+ constructor(options: Options);
878
+ /**
879
+ * Attaches the video view to a DOM element. The Vindral video view will be sized to fill this element while
880
+ * maintaining the correct aspect ratio.
881
+ * @param container the container element to append the video view to. Often a div element.
882
+ * @returns
883
+ */
884
+ attach: (container: HTMLElement) => void;
885
+ /**
886
+ * Set the current volume.
887
+ * Setting this to 0 is not equivalent to muting the audio.
888
+ * Setting this to >0 is not equivalent to unmuting the audio.
889
+ *
890
+ * Note that setting volume is not allowed on iPadOS and iOS devices.
891
+ * This is an OS/browser limitation on the video element.
892
+ *
893
+ * [Read more about it on Apple docs](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html)
894
+ * for iOS-Specific Considerations. The following section is the important part:
895
+ * On iOS devices, the audio level is always under the user's physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.
896
+ *
897
+ * @param volume The volume to set. A floating point value between 0-1.
898
+ *
899
+ */
900
+ set volume(volume: number);
901
+ /**
902
+ * The current volume. Note that if the playback is muted volume can still be set.
903
+ */
904
+ get volume(): number;
905
+ /**
906
+ * Set playback to muted/unmuted
907
+ */
908
+ set muted(muted: boolean);
909
+ /**
910
+ * Whether the playback is muted or not
911
+ */
912
+ get muted(): boolean;
913
+ /**
914
+ * Which media type is currently being played
915
+ */
916
+ get media(): Media;
917
+ /**
918
+ * The current average video bit rate in bits/s
919
+ */
920
+ get videoBitRate(): number;
921
+ /**
922
+ * The current average audio bit rate in bits/s
923
+ */
924
+ get audioBitRate(): number;
925
+ /**
926
+ * The current connection state
927
+ */
928
+ get connectionState(): Readonly<ConnectionState>;
929
+ /**
930
+ * The current playback state
931
+ */
932
+ get playbackState(): Readonly<PlaybackState>;
933
+ /**
934
+ * The current buffer fullness as a floating point value between 0-1, where 1 is full and 0 i empty.
935
+ */
936
+ get bufferFullness(): number;
937
+ /**
938
+ * Whether user bandwidth savings by capping the video resolution to the size of the video element is enabled
939
+ */
940
+ get sizeBasedResolutionCapEnabled(): boolean;
941
+ /**
942
+ * Enables or disables user bandwidth savings by capping the video resolution to the size of the video element.
943
+ */
944
+ set sizeBasedResolutionCapEnabled(enabled: boolean);
945
+ /**
946
+ * Whether ABR is currently enabled
947
+ */
948
+ get abrEnabled(): boolean;
949
+ /**
950
+ * Enable or disable ABR
951
+ *
952
+ * The client will immediatly stop changing renditon level based on QoS metrics
953
+ *
954
+ * Note: It is strongly recommended to keep this enabled as it can severly increase
955
+ * the number of buffering events for viewers.
956
+ */
957
+ set abrEnabled(enabled: boolean);
958
+ /**
959
+ * Estimated live edge time for the current channel
960
+ */
961
+ get serverEdgeTime(): number | undefined;
962
+ /**
963
+ * @returns Estimated wallclock time on the edge server in milliseconds
964
+ */
965
+ get serverWallclockTime(): number | undefined;
966
+ /**
967
+ * Local current time normalized between all channels in the channel group
968
+ */
969
+ get currentTime(): number;
970
+ /**
971
+ * Current time for the channel. This is the actual stream time, passed on from your ingress.
972
+ * Integer overflow could make this value differ from your encoder timestamps if it has been rolling for more
973
+ * than 42 days with RTMP as target.
974
+ *
975
+ * Note: This is not normalized between channels, thus it can make jumps when switching channels
976
+ */
977
+ get channelCurrentTime(): number;
978
+ /**
979
+ * The current target buffer time in milliseconds
980
+ */
981
+ get targetBufferTime(): number;
982
+ /**
983
+ * Set the current target buffer time in milliseconds
984
+ */
985
+ set targetBufferTime(bufferTimeMs: number);
986
+ /**
987
+ * The estimated playback latency based on target buffer time, the connection rtt and local playback drift
988
+ */
989
+ get playbackLatency(): number | undefined;
990
+ /**
991
+ * The estimated utc timestamp (in ms) for the playhead.
992
+ */
993
+ get playbackWallclockTime(): number | undefined;
994
+ /**
995
+ * Channels that can be switched between
996
+ */
997
+ get channels(): ReadonlyArray<Channel>;
998
+ /**
999
+ * Languages available
1000
+ */
1001
+ get languages(): ReadonlyArray<string>;
1002
+ /**
1003
+ * The current language
1004
+ */
1005
+ get language(): string | undefined;
1006
+ /**
1007
+ * Set the current language
1008
+ */
1009
+ set language(language: string | undefined);
1010
+ /**
1011
+ * Set the active text track
1012
+ */
1013
+ set textTrack(label: string | undefined);
1014
+ /**
1015
+ * Get the available text tracks
1016
+ */
1017
+ get textTracks(): string[];
1018
+ /**
1019
+ * Get the active text track
1020
+ */
1021
+ get textTrack(): string | undefined;
1022
+ /**
1023
+ * The current channelId
1024
+ */
1025
+ get channelId(): string;
1026
+ /**
1027
+ * Set the current channelId
1028
+ *
1029
+ * Possible channels to set are available from [[channels]]
1030
+ *
1031
+ * Note that the following scenarios are not possible right now:
1032
+ * - switching channel from a channel with audio to a channel without audio (unless audio only mode is active)
1033
+ * - switching channel from a channel with video to a channel without video (unless video only mode is active)
1034
+ */
1035
+ set channelId(channelId: string);
1036
+ /**
1037
+ * Max size that will be subscribed to
1038
+ */
1039
+ get maxSize(): Size;
1040
+ /**
1041
+ * Set max size that will be subscribed to
1042
+ *
1043
+ * Note: If ABR is disabled, setting this will make the client instantly subscribe to this size
1044
+ */
1045
+ set maxSize(size: Size);
1046
+ /**
1047
+ * The max video bit rate that will be subscribed to
1048
+ *
1049
+ * Note: Returns Number.MAX_SAFE_INTEGER if no limits have been set
1050
+ */
1051
+ get maxVideoBitRate(): number;
1052
+ /**
1053
+ * Set max video bit rate that will be subscribed to
1054
+ *
1055
+ * Note: If ABR is disabled, setting this will make the client instantly subscribe to this bitrate
1056
+ */
1057
+ set maxVideoBitRate(bitRate: number);
1058
+ /**
1059
+ * The max audio bit rate that will be subscribed to
1060
+ *
1061
+ * Note: Returns Number.MAX_SAFE_INTEGER if no limits have been set
1062
+ */
1063
+ get maxAudioBitRate(): number;
1064
+ /**
1065
+ * Set max audio bit rate that will be subscribed to
1066
+ *
1067
+ * Note: If ABR is disabled, setting this will make the client instantly subscribe to this bit rate
1068
+ */
1069
+ set maxAudioBitRate(bitRate: number);
1070
+ /**
1071
+ * The rendition levels available.
1072
+ */
1073
+ get renditionLevels(): ReadonlyArray<RenditionLevel>;
1074
+ /**
1075
+ * The current rendition level
1076
+ */
1077
+ get currentRenditionLevel(): Readonly<RenditionLevel> | undefined;
1078
+ /**
1079
+ * The target rendition level that the client is currently switching to
1080
+ */
1081
+ get targetRenditionLevel(): Readonly<RenditionLevel> | undefined;
1082
+ /**
1083
+ * True if the client is currently switching from one rendition level to another
1084
+ */
1085
+ get isSwitchingRenditionLevel(): boolean;
1086
+ /**
1087
+ * The time ranges buffered for video.
1088
+ * The ranges are specified in milliseconds.
1089
+ */
1090
+ get videoBufferedRanges(): ReadonlyArray<TimeRange>;
1091
+ /**
1092
+ * The time ranges buffered for audio.
1093
+ * The ranges are specified in milliseconds.
1094
+ */
1095
+ get audioBufferedRanges(): ReadonlyArray<TimeRange>;
1096
+ /**
1097
+ * The API client for calls to the public available endpoints of the Vindral Live CDN.
1098
+ */
1099
+ getApiClient(): ApiClient;
1100
+ get lastBufferEvent(): Readonly<BufferStateEvent>;
1101
+ get activeRatios(): Map<string, number>;
1102
+ get bufferingRatios(): Map<string, number>;
1103
+ get timeSpentBuffering(): number;
1104
+ get timeActive(): number;
1105
+ get mediaElement(): HTMLMediaElement | HTMLCanvasElement;
1106
+ get audioNode(): AudioNode | undefined;
1107
+ get drmStatistics(): {
1108
+ keySystem?: string | undefined;
1109
+ licenseServerUrl?: string | undefined;
1110
+ mediaKeySystemConfiguration?: MediaKeySystemConfiguration | undefined;
1111
+ provider?: string | undefined;
1112
+ clearkeys?: Record<string, string>;
1113
+ playreadyLicenseUrl?: string;
1114
+ widevineLicenseUrl?: string;
1115
+ fairplayLicenseUrl?: string;
1116
+ fairplayCertificate?: ArrayBuffer;
1117
+ videoCodec?: string;
1118
+ audioCodec?: string;
1119
+ } | null;
1120
+ /**
1121
+ * Get active Vindral Options
1122
+ */
1123
+ getOptions: () => Options;
1124
+ /**
1125
+ * Get url for fetching thumbnail. Note that fetching thumbnails only works for an active channel.
1126
+ */
1127
+ getThumbnailUrl: () => string;
1128
+ /**
1129
+ * Update authentication token on an already established and authenticated connection
1130
+ */
1131
+ updateAuthenticationToken: (token: string) => void;
1132
+ /**
1133
+ * @deprecated since 3.0.0 Use play instead.
1134
+ * Connects to the configured channel and starts streaming
1135
+ */
1136
+ connect: () => void;
1137
+ private _connect;
1138
+ /**
1139
+ * Get options that can be used for CastSender
1140
+ */
1141
+ getCastOptions: () => Options;
1142
+ private onConnectInfo;
1143
+ private emitLanguagesIfChanged;
1144
+ private updateTextTracks;
1145
+ private cleanupTextTracks;
1146
+ private filterRenditions;
1147
+ /**
1148
+ * Patch the subscription with properties from the channel that isn't known until connection
1149
+ * @param channel Channel with the renditions to patch the subscription based on
1150
+ */
1151
+ private patchSubscription;
1152
+ private isSupportedVideoCodecProfile;
1153
+ private supportedAudioCodecs;
1154
+ private initializeDecodingModule;
1155
+ /**
1156
+ * Fully unloads the instance. This disconnects the clients and stops any background tasks.
1157
+ * This client instance can not be used after this has been called.
1158
+ */
1159
+ unload: () => Promise<void>;
1160
+ /**
1161
+ * @deprecated since 3.0.0 Use play instead.
1162
+ *
1163
+ * Activates audio or video on web browsers that require a user gesture to enable media playback.
1164
+ * The Vindral instance will emit a "needs user input" event to indicate when this is needed.
1165
+ * But it is also safe to pre-emptively call this if it is more convenient - such as in cases where
1166
+ * the Vindral instance itself is created in a user input event.
1167
+ *
1168
+ * Requirements: This method needs to be called within an user-input event handler to function properly, such as
1169
+ * an onclick handler.
1170
+ *
1171
+ * Note: Even if you pre-emptively call this it is still recommended to listen to "needs user input"
1172
+ * and handle that event gracefully.
1173
+ */
1174
+ userInput: () => void;
1175
+ /**
1176
+ * Pauses the stream. Call .play() to resume playback again.
1177
+ */
1178
+ pause: () => void;
1179
+ private registerDebugInstance;
1180
+ /**
1181
+ *
1182
+ * Start playing the stream.
1183
+ *
1184
+ * This method also activates audio or video on web browsers that require a user gesture to enable media playback.
1185
+ * The Vindral instance will emit a "needs user input" event to indicate when this is needed.
1186
+ * But it is also safe to pre-emptively call this if it is more convenient - such as in cases where
1187
+ * the Vindral instance itself is created in a user input event.
1188
+ *
1189
+ * Note: In most browsers this method needs to be called within an user-input event handler, such as
1190
+ * an onclick handler in order to activate audio. Most implementations call this directly after constructing the Vindral
1191
+ * instance once in order to start playing, and then listen to a user-event in order to allow audio to be activated.
1192
+ *
1193
+ * Note 2: Even if you pre-emptively call this it is still recommended to listen to "needs user input"
1194
+ * and handle that event gracefully.
1195
+ */
1196
+ play: () => void;
1197
+ /**
1198
+ * How long in milliseconds since the instance was created
1199
+ */
1200
+ get uptime(): number;
1201
+ /**
1202
+ * This method collects a statistics report from internal modules. While many of the report's properties are documented, the report may also contain undocumented
1203
+ * properties used internally or temporarily for monitoring and improving the performance of the service.
1204
+ *
1205
+ * Use undocumented properties at your own risk.
1206
+ */
1207
+ getStatistics: () => Statistics;
1208
+ private resetModules;
1209
+ private suspend;
1210
+ private unsuspend;
1211
+ private getRuntimeInfo;
1212
+ private onMediaElementState;
1213
+ private onBufferEvent;
1214
+ /**
1215
+ * Aligns size and bitrate to match a rendition level correctly
1216
+ */
1217
+ private alignSizeAndBitRate;
1218
+ private get currentSubscription();
1219
+ private get targetSubscription();
1220
+ private timeToFirstFrame;
1221
+ private willUseMediaSource;
1222
+ }
1223
+ interface TelemetryModuleStatistics {
1224
+ /**
1225
+ * The total amount of errors being spawned. Note that some media errors can trigger
1226
+ * thousands of errors for a single client in a few seconds before recovering. Therefore,
1227
+ * consider the number of viewers with errors, not just the total amount. Also, consider the median
1228
+ * instead of the mean for average calculation.
1229
+ */
1230
+ errorCount: number;
1231
+ }
1232
+ type ConnectionState = "connected" | "disconnected" | "connecting";
1233
+ type ContextSwitchState = "completed" | "started";
1234
+ interface ConnectionStatistics {
1235
+ /**
1236
+ * RTT (round trip time) between client and server(s).
1237
+ */
1238
+ rtt: MinMaxAverage;
1239
+ /**
1240
+ * A very rough initial estimation of minimum available bandwidth.
1241
+ */
1242
+ estimatedBandwidth: number;
1243
+ edgeUrl?: string;
1244
+ /**
1245
+ * Total number of connections that have been established since instantiation.
1246
+ */
1247
+ connectCount: number;
1248
+ /**
1249
+ * Total number of connection attempts since instantiation.
1250
+ */
1251
+ connectionAttemptCount: number;
1252
+ connectionProtocol: "vindral_ws" | "moq" | undefined;
1253
+ }
1254
+ interface LanguageSwitchContext {
1255
+ /**
1256
+ * The new language that was switched to
1257
+ */
1258
+ language: string;
1259
+ }
1260
+ interface ChannelSwitchContext {
1261
+ /**
1262
+ * The new channel id that was switched to
1263
+ */
1264
+ channelId: string;
1265
+ }
1266
+ interface VolumeState {
1267
+ /**
1268
+ * Wether the audio is muted
1269
+ */
1270
+ isMuted: boolean;
1271
+ /**
1272
+ * The volume level
1273
+ */
1274
+ volume: number;
1275
+ }
1276
+ interface PublicVindralEvents {
1277
+ /**
1278
+ * When an error that requires action has occured
1279
+ *
1280
+ * Can be a fatal error that will unload the Vindral instance - this is indicated by `isFatal()` on the error object returning true.
1281
+ *
1282
+ * In case of a fatal error it is appropriate to indicate what the error was to the user, either by displaying the error.message or
1283
+ * by using the error.code() as a key to look up a localization string. To resume streaming it is required to create a new Vindral instance.
1284
+ */
1285
+ ["error"]: Readonly<VindralError>;
1286
+ /**
1287
+ * When the instance needs user input to activate audio or sometimes video playback.
1288
+ * Is called with an object
1289
+ * ```javascript
1290
+ * {
1291
+ * forAudio: boolean // true if user input is needed for audio playback
1292
+ * forVideo: boolean // true if user input is needed for video playback
1293
+ * }
1294
+ * ```
1295
+ */
1296
+ ["needs user input"]: NeedsUserInputContext;
1297
+ /**
1298
+ * When a timed metadata event has been triggered
1299
+ */
1300
+ ["metadata"]: Readonly<Metadata>;
1301
+ /**
1302
+ * When the playback state changes
1303
+ */
1304
+ ["playback state"]: Readonly<PlaybackState>;
1305
+ /**
1306
+ * When the connection state changes
1307
+ */
1308
+ ["connection state"]: Readonly<ConnectionState>;
1309
+ /**
1310
+ * When the available rendition levels is changed
1311
+ */
1312
+ ["rendition levels"]: ReadonlyArray<RenditionLevel>;
1313
+ /**
1314
+ * When the rendition level is changed
1315
+ */
1316
+ ["rendition level"]: Readonly<RenditionLevel>;
1317
+ /**
1318
+ * When the available languages is changed
1319
+ */
1320
+ ["languages"]: ReadonlyArray<string>;
1321
+ /**
1322
+ * When the available text tracks are changed
1323
+ */
1324
+ ["text tracks"]: ReadonlyArray<string>;
1325
+ /**
1326
+ * When the available channels is changed
1327
+ */
1328
+ ["channels"]: ReadonlyArray<Channel>;
1329
+ /**
1330
+ * When a context switch state change has occured.
1331
+ * E.g. when a channel change has been requested, or quality is changed.
1332
+ */
1333
+ ["context switch"]: Readonly<ContextSwitchState>;
1334
+ /**
1335
+ * Emitted when a wallclock time message has been received from the server.
1336
+ *
1337
+ * Note: This is the edge server wallclock time and thus may differ slightly
1338
+ * between two viewers if they are connected to different edge servers.
1339
+ */
1340
+ ["server wallclock time"]: Readonly<number>;
1341
+ /**
1342
+ * Is emitted during connection whether the channel is live or not.
1343
+ *
1344
+ * If the channel is not live, the Vindral instance will try to reconnect until the `reconnectHandler`
1345
+ * determines that no more retries should be made.
1346
+ *
1347
+ * Note: If the web-sdk is instantiated at the same time as you are starting the stream it is possible
1348
+ * that this emits false until the started state has propagated through the system.
1349
+ */
1350
+ ["is live"]: boolean;
1351
+ /**
1352
+ * Emitted when a channel switch has been completed and the first frame of the new channel is rendered.
1353
+ * A string containing the channel id of the new channel is provided as an argument.
1354
+ */
1355
+ ["channel switch"]: Readonly<ChannelSwitchContext>;
1356
+ /**
1357
+ * Emmitted when a channel switch fails.
1358
+ * A string containing the channel id of the current channel is provided as an argument.
1359
+ */
1360
+ ["channel switch failed"]: Readonly<ChannelSwitchContext>;
1361
+ /**
1362
+ * Emitted when a language switch has been completed and the new language starts playing.
1363
+ */
1364
+ ["language switch"]: Readonly<LanguageSwitchContext>;
1365
+ /**
1366
+ * Emitted when the volume state changes.
1367
+ *
1368
+ * This is triggered triggered both when the user changes the volume through the Vindral instance, but also
1369
+ * from external sources such as OS media shortcuts or other native UI outside of the browser.
1370
+ */
1371
+ ["volume state"]: Readonly<VolumeState>;
1372
+ ["buffer state event"]: Readonly<BufferStateEvent>;
1373
+ ["initialized media"]: void;
1374
+ }
1375
+ declare abstract class VindralButton extends HTMLElement {
1376
+ #private;
1377
+ static observedAttributes: string[];
1378
+ constructor();
1379
+ get keysUsed(): string[];
1380
+ connectedCallback(): void;
1381
+ enable(): void;
1382
+ disable(): void;
1383
+ disconnectedCallback(): void;
1384
+ attributeChangedCallback(name: string, _old: string, value: string): void;
1385
+ protected abstract handleClick(e: Event): void;
1386
+ }
1387
+ export declare class AirPlayButton extends VindralButton {
1388
+ #private;
1389
+ static observedAttributes: string[];
1390
+ constructor();
1391
+ connectedCallback(): void;
1392
+ disconnectedCallback(): void;
1393
+ attributeChangedCallback(name: string, old: string, value: string): void;
1394
+ set isAirPlaying(value: boolean);
1395
+ get isAirPlaying(): boolean;
1396
+ protected handleClick(_: Event): void;
1397
+ }
1398
+ export declare class BufferingOverlay extends HTMLElement {
1399
+ #private;
1400
+ static observedAttributes: "buffering"[];
1401
+ constructor();
1402
+ connectedCallback(): void;
1403
+ disconnectedCallback(): void;
1404
+ }
1405
+ export declare class CastButton extends VindralButton {
1406
+ #private;
1407
+ static observedAttributes: string[];
1408
+ constructor();
1409
+ connectedCallback(): void;
1410
+ disconnectedCallback(): void;
1411
+ attributeChangedCallback(name: string, old: string, value: string): void;
1412
+ set isCasting(value: boolean);
1413
+ get isCasting(): boolean;
1414
+ protected handleClick(_: Event): void;
1415
+ }
1416
+ type CastOverlayAttributes = (typeof CastOverlay.observedAttributes)[number];
1417
+ export declare class CastOverlay extends HTMLElement {
1418
+ #private;
1419
+ static observedAttributes: ("is-casting" | "cast-receiver-name")[];
1420
+ constructor();
1421
+ connectedCallback(): void;
1422
+ disconnectedCallback(): void;
1423
+ attributeChangedCallback(name: CastOverlayAttributes, oldValue: string, newValue: string): void;
1424
+ }
1425
+ export declare class ChannelGrid extends HTMLElement {
1426
+ #private;
1427
+ static observedAttributes: string[];
1428
+ constructor();
1429
+ connectedCallback(): void;
1430
+ disconnectedCallback(): void;
1431
+ attributeChangedCallback(name: string, old: string, value: string): void;
1432
+ get keysUsed(): string[];
1433
+ handleEvent: (event: Event) => void;
1434
+ focus(): void;
1435
+ }
1436
+ export declare class ChannelGridButton extends VindralButton {
1437
+ #private;
1438
+ static observedAttributes: string[];
1439
+ constructor();
1440
+ connectedCallback(): void;
1441
+ disconnectedCallback(): void;
1442
+ attributeChangedCallback(name: string, old: string, value: string): void;
1443
+ enable(): void;
1444
+ protected handleClick(_: MouseEvent): void;
1445
+ get isOpen(): boolean;
1446
+ }
1447
+ export declare class ChannelGridItem extends HTMLElement {
1448
+ #private;
1449
+ lastThumbnailUpdate?: number;
1450
+ static observedAttributes: string[];
1451
+ constructor();
1452
+ attributeChangedCallback(name: string, old: string, value: string): void;
1453
+ updateThumbnail(): void;
1454
+ }
1455
+ export declare class ControlBar extends HTMLElement {
1456
+ static observedAttributes: never[];
1457
+ constructor();
1458
+ connectedCallback(): void;
1459
+ disconnectedCallback(): void;
1460
+ }
1461
+ type ControllerAttributes = (typeof Controller.observedAttributes)[number];
1462
+ export declare class Controller extends HTMLElement {
1463
+ #private;
1464
+ static observedAttributes: readonly [
1465
+ ...("language" | "channels" | "buffering" | "paused" | "volume" | "muted" | "user-interacting" | "is-casting" | "cast-available" | "cast-receiver-name" | "ui-locked" | "hide-ui-on-pause" | "is-fullscreen" | "is-fullscreen-fallback" | "rendition-levels" | "rendition-level" | "max-video-bit-rate" | "channel-id" | "channel-group-id" | "pip-available" | "is-pip" | "airplay-available" | "is-airplaying" | "media" | "languages" | "text-tracks" | "text-track" | "needs-user-input" | "authentication-token" | "volume-level" | "cast" | "airplay" | "pip" | "fullscreen" | "vu-meter" | "poster-src")[],
1466
+ "url",
1467
+ "edge-url",
1468
+ "target-buffer-time",
1469
+ "cast-receiver-id",
1470
+ "cast-background",
1471
+ "log-level",
1472
+ "max-size",
1473
+ "min-buffer-time",
1474
+ "max-buffer-time",
1475
+ "max-audio-bit-rate",
1476
+ "burst-enabled",
1477
+ "mse-enabled",
1478
+ "mse-opus-enabled",
1479
+ "ios-background-play-enabled",
1480
+ "ios-wake-lock-enabled",
1481
+ "ios-media-element-enabled",
1482
+ "abr-enabled",
1483
+ "size-based-resolution-cap-enabled",
1484
+ "telemetry-enabled",
1485
+ "video-codecs",
1486
+ "poster",
1487
+ "advanced",
1488
+ "drm-headers",
1489
+ "drm-queryparams",
1490
+ "webtransport-enabled",
1491
+ "reconnect-retries",
1492
+ "auto-instance-enabled"
1493
+ ];
1494
+ constructor();
1495
+ connectedCallback(): Promise<void>;
1496
+ disconnectedCallback(): void;
1497
+ handleEvent: (event: Event) => void;
1498
+ attributeChangedCallback(name: ControllerAttributes, oldValue: string, newValue?: string): void;
1499
+ connectListener(component: HTMLElement): void;
1500
+ disconnectListener(component: HTMLElement): void;
1501
+ get instance(): Vindral | undefined;
1502
+ connect(): void;
1503
+ }
1504
+ export declare class FullscreenButton extends VindralButton {
1505
+ static observedAttributes: string[];
1506
+ constructor();
1507
+ connectedCallback(): void;
1508
+ disconnectedCallback(): void;
1509
+ attributeChangedCallback(name: string, old: string, value: string): void;
1510
+ set isFullscreen(value: boolean);
1511
+ get isFullscreen(): boolean;
1512
+ protected handleClick(_: Event): void;
1513
+ }
1514
+ declare class VindralMenuButton extends VindralButton {
1515
+ #private;
1516
+ constructor();
1517
+ connectedCallback(): void;
1518
+ set button(button: HTMLElement);
1519
+ set listbox(listbox: HTMLElement);
1520
+ set listboxSlot(listboxSlot: HTMLElement);
1521
+ enable(): void;
1522
+ hide(): void;
1523
+ protected handleClick(e: Event): void;
1524
+ }
1525
+ export declare class LanguageMenu extends VindralMenuButton {
1526
+ #private;
1527
+ static observedAttributes: string[];
1528
+ constructor();
1529
+ connectedCallback(): void;
1530
+ attributeChangedCallback(name: string, old: string, value: string): void;
1531
+ }
1532
+ export declare class LanguageMenuList extends HTMLElement {
1533
+ #private;
1534
+ static observedAttributes: ("language" | "languages" | "text-tracks" | "text-track")[];
1535
+ constructor();
1536
+ connectedCallback(): void;
1537
+ disconnectedCallback(): void;
1538
+ attributeChangedCallback(name: string, old: string, value: string): void;
1539
+ private set languages(value);
1540
+ private set textTracks(value);
1541
+ private set language(value);
1542
+ private set textTrack(value);
1543
+ get keysUsed(): string[];
1544
+ handleEvent: (event: Event) => void;
1545
+ focus(): void;
1546
+ }
1547
+ export declare class MuteButton extends VindralButton {
1548
+ static observedAttributes: string[];
1549
+ constructor();
1550
+ connectedCallback(): void;
1551
+ disconnectedCallback(): void;
1552
+ attributeChangedCallback(name: string, old: string, value: string): void;
1553
+ set muted(value: boolean);
1554
+ get muted(): boolean;
1555
+ protected handleClick(_: Event): void;
1556
+ }
1557
+ export declare class PictureInPictureButton extends VindralButton {
1558
+ static observedAttributes: string[];
1559
+ constructor();
1560
+ connectedCallback(): void;
1561
+ disconnectedCallback(): void;
1562
+ attributeChangedCallback(name: string, old: string, value: string): void;
1563
+ set isPictureInPictureActive(value: boolean);
1564
+ get isPictureInPictureActive(): boolean;
1565
+ protected handleClick(_: Event): void;
1566
+ }
1567
+ export declare class PlayButton extends VindralButton {
1568
+ static observedAttributes: string[];
1569
+ constructor();
1570
+ connectedCallback(): void;
1571
+ disconnectedCallback(): void;
1572
+ attributeChangedCallback(name: string, old: string, value: string): void;
1573
+ set paused(value: boolean);
1574
+ get paused(): boolean;
1575
+ protected handleClick(_: Event): void;
1576
+ }
1577
+ export declare class Player extends HTMLElement {
1578
+ #private;
1579
+ static observedAttributes: ("title" | "poster" | "language" | "channels" | "buffering" | "paused" | "volume" | "muted" | "user-interacting" | "is-casting" | "cast-available" | "cast-receiver-name" | "ui-locked" | "hide-ui-on-pause" | "is-fullscreen" | "is-fullscreen-fallback" | "rendition-levels" | "rendition-level" | "max-video-bit-rate" | "channel-id" | "channel-group-id" | "pip-available" | "is-pip" | "airplay-available" | "is-airplaying" | "media" | "languages" | "text-tracks" | "text-track" | "needs-user-input" | "authentication-token" | "volume-level" | "cast" | "airplay" | "pip" | "fullscreen" | "vu-meter" | "poster-src" | "url" | "advanced" | "offline" | "edge-url" | "target-buffer-time" | "cast-receiver-id" | "cast-background" | "log-level" | "max-size" | "min-buffer-time" | "max-buffer-time" | "max-audio-bit-rate" | "burst-enabled" | "mse-enabled" | "mse-opus-enabled" | "ios-background-play-enabled" | "ios-wake-lock-enabled" | "ios-media-element-enabled" | "abr-enabled" | "size-based-resolution-cap-enabled" | "telemetry-enabled" | "video-codecs" | "drm-headers" | "drm-queryparams" | "webtransport-enabled" | "reconnect-retries" | "auto-instance-enabled" | "refresh-poster-enabled" | "stream-poll-enabled")[];
1580
+ constructor();
1581
+ connectedCallback(): void;
1582
+ disconnectedCallback(): void;
1583
+ attributeChangedCallback(name: string, oldValue?: string, newValue?: string): void;
1584
+ get instance(): Vindral | undefined;
1585
+ }
1586
+ type PosterOverlayAttributes = (typeof PosterOverlay.observedAttributes)[number];
1587
+ export declare class PosterOverlay extends HTMLElement {
1588
+ #private;
1589
+ static observedAttributes: string[];
1590
+ constructor();
1591
+ connectedCallback(): void;
1592
+ disconnectedCallback(): void;
1593
+ attributeChangedCallback(name: PosterOverlayAttributes, oldValue: string, newValue: string): void;
1594
+ get disabled(): boolean;
1595
+ set disabled(value: boolean);
1596
+ get posterSrc(): string | null;
1597
+ get paused(): boolean;
1598
+ }
1599
+ export declare class RenditionLevelsMenu extends VindralMenuButton {
1600
+ #private;
1601
+ static observedAttributes: string[];
1602
+ constructor();
1603
+ connectedCallback(): void;
1604
+ attributeChangedCallback(name: string, old: string, value: string): void;
1605
+ }
1606
+ export declare class RenditionLevelsMenuList extends HTMLElement {
1607
+ #private;
1608
+ static observedAttributes: ("rendition-levels" | "max-video-bit-rate")[];
1609
+ constructor();
1610
+ connectedCallback(): void;
1611
+ disconnectedCallback(): void;
1612
+ attributeChangedCallback(name: string, old: string, value: string): void;
1613
+ private set list(value);
1614
+ private set maxVideoBitrate(value);
1615
+ get keysUsed(): string[];
1616
+ handleEvent: (event: Event) => void;
1617
+ focus(): void;
1618
+ }
1619
+ export declare class ScrollOverlay extends HTMLElement {
1620
+ #private;
1621
+ static observedAttributes: string[];
1622
+ constructor();
1623
+ connectedCallback(): void;
1624
+ disconnectedCallback(): void;
1625
+ attributeChangedCallback(name: string, old: string, value: string): void;
1626
+ handleEvent: (event: Event) => void;
1627
+ set open(value: boolean);
1628
+ get open(): boolean;
1629
+ set visible(value: boolean);
1630
+ get visible(): boolean;
1631
+ }
1632
+ declare class VindralRange extends HTMLElement {
1633
+ #private;
1634
+ static observedAttributes: string[];
1635
+ range: HTMLInputElement;
1636
+ constructor();
1637
+ connectedCallback(): void;
1638
+ disconnectedCallback(): void;
1639
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1640
+ enable(): void;
1641
+ disable(): void;
1642
+ handleEvent(event: Event): void;
1643
+ updateBar(): void;
1644
+ get keysUsed(): string[];
1645
+ }
1646
+ export declare class VolumeRange extends VindralRange {
1647
+ #private;
1648
+ static observedAttributes: string[];
1649
+ constructor();
1650
+ connectedCallback(): void;
1651
+ disconnectedCallback(): void;
1652
+ attributeChangedCallback(name: string, old: string, value: string): void;
1653
+ get volume(): string;
1654
+ get muted(): boolean;
1655
+ }
1656
+ declare class BufferingIcon extends HTMLElement {
1657
+ #private;
1658
+ static observedAttributes: "buffering"[];
1659
+ constructor();
1660
+ connectedCallback(): void;
1661
+ disconnectedCallback(): void;
1662
+ }
1663
+ declare class VindralPlayOverlay extends HTMLElement {
1664
+ #private;
1665
+ static observedAttributes: string[];
1666
+ constructor();
1667
+ connectedCallback(): void;
1668
+ disconnectedCallback(): void;
1669
+ }
1670
+ declare class VindralUserInputPlayOverlay extends VindralPlayOverlay {
1671
+ #private;
1672
+ static observedAttributes: string[];
1673
+ constructor();
1674
+ connectedCallback(): void;
1675
+ disconnectedCallback(): void;
1676
+ }
1677
+ declare class VindralMessage extends HTMLElement {
1678
+ #private;
1679
+ static observedAttributes: string[];
1680
+ constructor();
1681
+ connectedCallback(): void;
1682
+ disconnectedCallback(): void;
1683
+ attributeChangedCallback(name: string, old: string, value: string): void;
1684
+ }
1685
+ /**
1686
+ * Register custom elements for the Vindral player
1687
+ */
1688
+ export declare function registerComponents(): void;
1689
+ /**
1690
+ * @ignore
1691
+ */
1692
+ export declare interface VindralHTMLElementTagNameMap {
1693
+ "vindral-controller": Controller;
1694
+ "vindral-control-bar": ControlBar;
1695
+ "vindral-play-button": PlayButton;
1696
+ "vindral-mute-button": MuteButton;
1697
+ "vindral-buffering-overlay": BufferingOverlay;
1698
+ "vindral-scroll-overlay": ScrollOverlay;
1699
+ "vindral-play-overlay": VindralPlayOverlay;
1700
+ "vindral-user-input-play-overlay": VindralUserInputPlayOverlay;
1701
+ "vindral-fullscreen-button": FullscreenButton;
1702
+ "vindral-rendition-levels-menu": RenditionLevelsMenu;
1703
+ "vindral-rendition-levels-menu-list": RenditionLevelsMenuList;
1704
+ "vindral-channel-grid-button": ChannelGridButton;
1705
+ "vindral-channel-grid": ChannelGrid;
1706
+ "vindral-channel-grid-item": ChannelGridItem;
1707
+ "vindral-pip-button": PictureInPictureButton;
1708
+ "vindral-airplay-button": AirPlayButton;
1709
+ "vindral-cast-button": CastButton;
1710
+ "vindral-cast-overlay": CastOverlay;
1711
+ "vindral-buffering-icon": BufferingIcon;
1712
+ "vindral-language-menu": LanguageMenu;
1713
+ "vindral-language-menu-list": LanguageMenuList;
1714
+ "vindral-message": VindralMessage;
1715
+ "vindral-volume-range": VolumeRange;
1716
+ "vindral-poster-overlay": PosterOverlay;
1717
+ "vindral-player": Player;
1718
+ }
1719
+
1720
+ export {};