|
27 | 27 | - [Methods](#methods) |
28 | 28 | - [`upload()`](#upload) |
29 | 29 | - [`onProgress()`](#onprogress) |
| 30 | + - [`onPlayable()`](#onplayable) |
30 | 31 | - [Documentation - Progressive upload](#documentation---progressive-upload) |
31 | 32 | - [Instanciation](#instanciation-1) |
32 | 33 | - [Options](#options-1) |
|
38 | 39 | - [`uploadPart(file: Blob)`](#uploadpartfile-blob) |
39 | 40 | - [`uploadLastPart(file: Blob)`](#uploadlastpartfile-blob) |
40 | 41 | - [`onProgress()`](#onprogress-1) |
| 42 | + - [`onPlayable()`](#onplayable-1) |
41 | 43 |
|
42 | 44 | # Project description |
43 | 45 |
|
@@ -244,6 +246,26 @@ An onProgress event contains the following attributes: |
244 | 246 | }); |
245 | 247 | ``` |
246 | 248 |
|
| 249 | + |
| 250 | +### `onPlayable()` |
| 251 | + |
| 252 | +The onPlayable() method let you defined a listener that will be called when the video is playable. It takes a callback function with one parameter: the `video` object returned by the API. |
| 253 | + |
| 254 | +**Example** |
| 255 | + |
| 256 | +```html |
| 257 | + <div id="player-container"></div> |
| 258 | + |
| 259 | + <script> |
| 260 | + // ... uploader instanciation |
| 261 | + |
| 262 | + uploader.onPlayable((video) => { |
| 263 | + // the video is playable, we can display the player |
| 264 | + document.getElementById('player-container').innerHTML = v.assets.iframe; |
| 265 | + }); |
| 266 | + </script> |
| 267 | +``` |
| 268 | + |
247 | 269 | # Documentation - Progressive upload |
248 | 270 |
|
249 | 271 |
|
@@ -347,3 +369,23 @@ An onProgress event contains the following attributes: |
347 | 369 | console.log(`total size of the file: ${event.totalBytes}.`); |
348 | 370 | }); |
349 | 371 | ``` |
| 372 | + |
| 373 | +### `onPlayable()` |
| 374 | + |
| 375 | +The onPlayable() method let you defined a listener that will be called when the video is playable. It takes a callback function with one parameter: the `video` object returned by the API. |
| 376 | + |
| 377 | +**Example** |
| 378 | + |
| 379 | +```html |
| 380 | + <div id="player-container"></div> |
| 381 | + |
| 382 | + <script> |
| 383 | + // ... uploader instanciation |
| 384 | + |
| 385 | + uploader.onPlayable((video) => { |
| 386 | + // the video is playable, we can display the player |
| 387 | + document.getElementById('player-container').innerHTML = v.assets.iframe; |
| 388 | + }); |
| 389 | + </script> |
| 390 | +``` |
| 391 | + |
0 commit comments