Skip to content

Commit 80f1748

Browse files
committed
README to documentation synchro
1 parent d7569ca commit 80f1748

File tree

2 files changed

+89
-48
lines changed

2 files changed

+89
-48
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Create documentation PR
2+
on:
3+
# Trigger the workflow on pull requests targeting the main branch
4+
pull_request:
5+
types: [assigned, unassigned, opened, reopened, synchronize, edited, labeled, unlabeled, edited, closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
create_documentation_pr:
11+
if: github.event.action != 'closed'
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out current repository code
17+
uses: actions/checkout@v2
18+
19+
- name: Create the documentation pull request
20+
uses: apivideo/api.video-create-readme-file-pull-request-action@main
21+
with:
22+
source-file-path: "README.md"
23+
destination-repository: apivideo/api.video-documentation
24+
destination-path: sdks/vod
25+
destination-filename: apivideo-typescript-uploader.md
26+
pat: "${{ secrets.PAT }}"
27+

README.md

Lines changed: 62 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!--<documentation_excluded>-->
12
[![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video) &nbsp; [![badge](https://img.shields.io/github/stars/apivideo/api.video-typescript-uploader?style=social)](https://github.com/apivideo/api.video-typescript-uploader) &nbsp; [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video)
23
![](https://github.com/apivideo/.github/blob/main/assets/apivideo_banner.png)
34
<h1 align="center">api.video typescript video uploader</h1>
@@ -7,7 +8,7 @@
78

89
[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.
910

10-
# Table of contents
11+
## Table of contents
1112

1213
- [Table of contents](#table-of-contents)
1314
- [Project description](#project-description)
@@ -17,7 +18,7 @@
1718
- [Installation method #2: typescript](#installation-method-2-typescript)
1819
- [Simple include in a javascript project](#simple-include-in-a-javascript-project)
1920
- [Documentation - Standard upload](#documentation---standard-upload)
20-
- [Instanciation](#instanciation)
21+
- [Instantiation](#instantiation)
2122
- [Options](#options)
2223
- [Using a delegated upload token (recommended):](#using-a-delegated-upload-token-recommended)
2324
- [Using an access token (discouraged):](#using-an-access-token-discouraged)
@@ -30,7 +31,7 @@
3031
- [`cancel()`](#cancel)
3132
- [`onPlayable()`](#onplayable)
3233
- [Documentation - Progressive upload](#documentation---progressive-upload)
33-
- [Instanciation](#instanciation-1)
34+
- [Instantiation](#instantiation-1)
3435
- [Options](#options-1)
3536
- [Using a delegated upload token (recommended):](#using-a-delegated-upload-token-recommended-1)
3637
- [Using an access token (discouraged):](#using-an-access-token-discouraged-1)
@@ -44,19 +45,32 @@
4445
- [`onPlayable()`](#onplayable-1)
4546
- [Static wrapper](#static-wrapper)
4647

47-
# Project description
48+
<!--</documentation_excluded>-->
49+
<!--<documentation_only>
50+
---
51+
title: api.video TypeScript video uploader
52+
meta:
53+
description: The official api.video TypeScript video uploader 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.
54+
---
55+
56+
# api.video TypeScript video uploader
57+
58+
[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.
59+
60+
</documentation_only>-->
61+
## Project description
4862

4963
Typescript library to upload videos to api.video using delegated upload token (or usual access token) from the front-end.
5064

5165
It allows you to upload videos in two ways:
5266
- standard upload: to send a whole video file in one go
5367
- progressive upload: to send a video file by chunks, without needing to know the final size of the video file
5468

55-
# Getting started
69+
## Getting started
5670

57-
## Installation
71+
### Installation
5872

59-
### Installation method #1: requirejs
73+
#### Installation method #1: requirejs
6074

6175
If you use requirejs you can add the library as a dependency to your project with
6276

@@ -82,7 +96,7 @@ var uploader = new ProgressiveUploader({
8296
});
8397
```
8498

85-
### Installation method #2: typescript
99+
#### Installation method #2: typescript
86100

87101
If you use Typescript you can add the library as a dependency to your project with
88102

@@ -109,7 +123,7 @@ const uploader = new ProgressiveUploader({
109123
```
110124

111125

112-
### Simple include in a javascript project
126+
#### Simple include in a javascript project
113127

114128
Include the library in your HTML file like so:
115129

@@ -136,17 +150,17 @@ Then, once the `window.onload` event has been trigered, create your player using
136150
</script>
137151
```
138152

139-
# Documentation - Standard upload
153+
## Documentation - Standard upload
140154

141-
## Instanciation
155+
### Instantiation
142156

143-
### Options
157+
#### Options
144158

145-
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.
159+
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.
146160

147-
#### Using a delegated upload token (recommended):
161+
##### Using a delegated upload token (recommended):
148162

149-
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).
163+
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/).
150164

151165

152166
| Option name | Mandatory | Type | Description |
@@ -155,7 +169,7 @@ Using delegated upload tokens for authentication is best options when uploading
155169
| videoId | no | string | id of an existing video |
156170
| _common options (see bellow)_ | | | |
157171

158-
#### Using an access token (discouraged):
172+
##### Using an access token (discouraged):
159173

160174
**Warning**: be aware that exposing your access token client-side can lead to huge security issues. Use this method only if you know what you're doing :).
161175

@@ -168,7 +182,7 @@ Using delegated upload tokens for authentication is best options when uploading
168182
| _common options (see bellow)_ | | | |
169183

170184

171-
#### Using an API key (**strongly** discouraged):
185+
##### Using an API key (**strongly** discouraged):
172186

173187
**Warning**: be aware that exposing your API key client-side can lead to huge security issues. Use this method only if you know what you're doing :).
174188

@@ -180,7 +194,7 @@ Using delegated upload tokens for authentication is best options when uploading
180194
| _common options (see bellow)_ | | | |
181195

182196

183-
#### Common options
197+
##### Common options
184198

185199

186200
| Option name | Mandatory | Type | Description |
@@ -194,7 +208,7 @@ Using delegated upload tokens for authentication is best options when uploading
194208
| maxVideoDuration | no | number | maximum duration allowed for the file (in seconds) |
195209

196210

197-
### Example
211+
#### Example
198212

199213
```javascript
200214
const uploader = new VideoUploader({
@@ -205,9 +219,9 @@ Using delegated upload tokens for authentication is best options when uploading
205219
});
206220
```
207221

208-
## Methods
222+
### Methods
209223

210-
### `upload()`
224+
#### `upload()`
211225

212226
The upload() method starts the upload. It takes no parameter. It returns a Promise that resolves once the file is uploaded. If an API call fails more than the specified number of retries, then the promise is rejected.
213227
On success, the promise embeds the `video` object returned by the API.
@@ -216,14 +230,14 @@ On fail, the promise embeds the status code & error message returned by the API.
216230
**Example**
217231

218232
```javascript
219-
// ... uploader instanciation
233+
// ... uploader instantiation
220234

221235
uploader.upload()
222236
.then((video) => console.log(video))
223237
.catch((error) => console.log(error.status, error.message));
224238
```
225239

226-
### `onProgress()`
240+
#### `onProgress()`
227241

228242
The onProgress() method let you defined an upload progress listener. It takes a callback function with one parameter: the onProgress events.
229243
An onProgress event contains the following attributes:
@@ -234,15 +248,15 @@ An onProgress event contains the following attributes:
234248
- currentChunk (number): index of the chunk being uploaded
235249
- currentChunkUploadedBytes (number): number of bytes uploaded for the current chunk
236250

237-
### `cancel()`
251+
#### `cancel()`
238252

239253
The cancel() method cancels the upload. It takes no parameter.
240254

241255

242256
**Example**
243257

244258
```javascript
245-
// ... uploader instanciation
259+
// ... uploader instantiation
246260

247261
uploader.onProgress((event) => {
248262
console.log(`total number of bytes uploaded for this upload: ${event.uploadedBytes}.`);
@@ -255,7 +269,7 @@ The cancel() method cancels the upload. It takes no parameter.
255269
```
256270

257271

258-
### `onPlayable()`
272+
#### `onPlayable()`
259273

260274
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.
261275

@@ -265,7 +279,7 @@ The onPlayable() method let you defined a listener that will be called when the
265279
<div id="player-container"></div>
266280

267281
<script>
268-
// ... uploader instanciation
282+
// ... uploader instantiation
269283
270284
uploader.onPlayable((video) => {
271285
// the video is playable, we can display the player
@@ -274,18 +288,18 @@ The onPlayable() method let you defined a listener that will be called when the
274288
</script>
275289
```
276290

277-
# Documentation - Progressive upload
291+
## Documentation - Progressive upload
278292

279293

280-
## Instanciation
294+
### Instantiation
281295

282-
### Options
296+
#### Options
283297

284-
The progressive upload object 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.
298+
The progressive upload object 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.
285299

286-
#### Using a delegated upload token (recommended):
300+
##### Using a delegated upload token (recommended):
287301

288-
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).
302+
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/).
289303

290304

291305
| Option name | Mandatory | Type | Description |
@@ -294,7 +308,7 @@ Using delegated upload tokens for authentication is best options when uploading
294308
| videoId | no | string | id of an existing video |
295309
| _common options (see bellow)_ | | | |
296310

297-
#### Using an access token (discouraged):
311+
##### Using an access token (discouraged):
298312

299313
**Warning**: be aware that exposing your access token client-side can lead to huge security issues. Use this method only if you know what you're doing :).
300314

@@ -306,7 +320,7 @@ Using delegated upload tokens for authentication is best options when uploading
306320
| _common options (see bellow)_ | | | |
307321

308322

309-
#### Common options
323+
##### Common options
310324

311325

312326
| Option name | Mandatory | Type | Description |
@@ -318,7 +332,7 @@ Using delegated upload tokens for authentication is best options when uploading
318332
| mergeSmallPartsBeforeUpload | no | boolean | if false, parts smaller than 5MB will not be merged before upload, resulting in an error (default: true) |
319333

320334

321-
### Example
335+
#### Example
322336

323337
```javascript
324338
const uploader = new ProgressiveUploader({
@@ -327,9 +341,9 @@ Using delegated upload tokens for authentication is best options when uploading
327341
});
328342
```
329343

330-
## Methods
344+
### Methods
331345

332-
### `uploadPart(file: Blob)`
346+
#### `uploadPart(file: Blob)`
333347

334348
The upload() method starts the upload. It takes no parameter. It returns a Promise that resolves once the file is uploaded. If an API call fails more than the specified number of retries, then the promise is rejected.
335349
On success, the promise embeds the `video` object returned by the API.
@@ -338,13 +352,13 @@ On fail, the promise embeds the status code & error message returned by the API.
338352
**Example**
339353

340354
```javascript
341-
// ... uploader instanciation
355+
// ... uploader instantiation
342356

343357
uploader.uploadPart(blob)
344358
.catch((error) => console.log(error.status, error.message));
345359
```
346360

347-
### `uploadLastPart(file: Blob)`
361+
#### `uploadLastPart(file: Blob)`
348362

349363
The upload() method starts the upload. It takes no parameter. It returns a Promise that resolves once the file is uploaded. If an API call fails more than the specified number of retries, then the promise is rejected.
350364
On success, the promise embeds the `video` object returned by the API.
@@ -353,14 +367,14 @@ On fail, the promise embeds the status code & error message returned by the API.
353367
**Example**
354368

355369
```javascript
356-
// ... uploader instanciation
370+
// ... uploader instantiation
357371

358372
uploader.uploadLastPart(blob)
359373
.then((video) => console.log(video))
360374
.catch((error) => console.log(error.status, error.message));
361375
```
362376

363-
### `onProgress()`
377+
#### `onProgress()`
364378

365379
The onProgress() method let you defined an upload progress listener. It takes a callback function with one parameter: the onProgress events.
366380
An onProgress event contains the following attributes:
@@ -371,7 +385,7 @@ An onProgress event contains the following attributes:
371385
**Example**
372386

373387
```javascript
374-
// ... uploader instanciation
388+
// ... uploader instantiation
375389

376390
uploader.onProgress((event) => {
377391
console.log(`total number of bytes uploaded for this upload: ${event.uploadedBytes}.`);
@@ -380,11 +394,11 @@ An onProgress event contains the following attributes:
380394
});
381395
```
382396

383-
### `cancel()`
397+
#### `cancel()`
384398

385399
The cancel() method cancels the upload. It takes no parameter.
386400

387-
### `onPlayable()`
401+
#### `onPlayable()`
388402

389403
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.
390404

@@ -394,7 +408,7 @@ The onPlayable() method let you defined a listener that will be called when the
394408
<div id="player-container"></div>
395409

396410
<script>
397-
// ... uploader instanciation
411+
// ... uploader instantiation
398412
399413
uploader.onPlayable((video) => {
400414
// the video is playable, we can display the player
@@ -404,6 +418,6 @@ The onPlayable() method let you defined a listener that will be called when the
404418
```
405419

406420

407-
# Static wrapper
421+
## Static wrapper
408422

409-
For situations where managing object instances is impractical, consider using the [UploaderStaticWrapper](./doc/UploaderStaticWrapper.md) class, which offers static method equivalents for all functionalities.
423+
For situations where managing object instances is impractical, consider using the [UploaderStaticWrapper](https://github.com/apivideo/api.video-typescript-uploader/blob/main/doc/UploaderStaticWrapper.md) class, which offers static method equivalents for all functionalities.

0 commit comments

Comments
 (0)