Skip to content

Commit 0dc5cc6

Browse files
Merge pull request #4 from apivideo/make-timeslice-customizable
Make start() timeslice parameter customizable
2 parents af0ad2f + 76e9907 commit 0dc5cc6

9 files changed

+45
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Create draft release if needed
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
create-draft-release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Create draft release if needed
12+
uses: apivideo/[email protected]
13+
with:
14+
github-auth-token: ${{ secrets.GITHUB_TOKEN }}
15+
prefix: v
16+

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Release package to npmjs
22
on:
33
release:
4-
types: [created]
4+
types: [published]
55
jobs:
66
deploy:
77
runs-on: ubuntu-latest

CHANGELOG.md

+3
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.0.2] - 2022-03-07
5+
- Make the start() timeslice parameter customizable
6+
47
## [1.0.1] - 2021-11-25
58
- Bump dependancies
69

README.md

+16-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
- [Common options](#common-options)
2525
- [Example](#example)
2626
- [Methods](#methods)
27-
- [`start()`](#start)
27+
- [`start(options?: { timeslice?: number })`](#startoptions--timeslice-number-)
28+
- [Options](#options-1)
2829
- [`stop()`](#stop)
2930
- [Full example](#full-example)
3031

@@ -135,10 +136,10 @@ Using delegated upload tokens for authentication is best options when uploading
135136
#### Common options
136137

137138

138-
| Option name | Mandatory | Type | Description |
139-
| ----------: | --------- | ------ | -------------------------------------------------------------------------- |
140-
| apiHost | no | string | api.video host (default: ws.api.video) |
141-
| retries | no | number | number of retries when an API call fails (default: 5) |
139+
| Option name | Mandatory | Type | Description |
140+
| ----------: | --------- | ------ | ----------------------------------------------------- |
141+
| apiHost | no | string | api.video host (default: ws.api.video) |
142+
| retries | no | number | number of retries when an API call fails (default: 5) |
142143

143144

144145
### Example
@@ -152,16 +153,24 @@ Using delegated upload tokens for authentication is best options when uploading
152153

153154
## Methods
154155

155-
### `start()`
156+
### `start(options?: { timeslice?: number })`
157+
158+
The start() method starts the upload of the content retrieved from the MediaStream. It takes an optionnal `options` parameter.
159+
160+
#### Options
161+
| Option name | Mandatory | Type | Description |
162+
| ----------: | ------------------ | ------ | ---------------------------------------------------- |
163+
| timeslice | no (default: 5000) | number | The number of milliseconds to record into each Blob. |
156164

157-
The start() method starts the upload of the content retrieved from the MediaStream. It takes no parameter.
158165

159166
**Example**
160167

161168
```javascript
162169
// ... mediaRecorder instanciation
163170

164171
mediaRecorder.start();
172+
// or, with a 2 seconds timeslice:
173+
// mediaRecorder.start({ timeslice: 2000 });
165174
```
166175

167176
### `stop()`

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/index.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export declare class ApiVideoMediaRecorder {
88
private onVideoAvailable?;
99
constructor(mediaStream: MediaStream, options: ProgressiveUploaderOptionsWithUploadToken | ProgressiveUploaderOptionsWithAccessToken);
1010
private onDataAvailable;
11-
start(): void;
11+
start(options?: {
12+
timeslice?: number;
13+
}): void;
1214
stop(): Promise<unknown>;
1315
pause(): void;
1416
private getSupportedMimeTypes;

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@api.video/media-recorder",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "api.video media recorder - upload video from your webcam with ease",
55
"repository": {
66
"type": "git",

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export class ApiVideoMediaRecorder {
3636
}
3737
}
3838

39-
public start() {
40-
this.mediaRecorder.start(5000);
39+
public start(options?: { timeslice?: number }) {
40+
this.mediaRecorder.start(options?.timeslice || 5000);
4141
}
4242

4343
public stop() {

0 commit comments

Comments
 (0)