Skip to content

Commit 8615fb1

Browse files
Merge pull request #31 from apivideo/add-cancel-method
Add cancel method
2 parents 78f4b67 + 3ca0295 commit 8615fb1

File tree

8 files changed

+335
-127
lines changed

8 files changed

+335
-127
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
node: ['14', '16']
8+
node: ['16']
99
steps:
1010
- uses: actions/checkout@v2
1111
- name: Setup node ${{ matrix.node }}

CHANGELOG.md

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

4+
## [1.1.5] - 2023-10-26
5+
- Add cancel() methods
6+
- Add part number in progressive upload onProgress()
7+
48
## [1.1.4] - 2023-08-21
59
- Include `mp4` in VideoUploadResponse type
610

README.md

Lines changed: 13 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+
- [`cancel()`](#cancel)
3031
- [`onPlayable()`](#onplayable)
3132
- [Documentation - Progressive upload](#documentation---progressive-upload)
3233
- [Instanciation](#instanciation-1)
@@ -39,6 +40,7 @@
3940
- [`uploadPart(file: Blob)`](#uploadpartfile-blob)
4041
- [`uploadLastPart(file: Blob)`](#uploadlastpartfile-blob)
4142
- [`onProgress()`](#onprogress-1)
43+
- [`cancel()`](#cancel-1)
4244
- [`onPlayable()`](#onplayable-1)
4345

4446
# Project description
@@ -231,6 +233,11 @@ An onProgress event contains the following attributes:
231233
- currentChunk (number): index of the chunk being uploaded
232234
- currentChunkUploadedBytes (number): number of bytes uploaded for the current chunk
233235

236+
### `cancel()`
237+
238+
The cancel() method cancels the upload. It takes no parameter.
239+
240+
234241
**Example**
235242

236243
```javascript
@@ -358,6 +365,7 @@ The onProgress() method let you defined an upload progress listener. It takes a
358365
An onProgress event contains the following attributes:
359366
- uploadedBytes (number): total number of bytes uploaded for this upload
360367
- totalBytes (number): total size of the file
368+
- part (number): index of the part being uploaded
361369

362370
**Example**
363371

@@ -367,9 +375,14 @@ An onProgress event contains the following attributes:
367375
uploader.onProgress((event) => {
368376
console.log(`total number of bytes uploaded for this upload: ${event.uploadedBytes}.`);
369377
console.log(`total size of the file: ${event.totalBytes}.`);
378+
console.log(`current part: ${event.part}.`);
370379
});
371380
```
372381

382+
### `cancel()`
383+
384+
The cancel() method cancels the upload. It takes no parameter.
385+
373386
### `onPlayable()`
374387

375388
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.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@api.video/video-uploader",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "api.video video uploader",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)