@vindral/web-sdk 3.4.4 → 4.0.0

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