diff --git a/sdks/vod/apivideo-typescript-media-recorder.md b/sdks/vod/apivideo-typescript-media-recorder.md index 78bb40c9..04bde1e8 100644 --- a/sdks/vod/apivideo-typescript-media-recorder.md +++ b/sdks/vod/apivideo-typescript-media-recorder.md @@ -3,6 +3,10 @@ title: api.video TypeScript Media Recorder meta: description: The official api.video TypeScript Media Recorder 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. --- + # api.video TypeScript Media Recorder @@ -10,6 +14,7 @@ meta: ## Project description + Typescript library to easily upload data from a [MediaStream](https://developer.mozilla.org/fr/docs/Web/API/MediaStream) to api.video. It can be used to upload a video to api.video from the user's webcam with ease, as well as from a screen recording. @@ -88,7 +93,7 @@ Then, once the `window.onload` event has been trigered, create your player using The media recorder object is instantiated using a [MediaStream](https://developer.mozilla.org/fr/docs/Web/API/MediaStream) and 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 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/). @@ -99,7 +104,7 @@ Using delegated upload tokens for authentication is best options when uploading | videoId | no | string | id of an existing video | | _common options (see bellow)_ | | | | -#### Using an access token (discouraged): +##### Using an access token (discouraged): **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 :). @@ -111,7 +116,7 @@ Using delegated upload tokens for authentication is best options when uploading | _common options (see bellow)_ | | | | -#### Common options +##### Common options | Option name | Mandatory | Type | Description | @@ -121,7 +126,7 @@ Using delegated upload tokens for authentication is best options when uploading | videoName | no | string | the name of your recorded video (overrides the default "file" name) | -### Example +#### Example ```javascript const mediaRecorder = new ApiVideoMediaRecorder(myMediaStream, { @@ -130,13 +135,13 @@ Using delegated upload tokens for authentication is best options when uploading }); ``` -## Methods +### Methods -### `start(options?: { timeslice?: number })` +#### `start(options?: { timeslice?: number })` The start() method starts the upload of the content retrieved from the MediaStream. It takes an optionnal `options` parameter. -#### Options +##### Options | Option name | Mandatory | Type | Description | | ----------: | ------------------ | ------ | ---------------------------------------------------- | | timeslice | no (default: 5000) | number | The number of milliseconds to record into each Blob. | @@ -152,11 +157,11 @@ The start() method starts the upload of the content retrieved from the MediaStre // mediaRecorder.start({ timeslice: 2000 }); ``` -### `stop(): Promise` +#### `stop(): Promise` The start() method stops the media recording. It upload the last part of content retrieved from the MediaStream (this will start the aggregation of the video parts on the api.video side). It takes no parameter. It returns a Promise that resolves with the newly created video. -### `addEventListener(event: string, listener: Function)` +#### `addEventListener(event: string, listener: Function)` Define an event listener for the media recorder. The following events are available: - `"error"`: when an error occurs @@ -173,7 +178,7 @@ Define an event listener for the media recorder. The following events are availa }); ``` -### `getMediaRecorderState(): RecordingState` +#### `getMediaRecorderState(): RecordingState` Return the state of the underlaying [MediaRecorder](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder). The state can be one of the following: `inactive`, `paused`, `recording`. @@ -263,4 +268,4 @@ Return the state of the underlaying [MediaRecorder](https://developer.mozilla.or -``` \ No newline at end of file +```