@vindral/web-sdk 3.1.0 → 3.2.1
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/README.md +3 -3
- package/index.d.ts +52 -38
- package/index.mjs +1514 -987
- package/index.umd.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,13 +40,13 @@ Add the following HTML snippet, set `channelId` to channel id credential, and do
|
|
|
40
40
|
|
|
41
41
|
Install @vindral/web-sdk using `npm`:
|
|
42
42
|
|
|
43
|
-
```
|
|
43
|
+
```bash
|
|
44
44
|
npm install --save @vindral/web-sdk
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
or `yarn`:
|
|
48
48
|
|
|
49
|
-
```
|
|
49
|
+
```bash
|
|
50
50
|
yarn add @vindral/web-sdk
|
|
51
51
|
```
|
|
52
52
|
|
|
@@ -79,7 +79,7 @@ player.attach(root)
|
|
|
79
79
|
|
|
80
80
|
Finally, import `@vindral/web-sdk/style.css` (or `./node_modules/@vindral/web-sdk/style.css` if that doesn't work) into your CSS. This step may differ depending on your build tools, some tools will allow you to import CSS directly in your js:
|
|
81
81
|
|
|
82
|
-
```
|
|
82
|
+
```javascript
|
|
83
83
|
import "@vindral/web-sdk/style.css"
|
|
84
84
|
```
|
|
85
85
|
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
type AudioCodec = "aac" | "opus" | "mp3";
|
|
2
|
+
type VideoCodec = "h264" | "av1";
|
|
3
|
+
type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
|
|
4
|
+
type VoidKeys<Record> = MatchingKeys<Record, void>;
|
|
5
|
+
type EventListenerReturnType = (() => void) | void;
|
|
6
6
|
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>> {
|
|
7
7
|
private listeners;
|
|
8
8
|
emit<T extends ArgLessEmits>(eventName: T): void;
|
|
@@ -63,9 +63,9 @@ interface AudioRenditionProps {
|
|
|
63
63
|
channels: number;
|
|
64
64
|
sampleRate: number;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
type VideoRendition = VideoRenditionProps & RenditionProps;
|
|
67
|
+
type AudioRendition = AudioRenditionProps & RenditionProps;
|
|
68
|
+
type Rendition = VideoRendition | AudioRendition;
|
|
69
69
|
interface Size {
|
|
70
70
|
width: number;
|
|
71
71
|
height: number;
|
|
@@ -158,7 +158,7 @@ export interface AuthorizationContext {
|
|
|
158
158
|
/**
|
|
159
159
|
* AuthorizationTokenFactory
|
|
160
160
|
*/
|
|
161
|
-
export
|
|
161
|
+
export type AuthorizationTokenFactory = (context: AuthorizationContext) => string | undefined;
|
|
162
162
|
/**
|
|
163
163
|
* Convenience class to call the public available endpoints of the Vindral Live CDN.
|
|
164
164
|
*/
|
|
@@ -345,8 +345,8 @@ interface NeedsUserInputContext {
|
|
|
345
345
|
*/
|
|
346
346
|
forVideo: boolean;
|
|
347
347
|
}
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
type PlaybackState = "buffering" | "playing" | "paused";
|
|
349
|
+
type BufferStateEvent = "filled" | "drained";
|
|
350
350
|
interface PlaybackModuleStatistics {
|
|
351
351
|
/**
|
|
352
352
|
* Current target buffer time if using dynamic buffer. Otherwise, this is the statically set buffer time from instantiation.
|
|
@@ -382,7 +382,7 @@ export declare const CHANNEL_NOT_FOUND_CODE = "channel_not_found";
|
|
|
382
382
|
export declare const NO_INCOMING_DATA = "no_incoming_data_error";
|
|
383
383
|
export declare const INACTIVITY_CODE = "connection_inactivity";
|
|
384
384
|
export declare const DISCONNECTED_BY_EDGE = "disconnected_by_edge";
|
|
385
|
-
|
|
385
|
+
type ErrorType = "internal" | "external";
|
|
386
386
|
/**
|
|
387
387
|
* Represents a vindral error - all errors emitted from the Vindral instance inherit from this class.
|
|
388
388
|
*/
|
|
@@ -411,8 +411,8 @@ export declare class VindralError extends Error {
|
|
|
411
411
|
*/
|
|
412
412
|
toStringifiable: () => Record<string, unknown>;
|
|
413
413
|
}
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
type State = "connected" | "disconnected" | "connecting";
|
|
415
|
+
type ContextSwitchState = "completed" | "started";
|
|
416
416
|
interface ConnectionStatistics {
|
|
417
417
|
/**
|
|
418
418
|
* RTT (round trip time) between client and server(s).
|
|
@@ -439,7 +439,7 @@ export interface RenditionLevel {
|
|
|
439
439
|
audio?: AudioRendition;
|
|
440
440
|
video?: VideoRendition;
|
|
441
441
|
}
|
|
442
|
-
|
|
442
|
+
type RenditionLevelChangedReason = "abr" | "manual";
|
|
443
443
|
/**
|
|
444
444
|
* Contextual information about the rendition level change.
|
|
445
445
|
*/
|
|
@@ -448,10 +448,6 @@ export interface RenditionLevelChanged {
|
|
|
448
448
|
to?: RenditionLevel;
|
|
449
449
|
reason: RenditionLevelChangedReason;
|
|
450
450
|
}
|
|
451
|
-
interface RenditionLevel {
|
|
452
|
-
audio?: AudioRendition;
|
|
453
|
-
video?: VideoRendition;
|
|
454
|
-
}
|
|
455
451
|
interface RenditionsModuleStatistics {
|
|
456
452
|
/**
|
|
457
453
|
* Id of current video rendition subscribed to.
|
|
@@ -527,6 +523,7 @@ interface DecoderStatistics {
|
|
|
527
523
|
audioDecodeTime: MinMaxAverage;
|
|
528
524
|
videoTransportTime: MinMaxAverage;
|
|
529
525
|
}
|
|
526
|
+
type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
|
|
530
527
|
type EffectiveConnectionType = "2g" | "3g" | "4g" | "slow-2g";
|
|
531
528
|
interface DocumentStateModulesStatistics {
|
|
532
529
|
isVisible: boolean;
|
|
@@ -597,13 +594,38 @@ interface SyncModuleStatistics {
|
|
|
597
594
|
timeshiftDriftAdjustmentCount: number;
|
|
598
595
|
seekTime: number;
|
|
599
596
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
597
|
+
declare class UserAgentInformation {
|
|
598
|
+
private highEntropyValues?;
|
|
599
|
+
constructor();
|
|
600
|
+
getUserAgentInformation(): {
|
|
601
|
+
userAgentLegacy: string;
|
|
602
|
+
ua: {
|
|
603
|
+
browser: {
|
|
604
|
+
brands: string[];
|
|
605
|
+
fullVersionBrands: string[];
|
|
606
|
+
majorVersions: string[];
|
|
607
|
+
};
|
|
608
|
+
device: string;
|
|
609
|
+
os: {
|
|
610
|
+
family: string;
|
|
611
|
+
version: string;
|
|
612
|
+
major_version: number;
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
locationOrigin: string;
|
|
616
|
+
locationPath: string;
|
|
617
|
+
ancestorOrigins: string[] | undefined;
|
|
618
|
+
userAgent?: undefined;
|
|
619
|
+
} | {
|
|
620
|
+
userAgent: string;
|
|
621
|
+
locationOrigin: string;
|
|
622
|
+
locationPath: string;
|
|
623
|
+
ancestorOrigins: string[] | undefined;
|
|
624
|
+
userAgentLegacy?: undefined;
|
|
625
|
+
ua?: undefined;
|
|
626
|
+
};
|
|
605
627
|
}
|
|
606
|
-
|
|
628
|
+
type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
|
|
607
629
|
/**
|
|
608
630
|
* Contains internal statistics.
|
|
609
631
|
*
|
|
@@ -612,7 +634,7 @@ declare type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & Co
|
|
|
612
634
|
*
|
|
613
635
|
* @interface
|
|
614
636
|
*/
|
|
615
|
-
export
|
|
637
|
+
export type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["getUserAgentInformation"]> & {
|
|
616
638
|
/**
|
|
617
639
|
* Version of the @vindral/web-sdk being used.
|
|
618
640
|
*/
|
|
@@ -737,6 +759,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
737
759
|
private cachedEdges;
|
|
738
760
|
private shiftedEdges;
|
|
739
761
|
private pool;
|
|
762
|
+
private userAgentInformation;
|
|
740
763
|
private sampleProcessingSesssions;
|
|
741
764
|
private sizes;
|
|
742
765
|
private isSuspended;
|
|
@@ -759,7 +782,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
759
782
|
*
|
|
760
783
|
* [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)
|
|
761
784
|
* for iOS-Specific Considerations. The following section is the important part:
|
|
762
|
-
*
|
|
785
|
+
* 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.
|
|
763
786
|
*/
|
|
764
787
|
set volume(volume: number);
|
|
765
788
|
/**
|
|
@@ -1081,7 +1104,7 @@ export interface AdvancedOptions {
|
|
|
1081
1104
|
*/
|
|
1082
1105
|
wasmDecodingConstraint: Partial<VideoConstraint>;
|
|
1083
1106
|
}
|
|
1084
|
-
|
|
1107
|
+
type Media = "audio" | "video" | "audio+video";
|
|
1085
1108
|
/**
|
|
1086
1109
|
* Options for the Vindral instance
|
|
1087
1110
|
*
|
|
@@ -1157,14 +1180,6 @@ export interface Options {
|
|
|
1157
1180
|
* Note: We recommend to keep this at the default value unless you have very specific needs.
|
|
1158
1181
|
*/
|
|
1159
1182
|
mseEnabled?: boolean;
|
|
1160
|
-
/**
|
|
1161
|
-
* Enables Managed Media Source on iOS devices.
|
|
1162
|
-
*
|
|
1163
|
-
* It is disabled by default.
|
|
1164
|
-
*
|
|
1165
|
-
* Note: This will be removed and merged with mseEnabled in a future release once iOS releases ManagedMediaSource.
|
|
1166
|
-
*/
|
|
1167
|
-
managedMseEnabled?: boolean;
|
|
1168
1183
|
/**
|
|
1169
1184
|
* Enable Opus with the MediaSource API on supported browsers.
|
|
1170
1185
|
*
|
|
@@ -1326,7 +1341,7 @@ export interface PublicVindralEvents {
|
|
|
1326
1341
|
/**
|
|
1327
1342
|
* When the instance needs user input to activate audio or sometimes video playback.
|
|
1328
1343
|
* Is called with an object
|
|
1329
|
-
* ```
|
|
1344
|
+
* ```javascript
|
|
1330
1345
|
* {
|
|
1331
1346
|
* forAudio: boolean // true if user input is needed for audio playback
|
|
1332
1347
|
* forVideo: boolean // true if user input is needed for video playback
|
|
@@ -1409,7 +1424,6 @@ declare const defaultOptions: {
|
|
|
1409
1424
|
abrEnabled: boolean;
|
|
1410
1425
|
burstEnabled: boolean;
|
|
1411
1426
|
mseEnabled: boolean;
|
|
1412
|
-
managedMseEnabled: boolean;
|
|
1413
1427
|
mseOpusEnabled: boolean;
|
|
1414
1428
|
muted: boolean;
|
|
1415
1429
|
minBufferTime: number;
|