Skip to content

Commit

Permalink
Merge pull request #12 from apivideo/add-origin-headers
Browse files Browse the repository at this point in the history
Add origin headers
  • Loading branch information
olivierapivideo committed Jul 11, 2022
2 parents 6761e83 + b7cc23b commit 7704532
Show file tree
Hide file tree
Showing 8 changed files with 710 additions and 958 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All changes to this project will be documented in this file.

## [1.0.6] - 2022-07-06
- Update dependancies
- Add origin headers
- Handle async errors

## [1.0.5] - 2022-05-31
- Add `getMediaRecorderState()` method
- Fix `stop()` method when the recorder is not started
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [`start(options?: { timeslice?: number })`](#startoptions--timeslice-number-)
- [Options](#options-1)
- [`stop(): Promise<VideoUploadResponse>`](#stop-promisevideouploadresponse)
- [`addEventListener(event: string, listener: Function)`](#addeventlistenerevent-string-listener-function)
- [`getMediaRecorderState(): RecordingState`](#getmediarecorderstate-recordingstate)
- [Full example](#full-example)

Expand Down Expand Up @@ -178,9 +179,25 @@ The start() method starts the upload of the content retrieved from the MediaStre

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)`

Define an event listener for the media recorder. The following events are available:
- `"error"`: when an error occurs
- `"recordingStopped"`: when the recording is stopped

**Example**

```javascript
// ... mediaRecorder instanciation

mediaRecorder.addEventListener("error", (event) => {
console.log(event.data);
});
```

### `getMediaRecorderState(): RecordingState`

Return the state of the underlaying [MediaRecorder](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder).
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`.

**Example**

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions dist/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import { ProgressiveUploaderOptionsWithUploadToken, ProgressiveUploaderOptionsWithAccessToken, VideoUploadResponse } from "@api.video/video-uploader";
import { VideoUploadError } from "@api.video/video-uploader/dist/src/abstract-uploader";
export { ProgressiveUploaderOptionsWithAccessToken, ProgressiveUploaderOptionsWithUploadToken, VideoUploadResponse } from "@api.video/video-uploader";
export { VideoUploadError } from "@api.video/video-uploader/dist/src/abstract-uploader";
export interface Options {
title?: string;
onError?: (error: VideoUploadError) => void;
}
declare type EventType = "error" | "recordingStopped";
export declare class ApiVideoMediaRecorder {
private mediaRecorder;
private streamUpload;
private onVideoAvailable?;
constructor(mediaStream: MediaStream, options: ProgressiveUploaderOptionsWithUploadToken | ProgressiveUploaderOptionsWithAccessToken);
private onStopError?;
private eventTarget;
constructor(mediaStream: MediaStream, options: Options & (ProgressiveUploaderOptionsWithUploadToken | ProgressiveUploaderOptionsWithAccessToken));
addEventListener(type: EventType, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
private onDataAvailable;
private dispatch;
start(options?: {
timeslice?: number;
}): void;
getMediaRecorderState(): RecordingState;
stop(): Promise<VideoUploadResponse>;
pause(): void;
private stopMediaRecorder;
private getSupportedMimeTypes;
}
Loading

0 comments on commit 7704532

Please sign in to comment.