@vindral/web-sdk 3.4.4 → 4.0.0-101-g094c7a1b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/B16tHRr1.js +312 -0
- package/Btk_X03W.js +127 -0
- package/Bx7s5QdT.js +35 -0
- package/C80BN8Qb.js +234 -0
- package/Db7Ieo9V.js +6867 -0
- package/DqHFwQFH.js +4894 -0
- package/README.md +74 -30
- package/api-client.d.ts +229 -0
- package/api-client.js +4 -0
- package/cast-sender.d.ts +424 -0
- package/cast-sender.js +230 -0
- package/core.d.ts +1503 -0
- package/core.js +13 -0
- package/{index.d.ts → legacy.d.ts} +993 -856
- package/legacy.es.js +13477 -0
- package/legacy.umd.js +60 -0
- package/package.json +25 -9
- package/player.d.ts +1720 -0
- package/player.js +3839 -0
- package/style.css +1 -1
- package/vindral-player-component.js +2 -0
- package/index.js +0 -7716
- package/index.umd.cjs +0 -59
package/README.md
CHANGED
|
@@ -30,13 +30,13 @@ Add the following HTML snippet, set `channelId` to channel id credential, and do
|
|
|
30
30
|
|
|
31
31
|
```html
|
|
32
32
|
<iframe
|
|
33
|
-
src="https://
|
|
33
|
+
src="https://player.vindral.com/?channelId=vindral_demo1_ci_099ee1fa-80f3-455e-aa23-3d184e93e04f"
|
|
34
34
|
frameborder="0"
|
|
35
35
|
allowfullscreen
|
|
36
36
|
></iframe>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
[See the player in action](https://
|
|
39
|
+
[See the player in action](https://player.vindral.com/?channelId=vindral_demo1_ci_099ee1fa-80f3-455e-aa23-3d184e93e04f) or [read more about Embed Player here](https://docs.vindral.com/playout/embeddable-player).
|
|
40
40
|
|
|
41
41
|
## Installation
|
|
42
42
|
|
|
@@ -52,52 +52,47 @@ or `yarn`:
|
|
|
52
52
|
yarn add @vindral/web-sdk
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
### Player
|
|
55
|
+
### Vindral Player
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Vindral Player is our ready-to-go web component-based player for easy integration into your web applications. It is ideal for customizing controls or when the embed solution is not sufficient.
|
|
58
58
|
|
|
59
59
|
**Example**
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
The example assumes that there is an HTML page that loads this script that has at least a div with `id="#root"`.
|
|
61
|
+
To be able to use the `<vindral-player />` in your HTML you have to call `registerComponents`.
|
|
64
62
|
|
|
65
63
|
```javascript
|
|
66
|
-
import {
|
|
67
|
-
|
|
68
|
-
const root = document.querySelector("#root")
|
|
69
|
-
|
|
70
|
-
const player = new Player({
|
|
71
|
-
url: "https://lb.cdn.vindral.com",
|
|
72
|
-
channelId: "vindral_demo1_ci_099ee1fa-80f3-455e-aa23-3d184e93e04f",
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
// Starts playback
|
|
76
|
-
player.core.play()
|
|
64
|
+
import { registerComponents } from "@vindral/web-sdk/player"
|
|
77
65
|
|
|
78
|
-
|
|
79
|
-
player.attach(root)
|
|
66
|
+
registerComponents()
|
|
80
67
|
```
|
|
81
68
|
|
|
82
|
-
|
|
69
|
+
Or use vindral-player-component.js is a self-registering variant of the web components player intended to be used from a script tag.
|
|
83
70
|
|
|
84
|
-
```
|
|
85
|
-
|
|
71
|
+
```html
|
|
72
|
+
<script type="module" async src="https://cdn.jsdelivr.net/npm/@vindral/web-sdk/vindral-player-component.js"></script>
|
|
86
73
|
```
|
|
87
74
|
|
|
88
|
-
|
|
75
|
+
Channel id is the only required attribute when using `<vindral-player />`.
|
|
89
76
|
|
|
90
|
-
```
|
|
91
|
-
|
|
77
|
+
```html
|
|
78
|
+
<vindral-player channelId="vindral_demo1_ci_099ee1fa-80f3-455e-aa23-3d184e93e04f"></vindral-player>
|
|
92
79
|
```
|
|
93
80
|
|
|
94
|
-
|
|
81
|
+
Easy to customize controls with CSS variables.
|
|
95
82
|
|
|
96
|
-
```
|
|
97
|
-
<
|
|
83
|
+
```css
|
|
84
|
+
<style>
|
|
85
|
+
vindral-player {
|
|
86
|
+
aspect-ratio: 16 / 9;
|
|
87
|
+
--vindral-fg-strong: pink;
|
|
88
|
+
--vindral-mute-button-display: none;
|
|
89
|
+
--vindral-pip-button-display: none;
|
|
90
|
+
--vindral-fullscreen-button-display: none;
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
98
93
|
```
|
|
99
94
|
|
|
100
|
-
|
|
95
|
+
[Read the full API reference for all the attributes and CSS variables](https://docs.vindral.com/web-sdk/player)
|
|
101
96
|
|
|
102
97
|
### Core SDK
|
|
103
98
|
|
|
@@ -167,6 +162,55 @@ button.addEventListener("click", () => {
|
|
|
167
162
|
})
|
|
168
163
|
```
|
|
169
164
|
|
|
165
|
+
### Player SDK
|
|
166
|
+
|
|
167
|
+
> **Deprecated**: The Player SDK is deprecated and has been replaced with the [Vindral Player](#vindral-player). It can still be used with `@vindral/web-sdk/legacy`.
|
|
168
|
+
|
|
169
|
+
The Player SDK provides a ready-to-go player with controls - perfect for use cases where the embed solution is not enough, such as when access to the javascript API is needed.
|
|
170
|
+
|
|
171
|
+
**Example**
|
|
172
|
+
|
|
173
|
+
This example attaches a player to an element with the id `#root`. The player will take care of activating audio when needed and provides a minimalistic UI for fullscreen, channel switching, language selection, etc.
|
|
174
|
+
|
|
175
|
+
The example assumes that there is an HTML page that loads this script that has at least a div with `id="#root"`.
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
import { Player } from "@vindral/web-sdk/legacy"
|
|
179
|
+
|
|
180
|
+
const root = document.querySelector("#root")
|
|
181
|
+
|
|
182
|
+
const player = new Player({
|
|
183
|
+
url: "https://lb.cdn.vindral.com",
|
|
184
|
+
channelId: "vindral_demo1_ci_099ee1fa-80f3-455e-aa23-3d184e93e04f",
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
// Starts playback
|
|
188
|
+
player.core.play()
|
|
189
|
+
|
|
190
|
+
// Attaches the player view to the DOM
|
|
191
|
+
player.attach(root)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
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:
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
import "@vindral/web-sdk/style.css"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
or, from a CSS file:
|
|
201
|
+
|
|
202
|
+
```css
|
|
203
|
+
@import "@vindral/web-sdk/style.css";
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
or, in your html file:
|
|
207
|
+
|
|
208
|
+
```html
|
|
209
|
+
<link rel="stylesheet" href="./node_modules/@vindral/web-sdk/style.css" />
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
We recommend that you consult the documentation for your build tool for more information.
|
|
213
|
+
|
|
170
214
|
#### License and support
|
|
171
215
|
|
|
172
216
|
Vindral is a commercial product and requires an active, paid license to access and use. To obtain such a license, or in case you have any questions, do not hesitate to [get in touch](https://vindral.com/inquiries)!
|
package/api-client.d.ts
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel
|
|
3
|
+
*/
|
|
4
|
+
export interface Channel {
|
|
5
|
+
/**
|
|
6
|
+
* Channel ID for the channel
|
|
7
|
+
*/
|
|
8
|
+
channelId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Display name
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Indicates whether there is an incoming source feed for the channel
|
|
15
|
+
*/
|
|
16
|
+
isLive: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* URLs to fetch thumbnail from
|
|
19
|
+
*/
|
|
20
|
+
thumbnailUrls: string[];
|
|
21
|
+
}
|
|
22
|
+
interface ClientOverrides {
|
|
23
|
+
maxVideoBitRate?: number;
|
|
24
|
+
minBufferTime?: number;
|
|
25
|
+
maxBufferTime?: number;
|
|
26
|
+
burstEnabled?: boolean;
|
|
27
|
+
sizeBasedResolutionCapEnabled?: boolean;
|
|
28
|
+
separateVideoSocketEnabled?: boolean;
|
|
29
|
+
videoCodecs?: string[];
|
|
30
|
+
}
|
|
31
|
+
type AudioCodec = "aac" | "opus" | "mp3";
|
|
32
|
+
type VideoCodec = "h264" | "av1";
|
|
33
|
+
declare const tags: unique symbol;
|
|
34
|
+
type Tagged<BaseType, Tag extends PropertyKey> = BaseType & {
|
|
35
|
+
[tags]: {
|
|
36
|
+
[K in Tag]: void;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type Namespace = Tagged<Array<string>, "Namespace">;
|
|
40
|
+
interface TrackObject {
|
|
41
|
+
namespace?: Namespace;
|
|
42
|
+
name: string;
|
|
43
|
+
format: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
renderGroup?: number;
|
|
46
|
+
altGroup?: number;
|
|
47
|
+
initData?: string;
|
|
48
|
+
initTrack?: string;
|
|
49
|
+
depends?: Array<string>;
|
|
50
|
+
temporalId?: number;
|
|
51
|
+
spatialId?: number;
|
|
52
|
+
codec?: string;
|
|
53
|
+
mimeType?: string;
|
|
54
|
+
framerate?: [
|
|
55
|
+
number,
|
|
56
|
+
number
|
|
57
|
+
];
|
|
58
|
+
bitrate?: number;
|
|
59
|
+
width?: number;
|
|
60
|
+
height?: number;
|
|
61
|
+
samplerate?: number;
|
|
62
|
+
channelConfig?: string;
|
|
63
|
+
displayWidth?: number;
|
|
64
|
+
displayHeight?: number;
|
|
65
|
+
language?: string;
|
|
66
|
+
["com.vindral.variant_uid"]?: string;
|
|
67
|
+
}
|
|
68
|
+
interface CatalogRoot {
|
|
69
|
+
version: number;
|
|
70
|
+
streamingFormat?: number;
|
|
71
|
+
streamingFormatVersion?: string;
|
|
72
|
+
}
|
|
73
|
+
interface TracksCatalog extends CatalogRoot {
|
|
74
|
+
namespace: Namespace;
|
|
75
|
+
tracks: Array<TrackObject>;
|
|
76
|
+
}
|
|
77
|
+
interface RenditionProps {
|
|
78
|
+
id: number;
|
|
79
|
+
/** */
|
|
80
|
+
bitRate: number;
|
|
81
|
+
/** */
|
|
82
|
+
codecString?: string;
|
|
83
|
+
/** */
|
|
84
|
+
language?: string;
|
|
85
|
+
/** */
|
|
86
|
+
meta?: Record<string, string>;
|
|
87
|
+
}
|
|
88
|
+
interface VideoRenditionProps {
|
|
89
|
+
/** */
|
|
90
|
+
codec: VideoCodec;
|
|
91
|
+
/** */
|
|
92
|
+
frameRate: [
|
|
93
|
+
number,
|
|
94
|
+
number
|
|
95
|
+
];
|
|
96
|
+
/** */
|
|
97
|
+
width: number;
|
|
98
|
+
/** */
|
|
99
|
+
height: number;
|
|
100
|
+
}
|
|
101
|
+
interface AudioRenditionProps {
|
|
102
|
+
/** */
|
|
103
|
+
codec: AudioCodec;
|
|
104
|
+
/** */
|
|
105
|
+
channels: number;
|
|
106
|
+
/** */
|
|
107
|
+
sampleRate: number;
|
|
108
|
+
}
|
|
109
|
+
interface TextRenditionProps {
|
|
110
|
+
codec: "webvtt";
|
|
111
|
+
kind: "subtitles" | "captions";
|
|
112
|
+
label?: string;
|
|
113
|
+
}
|
|
114
|
+
type VideoRendition = VideoRenditionProps & RenditionProps;
|
|
115
|
+
type AudioRendition = AudioRenditionProps & RenditionProps;
|
|
116
|
+
type TextRendition = TextRenditionProps & RenditionProps;
|
|
117
|
+
type Rendition = VideoRendition | AudioRendition | TextRendition;
|
|
118
|
+
interface Telemetry {
|
|
119
|
+
url: string;
|
|
120
|
+
probability?: number;
|
|
121
|
+
includeErrors?: boolean;
|
|
122
|
+
includeEvents?: boolean;
|
|
123
|
+
includeStats?: boolean;
|
|
124
|
+
maxRetries?: number;
|
|
125
|
+
maxErrorReports?: number;
|
|
126
|
+
interval?: number;
|
|
127
|
+
}
|
|
128
|
+
interface ChannelWithCatalog extends Channel {
|
|
129
|
+
catalog: TracksCatalog;
|
|
130
|
+
renditions: Rendition[];
|
|
131
|
+
overrides?: ClientOverrides;
|
|
132
|
+
}
|
|
133
|
+
interface ChannelWithRenditions extends Channel {
|
|
134
|
+
renditions: Rendition[];
|
|
135
|
+
overrides?: ClientOverrides;
|
|
136
|
+
}
|
|
137
|
+
interface ServerCertificateHash {
|
|
138
|
+
algorithm: string;
|
|
139
|
+
value: string;
|
|
140
|
+
}
|
|
141
|
+
interface Edge {
|
|
142
|
+
moqUrl?: string;
|
|
143
|
+
moqWsUrl: string;
|
|
144
|
+
serverCertificateHashes?: ServerCertificateHash[];
|
|
145
|
+
}
|
|
146
|
+
interface MoQConnectInfo {
|
|
147
|
+
logsUrl?: string;
|
|
148
|
+
statsUrl?: string;
|
|
149
|
+
telemetry?: Telemetry;
|
|
150
|
+
channels: ChannelWithCatalog[];
|
|
151
|
+
edges: Edge[];
|
|
152
|
+
}
|
|
153
|
+
interface VindralConnectInfo {
|
|
154
|
+
logsUrl?: string;
|
|
155
|
+
statsUrl?: string;
|
|
156
|
+
telemetry?: Telemetry;
|
|
157
|
+
channels: ChannelWithRenditions[];
|
|
158
|
+
edges: string[];
|
|
159
|
+
}
|
|
160
|
+
export type ConnectInfo = VindralConnectInfo | MoQConnectInfo;
|
|
161
|
+
/**
|
|
162
|
+
* ApiClientOptions
|
|
163
|
+
*/
|
|
164
|
+
export interface ApiClientOptions {
|
|
165
|
+
/**
|
|
166
|
+
* String representing the URL to the public CDN API.
|
|
167
|
+
*/
|
|
168
|
+
publicEndpoint: string;
|
|
169
|
+
/**
|
|
170
|
+
* Function that should return a string containing a signed authentication token.
|
|
171
|
+
*/
|
|
172
|
+
tokenFactory?: AuthorizationTokenFactory;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Represents what authorization that will be requested.
|
|
176
|
+
*/
|
|
177
|
+
export interface AuthorizationContext {
|
|
178
|
+
/**
|
|
179
|
+
* The channelGroupId that might need authorization.
|
|
180
|
+
*/
|
|
181
|
+
channelGroupId?: string;
|
|
182
|
+
/**
|
|
183
|
+
* The channelId that might need authorization.
|
|
184
|
+
*/
|
|
185
|
+
channelId?: string;
|
|
186
|
+
}
|
|
187
|
+
interface ConnectOptions {
|
|
188
|
+
channelGroupId?: string;
|
|
189
|
+
channelId: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* AuthorizationTokenFactory
|
|
193
|
+
*/
|
|
194
|
+
export type AuthorizationTokenFactory = (context: AuthorizationContext) => string | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Convenience class to call the public available endpoints of the Vindral Live CDN.
|
|
197
|
+
*/
|
|
198
|
+
export declare class ApiClient {
|
|
199
|
+
private baseUrl;
|
|
200
|
+
private tokenFactory?;
|
|
201
|
+
constructor(options: ApiClientOptions);
|
|
202
|
+
/**
|
|
203
|
+
* @ignore
|
|
204
|
+
* Returns everything needed to setup the connection of Vindral instance.
|
|
205
|
+
*/
|
|
206
|
+
connect(options: ConnectOptions): Promise<ConnectInfo>;
|
|
207
|
+
/**
|
|
208
|
+
* Fetches information regarding a single channel.
|
|
209
|
+
*
|
|
210
|
+
* @param channelId the channel to fetch
|
|
211
|
+
* @returns a [[Channel]] containing information about the requested channel.
|
|
212
|
+
*/
|
|
213
|
+
getChannel(channelId: string): Promise<Channel>;
|
|
214
|
+
/**
|
|
215
|
+
* Fetches channels within a channel group
|
|
216
|
+
*
|
|
217
|
+
* Note: The returned list includes inactive channels - check isLive to filter out only active channels
|
|
218
|
+
*
|
|
219
|
+
* @param channelGroupId the channel group to fetch channels from
|
|
220
|
+
* @returns an array of [[Channel]] that belong to the channel group
|
|
221
|
+
*/
|
|
222
|
+
getChannels(channelGroupId: string): Promise<Channel[]>;
|
|
223
|
+
private getHeaders;
|
|
224
|
+
private getAuthToken;
|
|
225
|
+
private toChannels;
|
|
226
|
+
private toChannel;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export {};
|
package/api-client.js
ADDED