A base class for encoders. Custom frame encoders may be implemented and used by Hubble as new capture technologies advance, or uncommon use cases need to be implemented.
Parameters:
settings
(Object)
startOffsetMs
(number
, Optional) - Offset the animation. Defaults to 0.durationMs
(number
, Optional) - Set to render a smaller duration than the whole clip. Defaults to scene length.filename
(string
, Optional) - Filename for rendered video. Defaults to UUID.framerate
(number
, Optional) - framerate of rendered video. Defaults to 30.See encoders for additional namespaced settings.
extension
(String)File extension.
""
mimeType
(String)""
MIME type. See Common MIME types
quality
(Number)0.8
Generic quality value. For canvas capture see HTMLCanvasElement.toDataURL
framerate
(Number)30
Initialize a capture and flush the existing encoder state.
Add a canvas frame to an in-progress capture.
Parameters:
canvas
(HTMLCanvasElement
) - The canvas to capture.Returns:
Promise<void>
- Add is an async function. The promise will resolve when the frame capture is complete.Compile a video of the captured frames.
Returns:
Promise<Blob | ArrayBuffer>
- Save is an async function. The promise will resolve when the video is compiled and will contain a Blob
or ArrayBuffer
of the video content. See individual encoders for more details.