From 4936ce51da1f324dcd678e9f45c44a98d5e00575 Mon Sep 17 00:00:00 2001 From: olivierapivideo Date: Fri, 10 Nov 2023 08:29:33 +0000 Subject: [PATCH] Add action --- .../sdks/vod/apivideo-typescript-uploader.md | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/templates/documentation/sdks/vod/apivideo-typescript-uploader.md b/templates/documentation/sdks/vod/apivideo-typescript-uploader.md index 64386a02..51b1d106 100644 --- a/templates/documentation/sdks/vod/apivideo-typescript-uploader.md +++ b/templates/documentation/sdks/vod/apivideo-typescript-uploader.md @@ -7,7 +7,6 @@ meta: # api.video TypeScript video uploader [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. - ## Project description Typescript library to upload videos to api.video using delegated upload token (or usual access token) from the front-end. @@ -102,15 +101,15 @@ Then, once the `window.onload` event has been trigered, create your player using ## Documentation - Standard upload -### Instantiation +### Instanciation #### Options -The upload library is instantiated using an `options` object. Options to provide depend on the way you want to authenticate to the API: either using a delegated upload token (recommanded), or using a usual access token. +The upload library is instanciated using an `options` object. Options to provide depend on the way you want to authenticate to the API: either using a delegated upload token (recommanded), or using a usual access token. ##### Using a delegated upload token (recommended): -Using delegated upload tokens for authentication is best options when uploading from the client side. To know more about delegated upload token, read the dedicated article on api.video's blog: [Delegated Uploads](https://api.video/blog/tutorials/delegated-uploads/). +Using delegated upload tokens for authentication is best options when uploading from the client side. To know more about delegated upload token, read the dedicated article on api.video's blog: [Delegated Uploads](https://api.video/blog/tutorials/delegated-uploads). | Option name | Mandatory | Type | Description | @@ -180,7 +179,7 @@ On fail, the promise embeds the status code & error message returned by the API. **Example** ```javascript - // ... uploader instantiation + // ... uploader instanciation uploader.upload() .then((video) => console.log(video)) @@ -198,10 +197,15 @@ An onProgress event contains the following attributes: - currentChunk (number): index of the chunk being uploaded - currentChunkUploadedBytes (number): number of bytes uploaded for the current chunk +#### `cancel()` + +The cancel() method cancels the upload. It takes no parameter. + + **Example** ```javascript - // ... uploader instantiation + // ... uploader instanciation uploader.onProgress((event) => { console.log(`total number of bytes uploaded for this upload: ${event.uploadedBytes}.`); @@ -224,7 +228,7 @@ The onPlayable() method let you defined a listener that will be called when the
-``` \ No newline at end of file +``` + + +## Static wrapper + +For situations where managing object instances is impractical, consider using the [UploaderStaticWrapper](./doc/UploaderStaticWrapper.md) class, which offers static method equivalents for all functionalities. \ No newline at end of file