Skip to main content

Interface: WebCodecsCaptureSession

Defined in: src/export/WebCodecsExporter.ts:146

A frame-by-frame capture in progress. The caller moves the scene to the next frame state by any means (for example a fake clock that drives the live play() loop), then calls captureFrame(). Frame i gets timestamp i/fps.

captureFrame() waits for encoder queue capacity after it reads the canvas. The caller must keep the scene from advancing until that promise settles (the render script steps a paused fake clock): a running scene could otherwise finish an animation and change the next frame's state.

Properties​

frameCount​

readonly frameCount: number

Defined in: src/export/WebCodecsExporter.ts:154

Frames captured so far.


hasAudio​

readonly hasAudio: boolean

Defined in: src/export/WebCodecsExporter.ts:156

Whether the output gets an audio track.

Methods​

captureFrame()​

captureFrame(): Promise<void>

Defined in: src/export/WebCodecsExporter.ts:152

Encode the canvas as it is now as the next frame. The canvas is read synchronously, inside this call, before the promise waits for encoder queue capacity: later redraws do not reach this frame.

Returns​

Promise<void>


finish()​

finish(): Promise<Blob>

Defined in: src/export/WebCodecsExporter.ts:161

Flush the encoders, add the audio track (frameCount / fps seconds long), and return the container Blob.

Returns​

Promise<Blob>