@vindral/web-sdk 3.4.4 → 4.0.0-191-g9f7294ed
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/1PRs0vho.js +127 -0
- package/AXCpqROO.js +4311 -0
- package/B-HFfmiu.js +6783 -0
- package/BTxJOjm9.js +32 -0
- package/CayXch2-.js +312 -0
- package/F-U5JXpv.js +231 -0
- package/README.md +74 -30
- package/api-client.d.ts +217 -0
- package/api-client.js +4 -0
- package/cast-sender.d.ts +410 -0
- package/cast-sender.js +230 -0
- package/core.d.ts +1444 -0
- package/core.js +14 -0
- package/{index.d.ts → legacy.d.ts} +794 -716
- package/legacy.es.js +12805 -0
- package/legacy.umd.js +60 -0
- package/package.json +25 -9
- package/player.d.ts +1691 -0
- package/player.js +3784 -0
- package/vindral-player-component.js +2 -0
- package/index.js +0 -7716
- package/index.umd.cjs +0 -59
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
type AudioCodec = "aac" | "opus" | "mp3";
|
|
2
|
-
type VideoCodec = "h264" | "av1";
|
|
3
|
-
/**
|
|
4
|
-
* Represents a timed metadata event
|
|
5
|
-
*/
|
|
6
|
-
export interface Metadata {
|
|
7
|
-
/**
|
|
8
|
-
* The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
|
|
9
|
-
*/
|
|
10
|
-
content: string;
|
|
11
|
-
/**
|
|
12
|
-
* Timestamp in ms
|
|
13
|
-
*/
|
|
14
|
-
timestamp: number;
|
|
15
|
-
}
|
|
16
1
|
type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
|
|
17
2
|
type VoidKeys<Record> = MatchingKeys<Record, void>;
|
|
18
3
|
type EventListenerReturnType = (() => void) | void;
|
|
@@ -73,21 +58,81 @@ interface MinMaxAverage {
|
|
|
73
58
|
*/
|
|
74
59
|
min: number;
|
|
75
60
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
declare const tags: unique symbol;
|
|
62
|
+
type Tagged<BaseType, Tag extends PropertyKey> = BaseType & {
|
|
63
|
+
[tags]: {
|
|
64
|
+
[K in Tag]: void;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
80
67
|
/**
|
|
81
|
-
*
|
|
68
|
+
* Channel
|
|
82
69
|
*/
|
|
83
|
-
export interface
|
|
70
|
+
export interface Channel {
|
|
84
71
|
/**
|
|
85
|
-
*
|
|
86
|
-
* This gets reset on every successful connect, so it will start from zero every
|
|
87
|
-
* time the client instance gets disconnected and will increment until the
|
|
88
|
-
* client instance makes a connection attempt is successful.
|
|
72
|
+
* Channel ID for the channel
|
|
89
73
|
*/
|
|
90
|
-
|
|
74
|
+
channelId: string;
|
|
75
|
+
/**
|
|
76
|
+
* Display name
|
|
77
|
+
*/
|
|
78
|
+
name: string;
|
|
79
|
+
/**
|
|
80
|
+
* Indicates whether there is an incoming source feed for the channel
|
|
81
|
+
*/
|
|
82
|
+
isLive: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* URLs to fetch thumbnail from
|
|
85
|
+
*/
|
|
86
|
+
thumbnailUrls: string[];
|
|
87
|
+
}
|
|
88
|
+
interface ClientOverrides {
|
|
89
|
+
maxVideoBitRate?: number;
|
|
90
|
+
minBufferTime?: number;
|
|
91
|
+
maxBufferTime?: number;
|
|
92
|
+
burstEnabled?: boolean;
|
|
93
|
+
sizeBasedResolutionCapEnabled?: boolean;
|
|
94
|
+
separateVideoSocketEnabled?: boolean;
|
|
95
|
+
videoCodecs?: string[];
|
|
96
|
+
}
|
|
97
|
+
type AudioCodec = "aac" | "opus" | "mp3";
|
|
98
|
+
type VideoCodec = "h264" | "av1";
|
|
99
|
+
type Namespace = Tagged<Array<string>, "Namespace">;
|
|
100
|
+
interface TrackObject {
|
|
101
|
+
namespace?: Namespace;
|
|
102
|
+
name: string;
|
|
103
|
+
format: string;
|
|
104
|
+
label?: string;
|
|
105
|
+
renderGroup?: number;
|
|
106
|
+
altGroup?: number;
|
|
107
|
+
initData?: string;
|
|
108
|
+
initTrack?: string;
|
|
109
|
+
depends?: Array<string>;
|
|
110
|
+
temporalId?: number;
|
|
111
|
+
spatialId?: number;
|
|
112
|
+
codec?: string;
|
|
113
|
+
mimeType?: string;
|
|
114
|
+
framerate?: [
|
|
115
|
+
number,
|
|
116
|
+
number
|
|
117
|
+
];
|
|
118
|
+
bitrate?: number;
|
|
119
|
+
width?: number;
|
|
120
|
+
height?: number;
|
|
121
|
+
samplerate?: number;
|
|
122
|
+
channelConfig?: string;
|
|
123
|
+
displayWidth?: number;
|
|
124
|
+
displayHeight?: number;
|
|
125
|
+
language?: string;
|
|
126
|
+
["com.vindral.variant_uid"]?: string;
|
|
127
|
+
}
|
|
128
|
+
interface CatalogRoot {
|
|
129
|
+
version: number;
|
|
130
|
+
streamingFormat?: number;
|
|
131
|
+
streamingFormatVersion?: string;
|
|
132
|
+
}
|
|
133
|
+
interface TracksCatalog extends CatalogRoot {
|
|
134
|
+
namespace: Namespace;
|
|
135
|
+
tracks: Array<TrackObject>;
|
|
91
136
|
}
|
|
92
137
|
interface RenditionProps {
|
|
93
138
|
id: number;
|
|
@@ -119,6 +164,78 @@ type VideoRendition = VideoRenditionProps & RenditionProps;
|
|
|
119
164
|
type AudioRendition = AudioRenditionProps & RenditionProps;
|
|
120
165
|
type TextRendition = TextRenditionProps & RenditionProps;
|
|
121
166
|
type Rendition = VideoRendition | AudioRendition | TextRendition;
|
|
167
|
+
interface Telemetry {
|
|
168
|
+
url: string;
|
|
169
|
+
probability?: number;
|
|
170
|
+
includeErrors?: boolean;
|
|
171
|
+
includeEvents?: boolean;
|
|
172
|
+
includeStats?: boolean;
|
|
173
|
+
maxRetries?: number;
|
|
174
|
+
maxErrorReports?: number;
|
|
175
|
+
interval?: number;
|
|
176
|
+
}
|
|
177
|
+
interface ChannelWithCatalog extends Channel {
|
|
178
|
+
catalog: TracksCatalog;
|
|
179
|
+
renditions: Rendition[];
|
|
180
|
+
overrides?: ClientOverrides;
|
|
181
|
+
}
|
|
182
|
+
interface ChannelWithRenditions extends Channel {
|
|
183
|
+
renditions: Rendition[];
|
|
184
|
+
overrides?: ClientOverrides;
|
|
185
|
+
}
|
|
186
|
+
interface ServerCertificateHash {
|
|
187
|
+
algorithm: string;
|
|
188
|
+
value: string;
|
|
189
|
+
}
|
|
190
|
+
interface Edge {
|
|
191
|
+
moqUrl?: string;
|
|
192
|
+
moqWsUrl: string;
|
|
193
|
+
serverCertificateHashes?: ServerCertificateHash[];
|
|
194
|
+
}
|
|
195
|
+
interface MoQConnectInfo {
|
|
196
|
+
logsUrl?: string;
|
|
197
|
+
statsUrl?: string;
|
|
198
|
+
telemetry?: Telemetry;
|
|
199
|
+
channels: ChannelWithCatalog[];
|
|
200
|
+
edges: Edge[];
|
|
201
|
+
}
|
|
202
|
+
interface VindralConnectInfo {
|
|
203
|
+
logsUrl?: string;
|
|
204
|
+
statsUrl?: string;
|
|
205
|
+
telemetry?: Telemetry;
|
|
206
|
+
channels: ChannelWithRenditions[];
|
|
207
|
+
edges: string[];
|
|
208
|
+
}
|
|
209
|
+
export type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
|
|
210
|
+
/**
|
|
211
|
+
* Represents a timed metadata event
|
|
212
|
+
*/
|
|
213
|
+
export interface Metadata {
|
|
214
|
+
/**
|
|
215
|
+
* The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
|
|
216
|
+
*/
|
|
217
|
+
content: string;
|
|
218
|
+
/**
|
|
219
|
+
* Timestamp in ms
|
|
220
|
+
*/
|
|
221
|
+
timestamp: number;
|
|
222
|
+
}
|
|
223
|
+
export interface TimeRange {
|
|
224
|
+
start: number;
|
|
225
|
+
end: number;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The current reconnect state to use to decide whether to kep reconnecting or not
|
|
229
|
+
*/
|
|
230
|
+
export interface ReconnectState {
|
|
231
|
+
/**
|
|
232
|
+
* The number or retry attempts so far.
|
|
233
|
+
* This gets reset on every successful connect, so it will start from zero every
|
|
234
|
+
* time the client instance gets disconnected and will increment until the
|
|
235
|
+
* client instance makes a connection attempt is successful.
|
|
236
|
+
*/
|
|
237
|
+
reconnectRetries: number;
|
|
238
|
+
}
|
|
122
239
|
interface Size {
|
|
123
240
|
width: number;
|
|
124
241
|
height: number;
|
|
@@ -141,6 +258,19 @@ export interface AdvancedOptions {
|
|
|
141
258
|
*/
|
|
142
259
|
wasmDecodingConstraint: Partial<VideoConstraint>;
|
|
143
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* DRM options to provide to the Vindral instance
|
|
263
|
+
*/
|
|
264
|
+
export interface DrmOptions {
|
|
265
|
+
/**
|
|
266
|
+
* Headers to be added to requests to license servers
|
|
267
|
+
*/
|
|
268
|
+
headers?: Record<string, string>;
|
|
269
|
+
/**
|
|
270
|
+
* Query parameters to be added to requests to license servers
|
|
271
|
+
*/
|
|
272
|
+
queryParams?: Record<string, string>;
|
|
273
|
+
}
|
|
144
274
|
type Media = "audio" | "video" | "audio+video";
|
|
145
275
|
/**
|
|
146
276
|
* Options for the Vindral instance
|
|
@@ -335,6 +465,10 @@ export interface Options {
|
|
|
335
465
|
advanced?: AdvancedOptions;
|
|
336
466
|
media?: Media;
|
|
337
467
|
videoCodecs?: VideoCodec[];
|
|
468
|
+
/**
|
|
469
|
+
* DRM options to provide to the Vindral instance
|
|
470
|
+
*/
|
|
471
|
+
drm?: DrmOptions;
|
|
338
472
|
}
|
|
339
473
|
/**
|
|
340
474
|
* Represents a rendition (quality level).
|
|
@@ -352,60 +486,95 @@ export interface RenditionLevelChanged {
|
|
|
352
486
|
to?: RenditionLevel;
|
|
353
487
|
reason: RenditionLevelChangedReason;
|
|
354
488
|
}
|
|
489
|
+
declare const defaultOptions: {
|
|
490
|
+
sizeBasedResolutionCapEnabled: boolean;
|
|
491
|
+
pictureInPictureEnabled: boolean;
|
|
492
|
+
abrEnabled: boolean;
|
|
493
|
+
burstEnabled: boolean;
|
|
494
|
+
mseEnabled: boolean;
|
|
495
|
+
mseOpusEnabled: boolean;
|
|
496
|
+
muted: boolean;
|
|
497
|
+
minBufferTime: number;
|
|
498
|
+
maxBufferTime: number;
|
|
499
|
+
logLevel: Level;
|
|
500
|
+
maxSize: Size;
|
|
501
|
+
maxVideoBitRate: number;
|
|
502
|
+
maxAudioBitRate: number;
|
|
503
|
+
tags: string[];
|
|
504
|
+
media: Media;
|
|
505
|
+
poster: string | boolean;
|
|
506
|
+
reconnectHandler: (state: ReconnectState) => Promise<boolean> | boolean;
|
|
507
|
+
iosWakeLockEnabled: boolean;
|
|
508
|
+
telemetryEnabled: boolean;
|
|
509
|
+
iosMediaElementEnabled: boolean;
|
|
510
|
+
pauseSupportEnabled: boolean;
|
|
511
|
+
advanced: {
|
|
512
|
+
wasmDecodingConstraint: Partial<VideoConstraint>;
|
|
513
|
+
};
|
|
514
|
+
videoCodecs: VideoCodec[];
|
|
515
|
+
};
|
|
516
|
+
interface VindralErrorProps {
|
|
517
|
+
isFatal: boolean;
|
|
518
|
+
type?: ErrorType;
|
|
519
|
+
code: string;
|
|
520
|
+
source?: Error | MediaError;
|
|
521
|
+
}
|
|
522
|
+
export declare const CONNECTION_FAILED_CODE = "connection_failed";
|
|
523
|
+
export declare const CONNECTION_FAILED_AFTER_RETRIES_CODE = "connection_failed_will_not_attempt_again";
|
|
524
|
+
export declare const AUTHENTICATION_FAILED_CODE = "authentication_error";
|
|
525
|
+
export declare const AUTHENTICATION_EXPIRED_CODE = "authentication_expired";
|
|
526
|
+
export declare const CHANNEL_NOT_FOUND_CODE = "channel_not_found";
|
|
527
|
+
export declare const NO_INCOMING_DATA = "no_incoming_data_error";
|
|
528
|
+
export declare const INACTIVITY_CODE = "connection_inactivity";
|
|
529
|
+
export declare const DISCONNECTED_BY_EDGE = "disconnected_by_edge";
|
|
530
|
+
type ErrorType = "internal" | "external";
|
|
355
531
|
/**
|
|
356
|
-
*
|
|
532
|
+
* Represents a vindral error - all errors emitted from the Vindral instance inherit from this class.
|
|
357
533
|
*/
|
|
358
|
-
export
|
|
534
|
+
export declare class VindralError extends Error {
|
|
535
|
+
private props;
|
|
536
|
+
private extra;
|
|
537
|
+
constructor(message: string, props: VindralErrorProps, extra?: {});
|
|
359
538
|
/**
|
|
360
|
-
*
|
|
539
|
+
* The error code is a stable string that represents the error type - this should be treated as an
|
|
540
|
+
* opaque string that can be used as a key for looking up localized strings for displaying error messages.
|
|
541
|
+
* @returns the error code
|
|
361
542
|
*/
|
|
362
|
-
|
|
543
|
+
code: () => string;
|
|
363
544
|
/**
|
|
364
|
-
*
|
|
545
|
+
* Indicates whether the error is fatal - if it is that means the Vindral instance will be unloaded because of this error.
|
|
365
546
|
*/
|
|
366
|
-
|
|
547
|
+
isFatal: () => boolean;
|
|
367
548
|
/**
|
|
368
|
-
*
|
|
549
|
+
* The underlying error that caused the Vindral error
|
|
550
|
+
* @returns the underlying error
|
|
369
551
|
*/
|
|
370
|
-
|
|
552
|
+
source: () => Error | MediaError | undefined;
|
|
553
|
+
type: () => ErrorType;
|
|
371
554
|
/**
|
|
372
|
-
*
|
|
555
|
+
* @returns a stringifiable represenation of the error
|
|
373
556
|
*/
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
interface ClientOverrides {
|
|
377
|
-
maxVideoBitRate?: number;
|
|
378
|
-
minBufferTime?: number;
|
|
379
|
-
maxBufferTime?: number;
|
|
380
|
-
burstEnabled?: boolean;
|
|
381
|
-
sizeBasedResolutionCapEnabled?: boolean;
|
|
382
|
-
separateVideoSocketEnabled?: boolean;
|
|
383
|
-
videoCodecs?: string[];
|
|
384
|
-
}
|
|
385
|
-
interface ChannelWithRenditionsAndOverrides extends Channel {
|
|
386
|
-
renditions: Rendition[];
|
|
387
|
-
overrides?: ClientOverrides;
|
|
388
|
-
}
|
|
389
|
-
interface ConnectOptions {
|
|
390
|
-
channelGroupId?: string;
|
|
391
|
-
channelId: string;
|
|
557
|
+
toStringifiable: () => Record<string, unknown>;
|
|
392
558
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
559
|
+
type PlaybackState = "buffering" | "playing" | "paused";
|
|
560
|
+
type BufferStateEvent = "filled" | "drained";
|
|
561
|
+
interface PlaybackModuleStatistics {
|
|
562
|
+
/**
|
|
563
|
+
* Current target buffer time if using dynamic buffer. Otherwise, this is the statically set buffer time from instantiation.
|
|
564
|
+
*/
|
|
565
|
+
bufferTime: number;
|
|
566
|
+
needsInputForAudioCount: number;
|
|
567
|
+
needsInputForVideoCount: number;
|
|
402
568
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
569
|
+
interface NeedsUserInputContext {
|
|
570
|
+
/**
|
|
571
|
+
* True if user input is needed for audio
|
|
572
|
+
*/
|
|
573
|
+
forAudio: boolean;
|
|
574
|
+
/**
|
|
575
|
+
* True if user input is needed for video
|
|
576
|
+
*/
|
|
577
|
+
forVideo: boolean;
|
|
409
578
|
}
|
|
410
579
|
/**
|
|
411
580
|
* ApiClientOptions
|
|
@@ -433,6 +602,10 @@ export interface AuthorizationContext {
|
|
|
433
602
|
*/
|
|
434
603
|
channelId?: string;
|
|
435
604
|
}
|
|
605
|
+
interface ConnectOptions {
|
|
606
|
+
channelGroupId?: string;
|
|
607
|
+
channelId: string;
|
|
608
|
+
}
|
|
436
609
|
/**
|
|
437
610
|
* AuthorizationTokenFactory
|
|
438
611
|
*/
|
|
@@ -447,7 +620,7 @@ export declare class ApiClient {
|
|
|
447
620
|
/**
|
|
448
621
|
* Returns everything needed to setup the connection of Vindral instance.
|
|
449
622
|
*/
|
|
450
|
-
connect(options: ConnectOptions): Promise<
|
|
623
|
+
connect(options: ConnectOptions): Promise<ConnectInfo>;
|
|
451
624
|
/**
|
|
452
625
|
* Fetches information regarding a single channel.
|
|
453
626
|
*
|
|
@@ -469,431 +642,9 @@ export declare class ApiClient {
|
|
|
469
642
|
private toChannels;
|
|
470
643
|
private toChannel;
|
|
471
644
|
}
|
|
472
|
-
|
|
473
|
-
* Available events to listen to
|
|
474
|
-
*/
|
|
475
|
-
export interface CastSenderEvents {
|
|
645
|
+
interface AdaptivityStatistics {
|
|
476
646
|
/**
|
|
477
|
-
*
|
|
478
|
-
*/
|
|
479
|
-
["connected"]: void;
|
|
480
|
-
/**
|
|
481
|
-
* When a previous session has been resumed
|
|
482
|
-
*/
|
|
483
|
-
["resumed"]: void;
|
|
484
|
-
/**
|
|
485
|
-
* When a CastReceiver has lost or stopped a connection
|
|
486
|
-
*/
|
|
487
|
-
["disconnected"]: void;
|
|
488
|
-
/**
|
|
489
|
-
* When a connection attempt was initiated unsuccessfully
|
|
490
|
-
*/
|
|
491
|
-
["failed"]: void;
|
|
492
|
-
/**
|
|
493
|
-
* When the remote connection emits a metadata event
|
|
494
|
-
*/
|
|
495
|
-
["metadata"]: Metadata;
|
|
496
|
-
/**
|
|
497
|
-
* When the remote connection receives a server wallclock time event
|
|
498
|
-
*/
|
|
499
|
-
["server wallclock time"]: number;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Used for initializing the CastSender
|
|
503
|
-
*/
|
|
504
|
-
export interface CastConfig {
|
|
505
|
-
/**
|
|
506
|
-
* The [Vindral Options](./Options) to use for the Cast Receiver
|
|
507
|
-
*/
|
|
508
|
-
options: Options;
|
|
509
|
-
/**
|
|
510
|
-
* URL to a background image.
|
|
511
|
-
* Example: "https://via.placeholder.com/256x144"
|
|
512
|
-
*/
|
|
513
|
-
background?: string;
|
|
514
|
-
/**
|
|
515
|
-
* Override this if you have your own custom receiver
|
|
516
|
-
*/
|
|
517
|
-
receiverApplicationId?: string;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* CastSender handles initiation of and communication with the Google Cast Receiver
|
|
521
|
-
*/
|
|
522
|
-
export declare class CastSender extends Emitter<CastSenderEvents> {
|
|
523
|
-
private state;
|
|
524
|
-
private config;
|
|
525
|
-
private unloaded;
|
|
526
|
-
constructor(config: CastConfig);
|
|
527
|
-
/**
|
|
528
|
-
* True if the instance is casting right now
|
|
529
|
-
*/
|
|
530
|
-
get casting(): boolean;
|
|
531
|
-
/**
|
|
532
|
-
* The current volume
|
|
533
|
-
*/
|
|
534
|
-
get volume(): number;
|
|
535
|
-
/**
|
|
536
|
-
* Set the current volume. Setting this to zero is equivalent to muting the video
|
|
537
|
-
*/
|
|
538
|
-
set volume(volume: number);
|
|
539
|
-
/**
|
|
540
|
-
* The current language
|
|
541
|
-
*/
|
|
542
|
-
get language(): string | undefined;
|
|
543
|
-
/**
|
|
544
|
-
* Set the current language
|
|
545
|
-
*/
|
|
546
|
-
set language(language: string | undefined);
|
|
547
|
-
/**
|
|
548
|
-
* The current channelId
|
|
549
|
-
*/
|
|
550
|
-
get channelId(): string;
|
|
551
|
-
/**
|
|
552
|
-
* Set the current channelId
|
|
553
|
-
*/
|
|
554
|
-
set channelId(channelId: string);
|
|
555
|
-
/**
|
|
556
|
-
* Update authentication token on an already established and authenticated connection
|
|
557
|
-
*/
|
|
558
|
-
updateAuthenticationToken: (token: string) => void;
|
|
559
|
-
/**
|
|
560
|
-
* Fully unloads the instance. This disconnects the current listener but lets the
|
|
561
|
-
* cast session continue on the receiving device
|
|
562
|
-
*/
|
|
563
|
-
unload: () => void;
|
|
564
|
-
/**
|
|
565
|
-
* Initiates the CastSender.
|
|
566
|
-
* Will reject if Cast is not available on the device or the network.
|
|
567
|
-
*/
|
|
568
|
-
init: () => Promise<void>;
|
|
569
|
-
/**
|
|
570
|
-
* Requests a session. It will open the native cast receiver chooser dialog
|
|
571
|
-
*/
|
|
572
|
-
start: () => Promise<void>;
|
|
573
|
-
/**
|
|
574
|
-
* Stops a session. It will stop playback on device as well.
|
|
575
|
-
*/
|
|
576
|
-
stop: () => void;
|
|
577
|
-
/**
|
|
578
|
-
* Returns a string representing the name of the Cast receiver device or undefined if no receiver exists
|
|
579
|
-
*/
|
|
580
|
-
getReceiverName: () => string | undefined;
|
|
581
|
-
private onGCastApiAvailable;
|
|
582
|
-
private send;
|
|
583
|
-
private onMessage;
|
|
584
|
-
private onSessionStarted;
|
|
585
|
-
private onSessionStateChanged;
|
|
586
|
-
private getInstance;
|
|
587
|
-
private getSession;
|
|
588
|
-
private castLibrariesAdded;
|
|
589
|
-
private verifyCastLibraries;
|
|
590
|
-
}
|
|
591
|
-
interface VindralErrorProps {
|
|
592
|
-
isFatal: boolean;
|
|
593
|
-
type?: ErrorType;
|
|
594
|
-
code: string;
|
|
595
|
-
source?: Error | MediaError;
|
|
596
|
-
}
|
|
597
|
-
export declare const CONNECTION_FAILED_CODE = "connection_failed";
|
|
598
|
-
export declare const CONNECTION_FAILED_AFTER_RETRIES_CODE = "connection_failed_will_not_attempt_again";
|
|
599
|
-
export declare const AUTHENTICATION_FAILED_CODE = "authentication_error";
|
|
600
|
-
export declare const AUTHENTICATION_EXPIRED_CODE = "authentication_expired";
|
|
601
|
-
export declare const CHANNEL_NOT_FOUND_CODE = "channel_not_found";
|
|
602
|
-
export declare const NO_INCOMING_DATA = "no_incoming_data_error";
|
|
603
|
-
export declare const INACTIVITY_CODE = "connection_inactivity";
|
|
604
|
-
export declare const DISCONNECTED_BY_EDGE = "disconnected_by_edge";
|
|
605
|
-
type ErrorType = "internal" | "external";
|
|
606
|
-
/**
|
|
607
|
-
* Represents a vindral error - all errors emitted from the Vindral instance inherit from this class.
|
|
608
|
-
*/
|
|
609
|
-
export declare class VindralError extends Error {
|
|
610
|
-
private props;
|
|
611
|
-
private extra;
|
|
612
|
-
constructor(message: string, props: VindralErrorProps, extra?: {});
|
|
613
|
-
/**
|
|
614
|
-
* The error code is a stable string that represents the error type - this should be treated as an
|
|
615
|
-
* opaque string that can be used as a key for looking up localized strings for displaying error messages.
|
|
616
|
-
* @returns the error code
|
|
617
|
-
*/
|
|
618
|
-
code: () => string;
|
|
619
|
-
/**
|
|
620
|
-
* Indicates whether the error is fatal - if it is that means the Vindral instance will be unloaded because of this error.
|
|
621
|
-
*/
|
|
622
|
-
isFatal: () => boolean;
|
|
623
|
-
/**
|
|
624
|
-
* The underlying error that caused the Vindral error
|
|
625
|
-
* @returns the underlying error
|
|
626
|
-
*/
|
|
627
|
-
source: () => Error | MediaError | undefined;
|
|
628
|
-
type: () => ErrorType;
|
|
629
|
-
/**
|
|
630
|
-
* @returns a stringifiable represenation of the error
|
|
631
|
-
*/
|
|
632
|
-
toStringifiable: () => Record<string, unknown>;
|
|
633
|
-
}
|
|
634
|
-
interface AirPlaySenderEvents {
|
|
635
|
-
/**
|
|
636
|
-
* When airplay targets are available.
|
|
637
|
-
*/
|
|
638
|
-
["available"]: void;
|
|
639
|
-
/**
|
|
640
|
-
* When a connection has been established with an airplay target.
|
|
641
|
-
*/
|
|
642
|
-
["connected"]: void;
|
|
643
|
-
/**
|
|
644
|
-
* When the airplay target has lost or stopped a connection.
|
|
645
|
-
*/
|
|
646
|
-
["disconnected"]: void;
|
|
647
|
-
}
|
|
648
|
-
interface AirPlayConfig {
|
|
649
|
-
/**
|
|
650
|
-
* URL to use when connecting to the stream.
|
|
651
|
-
*/
|
|
652
|
-
url: string;
|
|
653
|
-
/**
|
|
654
|
-
* Channel ID to connect to.
|
|
655
|
-
*/
|
|
656
|
-
channelId: string;
|
|
657
|
-
/**
|
|
658
|
-
* A container to attach the video element in. This should be the same container that the vindral video element is attached to.
|
|
659
|
-
*/
|
|
660
|
-
container: HTMLElement;
|
|
661
|
-
/**
|
|
662
|
-
* An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
|
|
663
|
-
* Note: If not supplied when needed, an "Authentication Failed" error will be raised.
|
|
664
|
-
*/
|
|
665
|
-
authenticationToken?: string;
|
|
666
|
-
}
|
|
667
|
-
declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
|
|
668
|
-
private config;
|
|
669
|
-
private hlsUrl;
|
|
670
|
-
private element;
|
|
671
|
-
private connectingTimeout?;
|
|
672
|
-
constructor(config: AirPlayConfig);
|
|
673
|
-
/**
|
|
674
|
-
* True if the instance is casting right now.
|
|
675
|
-
*/
|
|
676
|
-
get casting(): boolean;
|
|
677
|
-
/**
|
|
678
|
-
* Set the current channelId.
|
|
679
|
-
*/
|
|
680
|
-
set channelId(channelId: string);
|
|
681
|
-
/**
|
|
682
|
-
* Update authentication token on an already established and authenticated connection.
|
|
683
|
-
*/
|
|
684
|
-
updateAuthenticationToken: (_token: string) => void;
|
|
685
|
-
/**
|
|
686
|
-
* Fully unloads the instance. This disconnects the current listeners.
|
|
687
|
-
*/
|
|
688
|
-
unload: () => void;
|
|
689
|
-
/**
|
|
690
|
-
* Show the AirPlay picker.
|
|
691
|
-
*/
|
|
692
|
-
showPlaybackTargetPicker(): void;
|
|
693
|
-
/**
|
|
694
|
-
* Returns if AirPlay is supported.
|
|
695
|
-
*/
|
|
696
|
-
static isAirPlaySupported(): boolean;
|
|
697
|
-
private onAirPlayAvailable;
|
|
698
|
-
private onAirPlayPlaybackChanged;
|
|
699
|
-
private checkHlsUrl;
|
|
700
|
-
}
|
|
701
|
-
type PlaybackState = "buffering" | "playing" | "paused";
|
|
702
|
-
type BufferStateEvent = "filled" | "drained";
|
|
703
|
-
interface PlaybackModuleStatistics {
|
|
704
|
-
/**
|
|
705
|
-
* Current target buffer time if using dynamic buffer. Otherwise, this is the statically set buffer time from instantiation.
|
|
706
|
-
*/
|
|
707
|
-
bufferTime: number;
|
|
708
|
-
needsInputForAudioCount: number;
|
|
709
|
-
needsInputForVideoCount: number;
|
|
710
|
-
}
|
|
711
|
-
interface NeedsUserInputContext {
|
|
712
|
-
/**
|
|
713
|
-
* True if user input is needed for audio
|
|
714
|
-
*/
|
|
715
|
-
forAudio: boolean;
|
|
716
|
-
/**
|
|
717
|
-
* True if user input is needed for video
|
|
718
|
-
*/
|
|
719
|
-
forVideo: boolean;
|
|
720
|
-
}
|
|
721
|
-
type State = "connected" | "disconnected" | "connecting";
|
|
722
|
-
type ContextSwitchState = "completed" | "started";
|
|
723
|
-
interface ConnectionStatistics {
|
|
724
|
-
/**
|
|
725
|
-
* RTT (round trip time) between client and server(s).
|
|
726
|
-
*/
|
|
727
|
-
rtt: MinMaxAverage;
|
|
728
|
-
/**
|
|
729
|
-
* A very rough initial estimation of minimum available bandwidth.
|
|
730
|
-
*/
|
|
731
|
-
estimatedBandwidth: number;
|
|
732
|
-
edgeUrl?: string;
|
|
733
|
-
/**
|
|
734
|
-
* Total number of connections that have been established since instantiation.
|
|
735
|
-
*/
|
|
736
|
-
connectCount: number;
|
|
737
|
-
/**
|
|
738
|
-
* Total number of connection attempts since instantiation.
|
|
739
|
-
*/
|
|
740
|
-
connectionAttemptCount: number;
|
|
741
|
-
}
|
|
742
|
-
/**
|
|
743
|
-
* Contextual information about the language switch
|
|
744
|
-
*/
|
|
745
|
-
export interface LanguageSwitchContext {
|
|
746
|
-
/**
|
|
747
|
-
* The new language that was switched to
|
|
748
|
-
*/
|
|
749
|
-
language: string;
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Contextual information about the channel switch
|
|
753
|
-
*/
|
|
754
|
-
export interface ChannelSwitchContext {
|
|
755
|
-
/**
|
|
756
|
-
* The new channel id that was switched to
|
|
757
|
-
*/
|
|
758
|
-
channelId: string;
|
|
759
|
-
}
|
|
760
|
-
interface VolumeState {
|
|
761
|
-
/**
|
|
762
|
-
* Wether the audio is muted
|
|
763
|
-
*/
|
|
764
|
-
isMuted: boolean;
|
|
765
|
-
/**
|
|
766
|
-
* The volume level
|
|
767
|
-
*/
|
|
768
|
-
volume: number;
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* The events that can be emitted from the Vindral instance
|
|
772
|
-
*/
|
|
773
|
-
export interface PublicVindralEvents {
|
|
774
|
-
/**
|
|
775
|
-
* When an error that requires action has occured
|
|
776
|
-
*
|
|
777
|
-
* Can be a fatal error that will unload the Vindral instance - this is indicated by `isFatal()` on the error object returning true.
|
|
778
|
-
*
|
|
779
|
-
* 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
|
|
780
|
-
* 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.
|
|
781
|
-
*/
|
|
782
|
-
["error"]: Readonly<VindralError>;
|
|
783
|
-
/**
|
|
784
|
-
* When the instance needs user input to activate audio or sometimes video playback.
|
|
785
|
-
* Is called with an object
|
|
786
|
-
* ```javascript
|
|
787
|
-
* {
|
|
788
|
-
* forAudio: boolean // true if user input is needed for audio playback
|
|
789
|
-
* forVideo: boolean // true if user input is needed for video playback
|
|
790
|
-
* }
|
|
791
|
-
* ```
|
|
792
|
-
*/
|
|
793
|
-
["needs user input"]: NeedsUserInputContext;
|
|
794
|
-
/**
|
|
795
|
-
* When a timed metadata event has been triggered
|
|
796
|
-
*/
|
|
797
|
-
["metadata"]: Readonly<Metadata>;
|
|
798
|
-
/**
|
|
799
|
-
* When the playback state changes
|
|
800
|
-
*/
|
|
801
|
-
["playback state"]: Readonly<PlaybackState>;
|
|
802
|
-
/**
|
|
803
|
-
* When the connection state changes
|
|
804
|
-
*/
|
|
805
|
-
["connection state"]: Readonly<State>;
|
|
806
|
-
/**
|
|
807
|
-
* When the available rendition levels is changed
|
|
808
|
-
*/
|
|
809
|
-
["rendition levels"]: ReadonlyArray<RenditionLevel>;
|
|
810
|
-
/**
|
|
811
|
-
* When the rendition level is changed
|
|
812
|
-
*/
|
|
813
|
-
["rendition level"]: Readonly<RenditionLevel>;
|
|
814
|
-
/**
|
|
815
|
-
* When the available languages is changed
|
|
816
|
-
*/
|
|
817
|
-
["languages"]: ReadonlyArray<string>;
|
|
818
|
-
/**
|
|
819
|
-
* When the available text tracks are changed
|
|
820
|
-
*/
|
|
821
|
-
["text tracks"]: ReadonlyArray<string>;
|
|
822
|
-
/**
|
|
823
|
-
* When the available channels is changed
|
|
824
|
-
*/
|
|
825
|
-
["channels"]: ReadonlyArray<Channel>;
|
|
826
|
-
/**
|
|
827
|
-
* When a context switch state change has occured.
|
|
828
|
-
* E.g. when a channel change has been requested, or quality is changed.
|
|
829
|
-
*/
|
|
830
|
-
["context switch"]: Readonly<ContextSwitchState>;
|
|
831
|
-
/**
|
|
832
|
-
* Emitted when a wallclock time message has been received from the server.
|
|
833
|
-
*
|
|
834
|
-
* Note: This is the edge server wallclock time and thus may differ slightly
|
|
835
|
-
* between two viewers if they are connected to different edge servers.
|
|
836
|
-
*/
|
|
837
|
-
["server wallclock time"]: Readonly<number>;
|
|
838
|
-
/**
|
|
839
|
-
* Is emitted during connection whether the channel is live or not.
|
|
840
|
-
*
|
|
841
|
-
* If the channel is not live, the Vindral instance will try to reconnect until the `reconnectHandler`
|
|
842
|
-
* determines that no more retries should be made.
|
|
843
|
-
*
|
|
844
|
-
* Note: If the web-sdk is instantiated at the same time as you are starting the stream it is possible
|
|
845
|
-
* that this emits false until the started state has propagated through the system.
|
|
846
|
-
*/
|
|
847
|
-
["is live"]: boolean;
|
|
848
|
-
/**
|
|
849
|
-
* Emitted when a channel switch has been completed and the first frame of the new channel is rendered.
|
|
850
|
-
* A string containing the channel id of the new channel is provided as an argument.
|
|
851
|
-
*/
|
|
852
|
-
["channel switch"]: Readonly<ChannelSwitchContext>;
|
|
853
|
-
/**
|
|
854
|
-
* Emitted when a language switch has been completed and the new language starts playing.
|
|
855
|
-
*/
|
|
856
|
-
["language switch"]: Readonly<LanguageSwitchContext>;
|
|
857
|
-
/**
|
|
858
|
-
* Emitted when the volume state changes.
|
|
859
|
-
*
|
|
860
|
-
* This is triggered triggered both when the user changes the volume through the Vindral instance, but also
|
|
861
|
-
* from external sources such as OS media shortcuts or other native UI outside of the browser.
|
|
862
|
-
*/
|
|
863
|
-
["volume state"]: Readonly<VolumeState>;
|
|
864
|
-
["buffer state event"]: Readonly<BufferStateEvent>;
|
|
865
|
-
["initialized media"]: void;
|
|
866
|
-
}
|
|
867
|
-
declare const defaultOptions: {
|
|
868
|
-
sizeBasedResolutionCapEnabled: boolean;
|
|
869
|
-
pictureInPictureEnabled: boolean;
|
|
870
|
-
abrEnabled: boolean;
|
|
871
|
-
burstEnabled: boolean;
|
|
872
|
-
mseEnabled: boolean;
|
|
873
|
-
mseOpusEnabled: boolean;
|
|
874
|
-
muted: boolean;
|
|
875
|
-
minBufferTime: number;
|
|
876
|
-
maxBufferTime: number;
|
|
877
|
-
logLevel: "off" | "error" | "warn" | "info" | "debug" | "trace";
|
|
878
|
-
maxSize: Size;
|
|
879
|
-
maxVideoBitRate: number;
|
|
880
|
-
maxAudioBitRate: number;
|
|
881
|
-
tags: string[];
|
|
882
|
-
media: Media;
|
|
883
|
-
poster: string | boolean;
|
|
884
|
-
reconnectHandler: (state: ReconnectState) => Promise<boolean> | boolean;
|
|
885
|
-
iosWakeLockEnabled: boolean;
|
|
886
|
-
telemetryEnabled: boolean;
|
|
887
|
-
iosMediaElementEnabled: boolean;
|
|
888
|
-
pauseSupportEnabled: boolean;
|
|
889
|
-
advanced: {
|
|
890
|
-
wasmDecodingConstraint: Partial<VideoConstraint>;
|
|
891
|
-
};
|
|
892
|
-
videoCodecs: VideoCodec[];
|
|
893
|
-
};
|
|
894
|
-
interface AdaptivityStatistics {
|
|
895
|
-
/**
|
|
896
|
-
* True if adaptive bitrate (ABR) is enabled.
|
|
647
|
+
* True if adaptive bitrate (ABR) is enabled.
|
|
897
648
|
*/
|
|
898
649
|
isAbrEnabled: boolean;
|
|
899
650
|
}
|
|
@@ -979,8 +730,6 @@ interface DecoderStatistics {
|
|
|
979
730
|
audioDecodeTime: MinMaxAverage;
|
|
980
731
|
videoTransportTime: MinMaxAverage;
|
|
981
732
|
}
|
|
982
|
-
type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
|
|
983
|
-
type EffectiveConnectionType = "2g" | "3g" | "4g" | "slow-2g";
|
|
984
733
|
interface DocumentStateModulesStatistics {
|
|
985
734
|
isVisible: boolean;
|
|
986
735
|
isOnline: boolean;
|
|
@@ -1044,15 +793,6 @@ interface SyncModuleStatistics {
|
|
|
1044
793
|
timeshiftDriftAdjustmentCount: number;
|
|
1045
794
|
seekTime: number;
|
|
1046
795
|
}
|
|
1047
|
-
interface TelemetryModuleStatistics {
|
|
1048
|
-
/**
|
|
1049
|
-
* The total amount of errors being spawned. Note that some media errors can trigger
|
|
1050
|
-
* thousands of errors for a single client in a few seconds before recovering. Therefore,
|
|
1051
|
-
* consider the number of viewers with errors, not just the total amount. Also, consider the median
|
|
1052
|
-
* instead of the mean for average calculation.
|
|
1053
|
-
*/
|
|
1054
|
-
errorCount: number;
|
|
1055
|
-
}
|
|
1056
796
|
interface VideoPlayerStatistics {
|
|
1057
797
|
renderedFrameCount: number;
|
|
1058
798
|
rendererDroppedFrameCount: number;
|
|
@@ -1182,7 +922,6 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
1182
922
|
#private;
|
|
1183
923
|
private static MAX_POOL_SIZE;
|
|
1184
924
|
private static INITIAL_MAX_BIT_RATE;
|
|
1185
|
-
private static PING_TIMEOUT;
|
|
1186
925
|
private static DISCONNECT_TIMEOUT;
|
|
1187
926
|
private static REMOVE_CUE_THRESHOLD;
|
|
1188
927
|
/**
|
|
@@ -1221,347 +960,686 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
1221
960
|
private _channels;
|
|
1222
961
|
private createdAt;
|
|
1223
962
|
private hasCalledConnect;
|
|
1224
|
-
private apiClient;
|
|
1225
963
|
private latestEmittedLanguages;
|
|
1226
964
|
private wakeLock;
|
|
1227
|
-
private cachedEdges;
|
|
1228
|
-
private shiftedEdges;
|
|
1229
965
|
private pool;
|
|
1230
966
|
private userAgentInformation;
|
|
967
|
+
private encryptedMediaExtensions;
|
|
1231
968
|
private sampleProcessingSesssions;
|
|
1232
969
|
private sizes;
|
|
1233
970
|
private isSuspended;
|
|
1234
971
|
private disconnectTimeout;
|
|
1235
972
|
constructor(options: Options);
|
|
1236
973
|
/**
|
|
1237
|
-
* Attaches the video view to a DOM element. The Vindral video view will be sized to fill this element while
|
|
1238
|
-
* maintaining the correct aspect ratio.
|
|
1239
|
-
* @param container the container element to append the video view to. Often a div element.
|
|
1240
|
-
* @returns
|
|
974
|
+
* Attaches the video view to a DOM element. The Vindral video view will be sized to fill this element while
|
|
975
|
+
* maintaining the correct aspect ratio.
|
|
976
|
+
* @param container the container element to append the video view to. Often a div element.
|
|
977
|
+
* @returns
|
|
978
|
+
*/
|
|
979
|
+
attach: (container: HTMLElement) => void;
|
|
980
|
+
/**
|
|
981
|
+
* Set the current volume.
|
|
982
|
+
* Setting this to 0 is not equivalent to muting the audio.
|
|
983
|
+
* Setting this to >0 is not equivalent to unmuting the audio.
|
|
984
|
+
*
|
|
985
|
+
* Note that setting volume is not allowed on iPadOS and iOS devices.
|
|
986
|
+
* This is an OS/browser limitation on the video element.
|
|
987
|
+
*
|
|
988
|
+
* [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)
|
|
989
|
+
* for iOS-Specific Considerations. The following section is the important part:
|
|
990
|
+
* 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.
|
|
991
|
+
*/
|
|
992
|
+
set volume(volume: number);
|
|
993
|
+
/**
|
|
994
|
+
* The current volume. Note that if the playback is muted volume can still be set.
|
|
995
|
+
*/
|
|
996
|
+
get volume(): number;
|
|
997
|
+
/**
|
|
998
|
+
* Set playback to muted/unmuted
|
|
999
|
+
*/
|
|
1000
|
+
set muted(muted: boolean);
|
|
1001
|
+
/**
|
|
1002
|
+
* Whether the playback is muted or not
|
|
1003
|
+
*/
|
|
1004
|
+
get muted(): boolean;
|
|
1005
|
+
/**
|
|
1006
|
+
* Media (audio | video | audio+video)
|
|
1007
|
+
*/
|
|
1008
|
+
get media(): Media;
|
|
1009
|
+
/**
|
|
1010
|
+
* The current average video bit rate in bits/s
|
|
1011
|
+
*/
|
|
1012
|
+
get videoBitRate(): number;
|
|
1013
|
+
/**
|
|
1014
|
+
* The current average audio bit rate in bits/s
|
|
1015
|
+
*/
|
|
1016
|
+
get audioBitRate(): number;
|
|
1017
|
+
/**
|
|
1018
|
+
* The current connection state
|
|
1019
|
+
*/
|
|
1020
|
+
get connectionState(): Readonly<State>;
|
|
1021
|
+
/**
|
|
1022
|
+
* The current playback state
|
|
1023
|
+
*/
|
|
1024
|
+
get playbackState(): Readonly<PlaybackState>;
|
|
1025
|
+
/**
|
|
1026
|
+
* The current buffer fullness as a floating point value between 0-1, where 1 is full and 0 i empty.
|
|
1027
|
+
*/
|
|
1028
|
+
get bufferFullness(): number;
|
|
1029
|
+
/**
|
|
1030
|
+
* Whether user bandwidth savings by capping the video resolution to the size of the video element is enabled
|
|
1031
|
+
*/
|
|
1032
|
+
get sizeBasedResolutionCapEnabled(): boolean;
|
|
1033
|
+
/**
|
|
1034
|
+
* Enables or disables user bandwidth savings by capping the video resolution to the size of the video element.
|
|
1035
|
+
*/
|
|
1036
|
+
set sizeBasedResolutionCapEnabled(enabled: boolean);
|
|
1037
|
+
/**
|
|
1038
|
+
* Whether ABR is currently enabled
|
|
1039
|
+
*/
|
|
1040
|
+
get abrEnabled(): boolean;
|
|
1041
|
+
/**
|
|
1042
|
+
* Enable or disable ABR
|
|
1043
|
+
*
|
|
1044
|
+
* The client will immediatly stop changing renditon level based on QoS metrics
|
|
1045
|
+
*
|
|
1046
|
+
* Note: It is strongly recommended to keep this enabled as it can severly increase
|
|
1047
|
+
* the number of buffering events for viewers.
|
|
1048
|
+
*/
|
|
1049
|
+
set abrEnabled(enabled: boolean);
|
|
1050
|
+
/**
|
|
1051
|
+
* Estimated live edge time for the current channel
|
|
1052
|
+
*/
|
|
1053
|
+
get serverEdgeTime(): number | undefined;
|
|
1054
|
+
/**
|
|
1055
|
+
* @returns Estimated wallclock time on the edge server in milliseconds
|
|
1056
|
+
*/
|
|
1057
|
+
get serverWallclockTime(): number | undefined;
|
|
1058
|
+
/**
|
|
1059
|
+
* Local current time normalized between all channels in the channel group
|
|
1060
|
+
*/
|
|
1061
|
+
get currentTime(): number;
|
|
1062
|
+
/**
|
|
1063
|
+
* Current time for the channel. This is the actual stream time, passed on from your ingress.
|
|
1064
|
+
* Integer overflow could make this value differ from your encoder timestamps if it has been rolling for more
|
|
1065
|
+
* than 42 days with RTMP as target.
|
|
1066
|
+
*
|
|
1067
|
+
* Note: This is not normalized between channels, thus it can make jumps when switching channels
|
|
1068
|
+
*/
|
|
1069
|
+
get channelCurrentTime(): number;
|
|
1070
|
+
/**
|
|
1071
|
+
* The current target buffer time in milliseconds
|
|
1072
|
+
*/
|
|
1073
|
+
get targetBufferTime(): number;
|
|
1074
|
+
/**
|
|
1075
|
+
* Set the current target buffer time in milliseconds
|
|
1076
|
+
*/
|
|
1077
|
+
set targetBufferTime(bufferTimeMs: number);
|
|
1078
|
+
/**
|
|
1079
|
+
* The estimated playback latency based on target buffer time, the connection rtt and local playback drift
|
|
1080
|
+
*/
|
|
1081
|
+
get playbackLatency(): number | undefined;
|
|
1082
|
+
/**
|
|
1083
|
+
* The estimated utc timestamp (in ms) for the playhead.
|
|
1084
|
+
*/
|
|
1085
|
+
get playbackWallclockTime(): number | undefined;
|
|
1086
|
+
/**
|
|
1087
|
+
* Channels that can be switched between
|
|
1088
|
+
*/
|
|
1089
|
+
get channels(): ReadonlyArray<Channel>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Languages available
|
|
1092
|
+
*/
|
|
1093
|
+
get languages(): ReadonlyArray<string>;
|
|
1094
|
+
/**
|
|
1095
|
+
* The current language
|
|
1096
|
+
*/
|
|
1097
|
+
get language(): string | undefined;
|
|
1098
|
+
/**
|
|
1099
|
+
* Set the current language
|
|
1100
|
+
*/
|
|
1101
|
+
set language(language: string | undefined);
|
|
1102
|
+
/**
|
|
1103
|
+
* Set the active text track
|
|
1104
|
+
*/
|
|
1105
|
+
set textTrack(label: string | undefined);
|
|
1106
|
+
/**
|
|
1107
|
+
* Get the available text tracks
|
|
1108
|
+
*/
|
|
1109
|
+
get textTracks(): string[];
|
|
1110
|
+
/**
|
|
1111
|
+
* Get the active text track
|
|
1112
|
+
*/
|
|
1113
|
+
get textTrack(): string | undefined;
|
|
1114
|
+
/**
|
|
1115
|
+
* The current channelId
|
|
1116
|
+
*/
|
|
1117
|
+
get channelId(): string;
|
|
1118
|
+
/**
|
|
1119
|
+
* Set the current channelId
|
|
1120
|
+
*
|
|
1121
|
+
* Possible channels to set are available from [[channels]]
|
|
1122
|
+
*
|
|
1123
|
+
* Note that the following scenarios are not possible right now:
|
|
1124
|
+
* - switching channel from a channel with audio to a channel without audio (unless audio only mode is active)
|
|
1125
|
+
* - switching channel from a channel with video to a channel without video (unless video only mode is active)
|
|
1126
|
+
*/
|
|
1127
|
+
set channelId(channelId: string);
|
|
1128
|
+
/**
|
|
1129
|
+
* Max size that will be subcribed to
|
|
1130
|
+
*/
|
|
1131
|
+
get maxSize(): Size;
|
|
1132
|
+
/**
|
|
1133
|
+
* Set max size that will be subscribed to
|
|
1134
|
+
*
|
|
1135
|
+
* Note: If ABR is disabled, setting this will make the client instantly subscribe to this size
|
|
1136
|
+
*/
|
|
1137
|
+
set maxSize(size: Size);
|
|
1138
|
+
/**
|
|
1139
|
+
* The max video bit rate that will be subscribed to
|
|
1140
|
+
*
|
|
1141
|
+
* Note: Returns Number.MAX_SAFE_INTEGER if no limits have been set
|
|
1142
|
+
*/
|
|
1143
|
+
get maxVideoBitRate(): number;
|
|
1144
|
+
/**
|
|
1145
|
+
* Set max video bit rate that will be subscribed to
|
|
1146
|
+
*
|
|
1147
|
+
* Note: If ABR is disabled, setting this will make the client instantly subscribe to this bitrate
|
|
1148
|
+
*/
|
|
1149
|
+
set maxVideoBitRate(bitRate: number);
|
|
1150
|
+
/**
|
|
1151
|
+
* The max audio bit rate that will be subscribed to
|
|
1152
|
+
*
|
|
1153
|
+
* Note: Returns Number.MAX_SAFE_INTEGER if no limits have been set
|
|
1154
|
+
*/
|
|
1155
|
+
get maxAudioBitRate(): number;
|
|
1156
|
+
/**
|
|
1157
|
+
* Set max audio bit rate that will be subscribed to
|
|
1158
|
+
*
|
|
1159
|
+
* Note: If ABR is disabled, setting this will make the client instantly subscribe to this bit rate
|
|
1160
|
+
*/
|
|
1161
|
+
set maxAudioBitRate(bitRate: number);
|
|
1162
|
+
/**
|
|
1163
|
+
* The rendition levels available.
|
|
1164
|
+
*/
|
|
1165
|
+
get renditionLevels(): ReadonlyArray<RenditionLevel>;
|
|
1166
|
+
/**
|
|
1167
|
+
* The current rendition level
|
|
1168
|
+
*/
|
|
1169
|
+
get currentRenditionLevel(): Readonly<RenditionLevel> | undefined;
|
|
1170
|
+
/**
|
|
1171
|
+
* The target rendition level that the client is currently switching to
|
|
1172
|
+
*/
|
|
1173
|
+
get targetRenditionLevel(): Readonly<RenditionLevel> | undefined;
|
|
1174
|
+
/**
|
|
1175
|
+
* True if the client is currently switching from one rendition level to another
|
|
1176
|
+
*/
|
|
1177
|
+
get isSwitchingRenditionLevel(): boolean;
|
|
1178
|
+
/**
|
|
1179
|
+
* The time ranges buffered for video.
|
|
1180
|
+
* The ranges are specified in milliseconds.
|
|
1181
|
+
*/
|
|
1182
|
+
get videoBufferedRanges(): ReadonlyArray<TimeRange>;
|
|
1183
|
+
/**
|
|
1184
|
+
* The time ranges buffered for audio.
|
|
1185
|
+
* The ranges are specified in milliseconds.
|
|
1186
|
+
*/
|
|
1187
|
+
get audioBufferedRanges(): ReadonlyArray<TimeRange>;
|
|
1188
|
+
/**
|
|
1189
|
+
* The API client for calls to the public available endpoints of the Vindral Live CDN.
|
|
1190
|
+
*/
|
|
1191
|
+
getApiClient(): ApiClient;
|
|
1192
|
+
get lastBufferEvent(): Readonly<BufferStateEvent>;
|
|
1193
|
+
get activeRatios(): Map<string, number>;
|
|
1194
|
+
get bufferingRatios(): Map<string, number>;
|
|
1195
|
+
get timeSpentBuffering(): number;
|
|
1196
|
+
get timeActive(): number;
|
|
1197
|
+
get mediaElement(): HTMLMediaElement | HTMLCanvasElement;
|
|
1198
|
+
get audioNode(): AudioNode | undefined;
|
|
1199
|
+
/**
|
|
1200
|
+
* Get active Vindral Options
|
|
1201
|
+
*/
|
|
1202
|
+
getOptions: () => Options & typeof defaultOptions;
|
|
1203
|
+
/**
|
|
1204
|
+
* Get url for fetching thumbnail. Note that fetching thumbnails only works for an active channel.
|
|
1205
|
+
*/
|
|
1206
|
+
getThumbnailUrl: () => string;
|
|
1207
|
+
/**
|
|
1208
|
+
* Update authentication token on an already established and authenticated connection
|
|
1209
|
+
*/
|
|
1210
|
+
updateAuthenticationToken: (token: string) => void;
|
|
1211
|
+
/**
|
|
1212
|
+
* @deprecated since 3.0.0 Use play instead.
|
|
1213
|
+
* Connects to the configured channel and starts streaming
|
|
1214
|
+
*/
|
|
1215
|
+
connect: () => void;
|
|
1216
|
+
private _connect;
|
|
1217
|
+
/**
|
|
1218
|
+
* Get options that can be used for CastSender
|
|
1241
1219
|
*/
|
|
1242
|
-
|
|
1220
|
+
getCastOptions: () => Options;
|
|
1221
|
+
private onConnectInfo;
|
|
1222
|
+
private emitLanguagesIfChanged;
|
|
1223
|
+
private updateTextTracks;
|
|
1224
|
+
private cleanupTextTracks;
|
|
1225
|
+
private filterRenditions;
|
|
1243
1226
|
/**
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
1246
|
-
|
|
1227
|
+
* Patch the subscription with properties from the channel that isn't known until connection
|
|
1228
|
+
* @param channel Channel with the renditions to patch the subscription based on
|
|
1229
|
+
*/
|
|
1230
|
+
private patchSubscription;
|
|
1231
|
+
private isSupportedVideoCodecProfile;
|
|
1232
|
+
private supportedAudioCodecs;
|
|
1233
|
+
private initializeDecodingModule;
|
|
1234
|
+
/**
|
|
1235
|
+
* Fully unloads the instance. This disconnects the clients and stops any background tasks.
|
|
1236
|
+
* This client instance can not be used after this has been called.
|
|
1237
|
+
*/
|
|
1238
|
+
unload: () => Promise<void>;
|
|
1239
|
+
/**
|
|
1240
|
+
* @deprecated since 3.0.0 Use play instead.
|
|
1247
1241
|
*
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1242
|
+
* Activates audio or video on web browsers that require a user gesture to enable media playback.
|
|
1243
|
+
* The Vindral instance will emit a "needs user input" event to indicate when this is needed.
|
|
1244
|
+
* But it is also safe to pre-emptively call this if it is more convenient - such as in cases where
|
|
1245
|
+
* the Vindral instance itself is created in a user input event.
|
|
1250
1246
|
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1247
|
+
* Requirements: This method needs to be called within an user-input event handler to function properly, such as
|
|
1248
|
+
* an onclick handler.
|
|
1249
|
+
*
|
|
1250
|
+
* Note: Even if you pre-emptively call this it is still recommended to listen to "needs user input"
|
|
1251
|
+
* and handle that event gracefully.
|
|
1254
1252
|
*/
|
|
1255
|
-
|
|
1253
|
+
userInput: () => void;
|
|
1256
1254
|
/**
|
|
1257
|
-
*
|
|
1255
|
+
* Pauses the stream. Call .play() to resume playback again.
|
|
1258
1256
|
*/
|
|
1259
|
-
|
|
1257
|
+
pause: () => void;
|
|
1258
|
+
private registerDebugInstance;
|
|
1260
1259
|
/**
|
|
1261
|
-
*
|
|
1260
|
+
*
|
|
1261
|
+
* Start playing the stream.
|
|
1262
|
+
*
|
|
1263
|
+
* This method also activates audio or video on web browsers that require a user gesture to enable media playback.
|
|
1264
|
+
* The Vindral instance will emit a "needs user input" event to indicate when this is needed.
|
|
1265
|
+
* But it is also safe to pre-emptively call this if it is more convenient - such as in cases where
|
|
1266
|
+
* the Vindral instance itself is created in a user input event.
|
|
1267
|
+
*
|
|
1268
|
+
* Note: In most browsers this method needs to be called within an user-input event handler, such as
|
|
1269
|
+
* an onclick handler in order to activate audio. Most implementations call this directly after constructing the Vindral
|
|
1270
|
+
* instance once in order to start playing, and then listen to a user-event in order to allow audio to be activated.
|
|
1271
|
+
*
|
|
1272
|
+
* Note 2: Even if you pre-emptively call this it is still recommended to listen to "needs user input"
|
|
1273
|
+
* and handle that event gracefully.
|
|
1262
1274
|
*/
|
|
1263
|
-
|
|
1275
|
+
play: () => void;
|
|
1264
1276
|
/**
|
|
1265
|
-
*
|
|
1277
|
+
* How long in milliseconds since the instance was created
|
|
1266
1278
|
*/
|
|
1267
|
-
get
|
|
1279
|
+
get uptime(): number;
|
|
1268
1280
|
/**
|
|
1269
|
-
*
|
|
1281
|
+
* This method collects a statistics report from internal modules. While many of the report's properties are documented, the report may also contain undocumented
|
|
1282
|
+
* properties used internally or temporarily for monitoring and improving the performance of the service.
|
|
1283
|
+
*
|
|
1284
|
+
* Use undocumented properties at your own risk.
|
|
1270
1285
|
*/
|
|
1271
|
-
|
|
1286
|
+
getStatistics: () => Statistics;
|
|
1287
|
+
private resetModules;
|
|
1288
|
+
private suspend;
|
|
1289
|
+
private unsuspend;
|
|
1290
|
+
private getRuntimeInfo;
|
|
1291
|
+
private onMediaElementState;
|
|
1292
|
+
private onBufferEvent;
|
|
1272
1293
|
/**
|
|
1273
|
-
*
|
|
1294
|
+
* Aligns size and bitrate to match a rendition level correctly
|
|
1274
1295
|
*/
|
|
1275
|
-
|
|
1296
|
+
private alignSizeAndBitRate;
|
|
1297
|
+
private get currentSubscription();
|
|
1298
|
+
private get targetSubscription();
|
|
1299
|
+
private timeToFirstFrame;
|
|
1300
|
+
private willUseMediaSource;
|
|
1301
|
+
}
|
|
1302
|
+
interface TelemetryModuleStatistics {
|
|
1276
1303
|
/**
|
|
1277
|
-
* The
|
|
1304
|
+
* The total amount of errors being spawned. Note that some media errors can trigger
|
|
1305
|
+
* thousands of errors for a single client in a few seconds before recovering. Therefore,
|
|
1306
|
+
* consider the number of viewers with errors, not just the total amount. Also, consider the median
|
|
1307
|
+
* instead of the mean for average calculation.
|
|
1278
1308
|
*/
|
|
1279
|
-
|
|
1309
|
+
errorCount: number;
|
|
1310
|
+
}
|
|
1311
|
+
type State = "connected" | "disconnected" | "connecting";
|
|
1312
|
+
type ContextSwitchState = "completed" | "started";
|
|
1313
|
+
interface ConnectionStatistics {
|
|
1280
1314
|
/**
|
|
1281
|
-
*
|
|
1315
|
+
* RTT (round trip time) between client and server(s).
|
|
1282
1316
|
*/
|
|
1283
|
-
|
|
1317
|
+
rtt: MinMaxAverage;
|
|
1284
1318
|
/**
|
|
1285
|
-
*
|
|
1319
|
+
* A very rough initial estimation of minimum available bandwidth.
|
|
1286
1320
|
*/
|
|
1287
|
-
|
|
1321
|
+
estimatedBandwidth: number;
|
|
1322
|
+
edgeUrl?: string;
|
|
1288
1323
|
/**
|
|
1289
|
-
*
|
|
1324
|
+
* Total number of connections that have been established since instantiation.
|
|
1290
1325
|
*/
|
|
1291
|
-
|
|
1326
|
+
connectCount: number;
|
|
1292
1327
|
/**
|
|
1293
|
-
*
|
|
1328
|
+
* Total number of connection attempts since instantiation.
|
|
1294
1329
|
*/
|
|
1295
|
-
|
|
1330
|
+
connectionAttemptCount: number;
|
|
1331
|
+
connectionProtocol: "vindral_ws" | "moq" | undefined;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Contextual information about the language switch
|
|
1335
|
+
*/
|
|
1336
|
+
export interface LanguageSwitchContext {
|
|
1296
1337
|
/**
|
|
1297
|
-
*
|
|
1338
|
+
* The new language that was switched to
|
|
1298
1339
|
*/
|
|
1299
|
-
|
|
1340
|
+
language: string;
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Contextual information about the channel switch
|
|
1344
|
+
*/
|
|
1345
|
+
export interface ChannelSwitchContext {
|
|
1300
1346
|
/**
|
|
1301
|
-
*
|
|
1347
|
+
* The new channel id that was switched to
|
|
1302
1348
|
*/
|
|
1303
|
-
|
|
1349
|
+
channelId: string;
|
|
1350
|
+
}
|
|
1351
|
+
interface VolumeState {
|
|
1304
1352
|
/**
|
|
1305
|
-
*
|
|
1353
|
+
* Wether the audio is muted
|
|
1354
|
+
*/
|
|
1355
|
+
isMuted: boolean;
|
|
1356
|
+
/**
|
|
1357
|
+
* The volume level
|
|
1358
|
+
*/
|
|
1359
|
+
volume: number;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* The events that can be emitted from the Vindral instance
|
|
1363
|
+
*/
|
|
1364
|
+
export interface PublicVindralEvents {
|
|
1365
|
+
/**
|
|
1366
|
+
* When an error that requires action has occured
|
|
1306
1367
|
*
|
|
1307
|
-
*
|
|
1368
|
+
* Can be a fatal error that will unload the Vindral instance - this is indicated by `isFatal()` on the error object returning true.
|
|
1308
1369
|
*
|
|
1309
|
-
*
|
|
1310
|
-
* the
|
|
1370
|
+
* 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
|
|
1371
|
+
* 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.
|
|
1311
1372
|
*/
|
|
1312
|
-
|
|
1373
|
+
["error"]: Readonly<VindralError>;
|
|
1313
1374
|
/**
|
|
1314
|
-
*
|
|
1375
|
+
* When the instance needs user input to activate audio or sometimes video playback.
|
|
1376
|
+
* Is called with an object
|
|
1377
|
+
* ```javascript
|
|
1378
|
+
* {
|
|
1379
|
+
* forAudio: boolean // true if user input is needed for audio playback
|
|
1380
|
+
* forVideo: boolean // true if user input is needed for video playback
|
|
1381
|
+
* }
|
|
1382
|
+
* ```
|
|
1315
1383
|
*/
|
|
1316
|
-
|
|
1384
|
+
["needs user input"]: NeedsUserInputContext;
|
|
1317
1385
|
/**
|
|
1318
|
-
*
|
|
1386
|
+
* When a timed metadata event has been triggered
|
|
1319
1387
|
*/
|
|
1320
|
-
|
|
1388
|
+
["metadata"]: Readonly<Metadata>;
|
|
1321
1389
|
/**
|
|
1322
|
-
*
|
|
1390
|
+
* When the playback state changes
|
|
1323
1391
|
*/
|
|
1324
|
-
|
|
1392
|
+
["playback state"]: Readonly<PlaybackState>;
|
|
1325
1393
|
/**
|
|
1326
|
-
*
|
|
1327
|
-
|
|
1328
|
-
|
|
1394
|
+
* When the connection state changes
|
|
1395
|
+
*/
|
|
1396
|
+
["connection state"]: Readonly<State>;
|
|
1397
|
+
/**
|
|
1398
|
+
* When the available rendition levels is changed
|
|
1399
|
+
*/
|
|
1400
|
+
["rendition levels"]: ReadonlyArray<RenditionLevel>;
|
|
1401
|
+
/**
|
|
1402
|
+
* When the rendition level is changed
|
|
1403
|
+
*/
|
|
1404
|
+
["rendition level"]: Readonly<RenditionLevel>;
|
|
1405
|
+
/**
|
|
1406
|
+
* When the available languages is changed
|
|
1407
|
+
*/
|
|
1408
|
+
["languages"]: ReadonlyArray<string>;
|
|
1409
|
+
/**
|
|
1410
|
+
* When the available text tracks are changed
|
|
1411
|
+
*/
|
|
1412
|
+
["text tracks"]: ReadonlyArray<string>;
|
|
1413
|
+
/**
|
|
1414
|
+
* When the available channels is changed
|
|
1415
|
+
*/
|
|
1416
|
+
["channels"]: ReadonlyArray<Channel>;
|
|
1417
|
+
/**
|
|
1418
|
+
* When a context switch state change has occured.
|
|
1419
|
+
* E.g. when a channel change has been requested, or quality is changed.
|
|
1420
|
+
*/
|
|
1421
|
+
["context switch"]: Readonly<ContextSwitchState>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Emitted when a wallclock time message has been received from the server.
|
|
1329
1424
|
*
|
|
1330
|
-
* Note: This is
|
|
1425
|
+
* Note: This is the edge server wallclock time and thus may differ slightly
|
|
1426
|
+
* between two viewers if they are connected to different edge servers.
|
|
1331
1427
|
*/
|
|
1332
|
-
|
|
1428
|
+
["server wallclock time"]: Readonly<number>;
|
|
1333
1429
|
/**
|
|
1334
|
-
*
|
|
1430
|
+
* Is emitted during connection whether the channel is live or not.
|
|
1431
|
+
*
|
|
1432
|
+
* If the channel is not live, the Vindral instance will try to reconnect until the `reconnectHandler`
|
|
1433
|
+
* determines that no more retries should be made.
|
|
1434
|
+
*
|
|
1435
|
+
* Note: If the web-sdk is instantiated at the same time as you are starting the stream it is possible
|
|
1436
|
+
* that this emits false until the started state has propagated through the system.
|
|
1335
1437
|
*/
|
|
1336
|
-
|
|
1438
|
+
["is live"]: boolean;
|
|
1337
1439
|
/**
|
|
1338
|
-
*
|
|
1440
|
+
* Emitted when a channel switch has been completed and the first frame of the new channel is rendered.
|
|
1441
|
+
* A string containing the channel id of the new channel is provided as an argument.
|
|
1339
1442
|
*/
|
|
1340
|
-
|
|
1443
|
+
["channel switch"]: Readonly<ChannelSwitchContext>;
|
|
1341
1444
|
/**
|
|
1342
|
-
*
|
|
1445
|
+
* Emitted when a language switch has been completed and the new language starts playing.
|
|
1343
1446
|
*/
|
|
1344
|
-
|
|
1447
|
+
["language switch"]: Readonly<LanguageSwitchContext>;
|
|
1345
1448
|
/**
|
|
1346
|
-
*
|
|
1449
|
+
* Emitted when the volume state changes.
|
|
1450
|
+
*
|
|
1451
|
+
* This is triggered triggered both when the user changes the volume through the Vindral instance, but also
|
|
1452
|
+
* from external sources such as OS media shortcuts or other native UI outside of the browser.
|
|
1347
1453
|
*/
|
|
1348
|
-
|
|
1454
|
+
["volume state"]: Readonly<VolumeState>;
|
|
1455
|
+
["buffer state event"]: Readonly<BufferStateEvent>;
|
|
1456
|
+
["initialized media"]: void;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Available events to listen to
|
|
1460
|
+
*/
|
|
1461
|
+
export interface CastSenderEvents {
|
|
1349
1462
|
/**
|
|
1350
|
-
*
|
|
1463
|
+
* When a connection has been established with a CastReceiver
|
|
1351
1464
|
*/
|
|
1352
|
-
|
|
1465
|
+
["connected"]: void;
|
|
1353
1466
|
/**
|
|
1354
|
-
*
|
|
1467
|
+
* When a previous session has been resumed
|
|
1355
1468
|
*/
|
|
1356
|
-
|
|
1469
|
+
["resumed"]: void;
|
|
1357
1470
|
/**
|
|
1358
|
-
*
|
|
1471
|
+
* When a CastReceiver has lost or stopped a connection
|
|
1359
1472
|
*/
|
|
1360
|
-
|
|
1473
|
+
["disconnected"]: void;
|
|
1361
1474
|
/**
|
|
1362
|
-
*
|
|
1475
|
+
* When a connection attempt was initiated unsuccessfully
|
|
1363
1476
|
*/
|
|
1364
|
-
|
|
1477
|
+
["failed"]: void;
|
|
1365
1478
|
/**
|
|
1366
|
-
*
|
|
1479
|
+
* When the remote connection emits a metadata event
|
|
1367
1480
|
*/
|
|
1368
|
-
|
|
1481
|
+
["metadata"]: Metadata;
|
|
1369
1482
|
/**
|
|
1370
|
-
*
|
|
1483
|
+
* When the remote connection receives a server wallclock time event
|
|
1371
1484
|
*/
|
|
1372
|
-
|
|
1485
|
+
["server wallclock time"]: number;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Used for initializing the CastSender
|
|
1489
|
+
*/
|
|
1490
|
+
export interface CastConfig {
|
|
1373
1491
|
/**
|
|
1374
|
-
*
|
|
1492
|
+
* The [Vindral Options](./Options) to use for the Cast Receiver
|
|
1375
1493
|
*/
|
|
1376
|
-
|
|
1494
|
+
options: Options;
|
|
1377
1495
|
/**
|
|
1378
|
-
*
|
|
1496
|
+
* URL to a background image.
|
|
1497
|
+
* Example: "https://via.placeholder.com/256x144"
|
|
1379
1498
|
*/
|
|
1380
|
-
|
|
1499
|
+
background?: string;
|
|
1381
1500
|
/**
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1384
|
-
* Possible channels to set are available from [[channels]]
|
|
1385
|
-
*
|
|
1386
|
-
* Note that the following scenarios are not possible right now:
|
|
1387
|
-
* - switching channel from a channel with audio to a channel without audio (unless audio only mode is active)
|
|
1388
|
-
* - switching channel from a channel with video to a channel without video (unless video only mode is active)
|
|
1501
|
+
* Override this if you have your own custom receiver
|
|
1389
1502
|
*/
|
|
1390
|
-
|
|
1503
|
+
receiverApplicationId?: string;
|
|
1504
|
+
}
|
|
1505
|
+
/**
|
|
1506
|
+
* CastSender handles initiation of and communication with the Google Cast Receiver
|
|
1507
|
+
*/
|
|
1508
|
+
export declare class CastSender extends Emitter<CastSenderEvents> {
|
|
1509
|
+
private state;
|
|
1510
|
+
private config;
|
|
1511
|
+
private unloaded;
|
|
1512
|
+
constructor(config: CastConfig);
|
|
1391
1513
|
/**
|
|
1392
|
-
*
|
|
1514
|
+
* True if the instance is casting right now
|
|
1393
1515
|
*/
|
|
1394
|
-
get
|
|
1516
|
+
get casting(): boolean;
|
|
1395
1517
|
/**
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
* Note: If ABR is disabled, setting this will make the client instantly subscribe to this size
|
|
1518
|
+
* The current volume
|
|
1399
1519
|
*/
|
|
1400
|
-
|
|
1520
|
+
get volume(): number;
|
|
1401
1521
|
/**
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
* Note: Returns Number.MAX_SAFE_INTEGER if no limits have been set
|
|
1522
|
+
* Set the current volume. Setting this to zero is equivalent to muting the video
|
|
1405
1523
|
*/
|
|
1406
|
-
|
|
1524
|
+
set volume(volume: number);
|
|
1407
1525
|
/**
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1410
|
-
* Note: If ABR is disabled, setting this will make the client instantly subscribe to this bitrate
|
|
1526
|
+
* The current language
|
|
1411
1527
|
*/
|
|
1412
|
-
|
|
1528
|
+
get language(): string | undefined;
|
|
1413
1529
|
/**
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
1416
|
-
* Note: Returns Number.MAX_SAFE_INTEGER if no limits have been set
|
|
1530
|
+
* Set the current language
|
|
1417
1531
|
*/
|
|
1418
|
-
|
|
1532
|
+
set language(language: string | undefined);
|
|
1419
1533
|
/**
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1422
|
-
* Note: If ABR is disabled, setting this will make the client instantly subscribe to this bit rate
|
|
1534
|
+
* The current channelId
|
|
1423
1535
|
*/
|
|
1424
|
-
|
|
1536
|
+
get channelId(): string;
|
|
1425
1537
|
/**
|
|
1426
|
-
*
|
|
1538
|
+
* Set the current channelId
|
|
1427
1539
|
*/
|
|
1428
|
-
|
|
1540
|
+
set channelId(channelId: string);
|
|
1429
1541
|
/**
|
|
1430
|
-
*
|
|
1542
|
+
* Update authentication token on an already established and authenticated connection
|
|
1431
1543
|
*/
|
|
1432
|
-
|
|
1544
|
+
updateAuthenticationToken: (token: string) => void;
|
|
1433
1545
|
/**
|
|
1434
|
-
*
|
|
1546
|
+
* Fully unloads the instance. This disconnects the current listener but lets the
|
|
1547
|
+
* cast session continue on the receiving device
|
|
1435
1548
|
*/
|
|
1436
|
-
|
|
1549
|
+
unload: () => void;
|
|
1437
1550
|
/**
|
|
1438
|
-
*
|
|
1551
|
+
* Initiates the CastSender.
|
|
1552
|
+
* Will reject if Cast is not available on the device or the network.
|
|
1439
1553
|
*/
|
|
1440
|
-
|
|
1554
|
+
init: () => Promise<void>;
|
|
1441
1555
|
/**
|
|
1442
|
-
*
|
|
1443
|
-
* The ranges are specified in milliseconds.
|
|
1556
|
+
* Requests a session. It will open the native cast receiver chooser dialog
|
|
1444
1557
|
*/
|
|
1445
|
-
|
|
1558
|
+
start: () => Promise<void>;
|
|
1446
1559
|
/**
|
|
1447
|
-
*
|
|
1448
|
-
* The ranges are specified in milliseconds.
|
|
1560
|
+
* Stops a session. It will stop playback on device as well.
|
|
1449
1561
|
*/
|
|
1450
|
-
|
|
1562
|
+
stop: () => void;
|
|
1451
1563
|
/**
|
|
1452
|
-
*
|
|
1564
|
+
* Returns a string representing the name of the Cast receiver device or undefined if no receiver exists
|
|
1453
1565
|
*/
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1566
|
+
getReceiverName: () => string | undefined;
|
|
1567
|
+
private onGCastApiAvailable;
|
|
1568
|
+
private send;
|
|
1569
|
+
private onMessage;
|
|
1570
|
+
private onSessionStarted;
|
|
1571
|
+
private onSessionStateChanged;
|
|
1572
|
+
private getInstance;
|
|
1573
|
+
private getSession;
|
|
1574
|
+
private castLibrariesAdded;
|
|
1575
|
+
private verifyCastLibraries;
|
|
1576
|
+
}
|
|
1577
|
+
interface AirPlaySenderEvents {
|
|
1461
1578
|
/**
|
|
1462
|
-
*
|
|
1579
|
+
* When airplay targets are available.
|
|
1463
1580
|
*/
|
|
1464
|
-
|
|
1581
|
+
["available"]: void;
|
|
1465
1582
|
/**
|
|
1466
|
-
*
|
|
1583
|
+
* When a connection has been established with an airplay target.
|
|
1467
1584
|
*/
|
|
1468
|
-
|
|
1585
|
+
["connected"]: void;
|
|
1469
1586
|
/**
|
|
1470
|
-
*
|
|
1587
|
+
* When the airplay target has lost or stopped a connection.
|
|
1471
1588
|
*/
|
|
1472
|
-
|
|
1589
|
+
["disconnected"]: void;
|
|
1590
|
+
}
|
|
1591
|
+
interface AirPlayConfig {
|
|
1473
1592
|
/**
|
|
1474
|
-
*
|
|
1475
|
-
* Connects to the configured channel and starts streaming
|
|
1593
|
+
* URL to use when connecting to the stream.
|
|
1476
1594
|
*/
|
|
1477
|
-
|
|
1478
|
-
private _connect;
|
|
1595
|
+
url: string;
|
|
1479
1596
|
/**
|
|
1480
|
-
*
|
|
1597
|
+
* Channel ID to connect to.
|
|
1481
1598
|
*/
|
|
1482
|
-
|
|
1483
|
-
private connectionInfo;
|
|
1484
|
-
private estimateRTT;
|
|
1485
|
-
private connectHandler;
|
|
1486
|
-
private emitLanguagesIfChanged;
|
|
1487
|
-
private updateTextTracks;
|
|
1488
|
-
private cleanupTextTracks;
|
|
1489
|
-
private filterRenditions;
|
|
1599
|
+
channelId: string;
|
|
1490
1600
|
/**
|
|
1491
|
-
*
|
|
1492
|
-
* @param channel Channel with the renditions to patch the subscription based on
|
|
1601
|
+
* A container to attach the video element in. This should be the same container that the vindral video element is attached to.
|
|
1493
1602
|
*/
|
|
1494
|
-
|
|
1495
|
-
private isSupportedVideoCodecProfile;
|
|
1496
|
-
private supportedAudioCodecs;
|
|
1497
|
-
private initializeDecodingModule;
|
|
1603
|
+
container: HTMLElement;
|
|
1498
1604
|
/**
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1605
|
+
* An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
|
|
1606
|
+
* Note: If not supplied when needed, an "Authentication Failed" error will be raised.
|
|
1501
1607
|
*/
|
|
1502
|
-
|
|
1608
|
+
authenticationToken?: string;
|
|
1609
|
+
}
|
|
1610
|
+
declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
|
|
1611
|
+
private config;
|
|
1612
|
+
private hlsUrl;
|
|
1613
|
+
private element;
|
|
1614
|
+
private connectingTimeout?;
|
|
1615
|
+
constructor(config: AirPlayConfig);
|
|
1503
1616
|
/**
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
* Activates audio or video on web browsers that require a user gesture to enable media playback.
|
|
1507
|
-
* The Vindral instance will emit a "needs user input" event to indicate when this is needed.
|
|
1508
|
-
* But it is also safe to pre-emptively call this if it is more convenient - such as in cases where
|
|
1509
|
-
* the Vindral instance itself is created in a user input event.
|
|
1510
|
-
*
|
|
1511
|
-
* Requirements: This method needs to be called within an user-input event handler to function properly, such as
|
|
1512
|
-
* an onclick handler.
|
|
1513
|
-
*
|
|
1514
|
-
* Note: Even if you pre-emptively call this it is still recommended to listen to "needs user input"
|
|
1515
|
-
* and handle that event gracefully.
|
|
1617
|
+
* True if the instance is casting right now.
|
|
1516
1618
|
*/
|
|
1517
|
-
|
|
1619
|
+
get casting(): boolean;
|
|
1518
1620
|
/**
|
|
1519
|
-
*
|
|
1621
|
+
* Set the current channelId.
|
|
1520
1622
|
*/
|
|
1521
|
-
|
|
1522
|
-
private registerDebugInstance;
|
|
1623
|
+
set channelId(channelId: string);
|
|
1523
1624
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
* Start playing the stream.
|
|
1526
|
-
*
|
|
1527
|
-
* This method also activates audio or video on web browsers that require a user gesture to enable media playback.
|
|
1528
|
-
* The Vindral instance will emit a "needs user input" event to indicate when this is needed.
|
|
1529
|
-
* But it is also safe to pre-emptively call this if it is more convenient - such as in cases where
|
|
1530
|
-
* the Vindral instance itself is created in a user input event.
|
|
1531
|
-
*
|
|
1532
|
-
* Note: In most browsers this method needs to be called within an user-input event handler, such as
|
|
1533
|
-
* an onclick handler in order to activate audio. Most implementations call this directly after constructing the Vindral
|
|
1534
|
-
* instance once in order to start playing, and then listen to a user-event in order to allow audio to be activated.
|
|
1535
|
-
*
|
|
1536
|
-
* Note 2: Even if you pre-emptively call this it is still recommended to listen to "needs user input"
|
|
1537
|
-
* and handle that event gracefully.
|
|
1625
|
+
* Update authentication token on an already established and authenticated connection.
|
|
1538
1626
|
*/
|
|
1539
|
-
|
|
1627
|
+
updateAuthenticationToken: (_token: string) => void;
|
|
1540
1628
|
/**
|
|
1541
|
-
*
|
|
1629
|
+
* Fully unloads the instance. This disconnects the current listeners.
|
|
1542
1630
|
*/
|
|
1543
|
-
|
|
1631
|
+
unload: () => void;
|
|
1544
1632
|
/**
|
|
1545
|
-
*
|
|
1546
|
-
* properties used internally or temporarily for monitoring and improving the performance of the service.
|
|
1547
|
-
*
|
|
1548
|
-
* Use undocumented properties at your own risk.
|
|
1633
|
+
* Show the AirPlay picker.
|
|
1549
1634
|
*/
|
|
1550
|
-
|
|
1551
|
-
private resetModules;
|
|
1552
|
-
private suspend;
|
|
1553
|
-
private unsuspend;
|
|
1554
|
-
private getRuntimeInfo;
|
|
1555
|
-
private onMediaElementState;
|
|
1556
|
-
private onBufferEvent;
|
|
1635
|
+
showPlaybackTargetPicker(): void;
|
|
1557
1636
|
/**
|
|
1558
|
-
*
|
|
1637
|
+
* Returns if AirPlay is supported.
|
|
1559
1638
|
*/
|
|
1560
|
-
|
|
1561
|
-
private
|
|
1562
|
-
private
|
|
1563
|
-
private
|
|
1564
|
-
private willUseMediaSource;
|
|
1639
|
+
static isAirPlaySupported(): boolean;
|
|
1640
|
+
private onAirPlayAvailable;
|
|
1641
|
+
private onAirPlayPlaybackChanged;
|
|
1642
|
+
private checkHlsUrl;
|
|
1565
1643
|
}
|
|
1566
1644
|
/**
|
|
1567
1645
|
* Available options when initializing the Player. Used for enabling/disabling features
|