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:117
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:50
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:192
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:215
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.
warmupRecorder()¶
Defined in: src/shared/clips/recorder.ts:32
Warms the recorder's AudioContext from within a user gesture.
The canvas-fallback recording path (iOS Safari) draws its audio from this shared AudioContext, which only leaves the "suspended" state when resumed during a user activation. A save-clip flow can await a breakdown stream for several seconds before recording, by which point the click's activation is spent and the context can no longer resume. Call this synchronously from the click handler so the context is already running when recording starts.
Returns¶
void