Recorder
Cross-browser recording of a MediaStream from an
HTMLVideoElement. Uses native captureStream where available and falls back
to a canvas-based approach (iOS Safari). Also picks a supported MIME type.
Functions¶
createRecordingPromise()¶
Defined in: src/shared/clips/recorder.ts:84
Records a MediaStream into a File for duration ms.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
stream |
MediaStream |
The stream to record. |
duration |
number |
Duration in milliseconds. |
recordingOptions |
{ fileExtension: string; mimeType: string; } |
Codec choice. |
recordingOptions.fileExtension |
string |
- |
recordingOptions.mimeType |
string |
- |
Returns¶
The recorded file.
getStream()¶
Defined in: src/shared/clips/recorder.ts:24
Gets a MediaStream from a video element, with a canvas fallback.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
videoElement |
HTMLVideoElement |
The source video element. |
endTime |
number |
When (seconds) the recording should stop. |
Returns¶
The combined media stream.
getSupportedMimeType()¶
Defined in: src/shared/clips/recorder.ts:132
Returns the first browser-supported recording MIME type + extension.
Returns¶
| {
fileExtension: string;
mimeType: string;
}
| null
The choice, or null.
recordMediaStream()¶
Defined in: src/shared/clips/recorder.ts:155
Records a clip from a video element between two timestamps, restoring the element's prior state afterward.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
videoElement |
HTMLVideoElement |
The source element. |
startTime |
number |
Start time (seconds). |
endTime |
number |
End time (seconds). |
Returns¶
The recorded clip file.