@vindral/web-sdk 3.2.0 → 3.2.2
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 +21 -24
- package/index.mjs +1524 -1017
- 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;
|
|
@@ -628,7 +625,7 @@ declare class UserAgentInformation {
|
|
|
628
625
|
ua?: undefined;
|
|
629
626
|
};
|
|
630
627
|
}
|
|
631
|
-
|
|
628
|
+
type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
|
|
632
629
|
/**
|
|
633
630
|
* Contains internal statistics.
|
|
634
631
|
*
|
|
@@ -637,7 +634,7 @@ declare type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & Co
|
|
|
637
634
|
*
|
|
638
635
|
* @interface
|
|
639
636
|
*/
|
|
640
|
-
export
|
|
637
|
+
export type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["getUserAgentInformation"]> & {
|
|
641
638
|
/**
|
|
642
639
|
* Version of the @vindral/web-sdk being used.
|
|
643
640
|
*/
|
|
@@ -785,7 +782,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
785
782
|
*
|
|
786
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)
|
|
787
784
|
* for iOS-Specific Considerations. The following section is the important part:
|
|
788
|
-
*
|
|
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.
|
|
789
786
|
*/
|
|
790
787
|
set volume(volume: number);
|
|
791
788
|
/**
|
|
@@ -1107,7 +1104,7 @@ export interface AdvancedOptions {
|
|
|
1107
1104
|
*/
|
|
1108
1105
|
wasmDecodingConstraint: Partial<VideoConstraint>;
|
|
1109
1106
|
}
|
|
1110
|
-
|
|
1107
|
+
type Media = "audio" | "video" | "audio+video";
|
|
1111
1108
|
/**
|
|
1112
1109
|
* Options for the Vindral instance
|
|
1113
1110
|
*
|
|
@@ -1344,7 +1341,7 @@ export interface PublicVindralEvents {
|
|
|
1344
1341
|
/**
|
|
1345
1342
|
* When the instance needs user input to activate audio or sometimes video playback.
|
|
1346
1343
|
* Is called with an object
|
|
1347
|
-
* ```
|
|
1344
|
+
* ```javascript
|
|
1348
1345
|
* {
|
|
1349
1346
|
* forAudio: boolean // true if user input is needed for audio playback
|
|
1350
1347
|
* forVideo: boolean // true if user input is needed for video playback
|