You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[api.video](https://api.video) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
6
10
7
11
8
-
# Table of contents
12
+
#####Table of contents
9
13
10
14
-[Table of contents](#table-of-contents)
11
15
-[Project description](#project-description)
@@ -59,16 +63,56 @@
59
63
60
64
61
65
62
-
# Project description
66
+
<!--</documentation_excluded>-->
67
+
<!--<documentation_only>
68
+
---
69
+
title: api.video Player SDK
70
+
meta:
71
+
description: The official api.video Player SDK for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
72
+
---
73
+
74
+
#### api.video Player SDK
75
+
</documentation_only>-->
76
+
###<!--</documentation_excluded>-->
77
+
<!--<documentation_only>
78
+
---
79
+
title: api.video Player SDK
80
+
meta:
81
+
description: The official api.video Player SDK for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
82
+
---
83
+
84
+
### api.video Player SDK
85
+
</documentation_only>-->
86
+
##<!--</documentation_excluded>-->
87
+
<!--<documentation_only>
88
+
---
89
+
title: api.video Player SDK
90
+
meta:
91
+
description: The official api.video Player SDK for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
92
+
---
93
+
94
+
## api.video Player SDK
95
+
</documentation_only>-->
96
+
#<!--</documentation_excluded>-->
97
+
<!--<documentation_only>
98
+
---
99
+
title: api.video Player SDK
100
+
meta:
101
+
description: The official api.video Player SDK for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
102
+
---
103
+
104
+
# api.video Player SDK
105
+
</documentation_only>-->
106
+
## Project description
63
107
64
108
SDK to control and interact with the api.video HTML5 Player
65
109
66
110
67
-
# Getting started
111
+
#####Getting started
68
112
69
-
## Installation
113
+
######Installation
70
114
71
-
### Method #1: requirejs
115
+
####### Method #1: requirejs
72
116
73
117
If you use requirejs you can add the SDK as a dependency to your project with
74
118
@@ -87,7 +131,7 @@ var sdk = new PlayerSdk("#target", {
87
131
});
88
132
```
89
133
90
-
### Method #2: typescript
134
+
####### Method #2: typescript
91
135
92
136
If you use Typescript you can add the SDK as a dependency to your project with
93
137
@@ -107,7 +151,7 @@ const sdk = new PlayerSdk("#target", {
107
151
```
108
152
109
153
110
-
### Method #2: simple include in a javascript project
154
+
####### Method #2: simple include in a javascript project
111
155
112
156
Include the SDK in your HTML file like so:
113
157
@@ -128,9 +172,9 @@ Then, once the `window.onload` event has been triggered, create your player usin
128
172
</script>
129
173
```
130
174
131
-
# Documentation
175
+
#####Documentation
132
176
133
-
## Instanciation
177
+
######Instanciation
134
178
135
179
The PlayerSdk constructor takes 2 parameters:
136
180
-`targetSelector: string | Element` a CSS selector targeting the DOM element in which you want to create the player (eg. "#target"), or the DOM element itself
@@ -159,16 +203,16 @@ The PlayerSdk constructor takes 2 parameters:
159
203
160
204
The sdk instance can be used to control the video playback, and to listen to player events.
161
205
162
-
### Ads
206
+
####### Ads
163
207
Ads can be displayed in the player. To do so, you need to pass the `ads` option to the sdk constructor. In the `ads` object, pass the `adTagUrl` property with the url of the ad tag. The ad tag must be a VAST 2.0 or 3.0 url. For more information about VAST, check the [IAB documentation](https://www.iab.com/guidelines/vast/).
164
208
165
209
Note: ads are displayed using the [Google IMA SDK](https://developers.google.com/interactive-media-ads/docs/sdks/html5/quickstart).
166
210
167
-
## Methods
211
+
######Methods
168
212
169
213
The sdk instance has the following methods:
170
214
171
-
#### `loadConfig(options: SdkOptions)`
215
+
########`loadConfig(options: SdkOptions)`
172
216
> Load a new video in the same instance of the player. Available options are the same as the ones passed to the SDK constructor (see available).
173
217
>
174
218
> Example:
@@ -179,15 +223,15 @@ The sdk instance has the following methods:
179
223
> hideControls:true,
180
224
> });
181
225
>```
182
-
#### `play()`
226
+
########`play()`
183
227
> Start playing the video.
184
-
#### `pause()`
228
+
########`pause()`
185
229
> Pause the video playback.
186
-
#### `mute()`
230
+
########`mute()`
187
231
> Mute the video.
188
-
#### `unmute()`
232
+
########`unmute()`
189
233
> Unmute the video.
190
-
#### `hideControls(controls?: ControlName[])`
234
+
########`hideControls(controls?: ControlName[])`
191
235
> Hide the player controls.
192
236
>
193
237
> `controls` parameter type definition:
@@ -214,7 +258,7 @@ The sdk instance has the following methods:
214
258
>player.hideControls(["download", "subtitles"]); // ... except "download" and "subtitles"
215
259
>```
216
260
>
217
-
#### `showControls(controls?: ControlName[])`
261
+
########`showControls(controls?: ControlName[])`
218
262
> Show the player controls.
219
263
>
220
264
> `controls` parameter type definition:
@@ -241,59 +285,59 @@ The sdk instance has the following methods:
241
285
>player.showControls(["progressBar"]); // ... and the progress bar
242
286
>```
243
287
>
244
-
#### `setChromeless(chromeless: boolean)`
288
+
########`setChromeless(chromeless: boolean)`
245
289
> Define if the player should be in chromeless mode (all controls hidden).
246
-
#### `hideSubtitles()`
290
+
########`hideSubtitles()`
247
291
> Hide the player subtitles.
248
-
#### `showSubtitles()`
292
+
########`showSubtitles()`
249
293
> Show the player subtitles.
250
-
#### `hideTitles()`
294
+
########`hideTitles()`
251
295
> Hide the video title at the top of the video.
252
-
#### `showTitles()`
296
+
########`showTitles()`
253
297
> Show the video title at the top of the video.
254
-
#### `setLoop(loop: boolean)`
298
+
########`setLoop(loop: boolean)`
255
299
> Define if the video should be played in loop.
256
-
#### `setAutoplay(autoplay: boolean)`
300
+
########`setAutoplay(autoplay: boolean)`
257
301
> Define if the video should start playing as soon as it is loaded
258
-
#### `seek(time: number)`
302
+
########`seek(time: number)`
259
303
> Add/substract the given number of seconds to/from the playback time.
260
-
#### `setPlaybackRate(rate: number)`
304
+
########`setPlaybackRate(rate: number)`
261
305
> Set the current playback rate.
262
306
>Example:
263
307
>```javascript
264
308
>player.setPlaybackRate(2); // Play at 2x rate
265
309
>```
266
-
#### `setCurrentTime(time: number)`
310
+
########`setCurrentTime(time: number)`
267
311
> Set the current playback time (seconds).
268
312
>
269
313
>Example:
270
314
>```javascript
271
315
>player.setCurrentTime(24); // Go the 24th second
272
316
>```
273
-
#### `setVolume(volume: number)`
317
+
########`setVolume(volume: number)`
274
318
> Change the audio volume to the given value. From 0 to 1 (0 = muted, 1 = 100%).
> Define a callback function that will be called when the given event is triggered by the player.
354
398
>
355
399
> Available events are the following:
@@ -389,7 +433,7 @@ The sdk instance has the following methods:
389
433
> });
390
434
>```
391
435
392
-
## Full example
436
+
###### Full example
393
437
394
438
```html
395
439
<html>
@@ -434,7 +478,7 @@ The sdk instance has the following methods:
434
478
</html>
435
479
```
436
480
437
-
## Control an existing embedded player using the SDK
481
+
######Control an existing embedded player using the SDK
438
482
439
483
It's also possible to integrate the SDK in a page that already contains an embedded player in order to control it and to listen to its events. Let's consider the following page :
0 commit comments