Skip to content

Commit 17d43a3

Browse files
committed
Add onPlayable method
1 parent 187632a commit 17d43a3

File tree

9 files changed

+253
-72
lines changed

9 files changed

+253
-72
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.1.3] - 2023-01-23
5+
- Add onPlayable() method to define a listener called when the video is playable
6+
47
## [1.1.2] - 2023-01-19
58
- Video upload: add maxVideoDuration option.
69

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- [Methods](#methods)
2828
- [`upload()`](#upload)
2929
- [`onProgress()`](#onprogress)
30+
- [`onPlayable()`](#onplayable)
3031
- [Documentation - Progressive upload](#documentation---progressive-upload)
3132
- [Instanciation](#instanciation-1)
3233
- [Options](#options-1)
@@ -38,6 +39,7 @@
3839
- [`uploadPart(file: Blob)`](#uploadpartfile-blob)
3940
- [`uploadLastPart(file: Blob)`](#uploadlastpartfile-blob)
4041
- [`onProgress()`](#onprogress-1)
42+
- [`onPlayable()`](#onplayable-1)
4143

4244
# Project description
4345

@@ -244,6 +246,26 @@ An onProgress event contains the following attributes:
244246
});
245247
```
246248

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+
247269
# Documentation - Progressive upload
248270

249271

@@ -347,3 +369,23 @@ An onProgress event contains the following attributes:
347369
console.log(`total size of the file: ${event.totalBytes}.`);
348370
});
349371
```
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

Comments
 (0)