Interface

UseTimelineMediaPlaybackOptions

Options for coordinating timeline playback with an external media clock.

Usage notes

Use this hook when your preview surface owns the media clock. The hook tells TimelineEngine to play with an external clock, reads timeline seconds from `getClockTime`, and calls `syncLayers` with an ActiveLayerResult whenever active clips need to be rendered, sought, or paused. Higher-level adapters such as `useHTMLTimelineMedia` and `useMediabunnyTimelineMedia` wrap this contract for common media stacks.

Signature

Type Definition
Interface UseTimelineMediaPlaybackOptions

Type parameters

NameConstraintDefaultDescription
LayerNamestringstringNamed media layer keys inferred from `layers`, such as `"visuals" | "audio"`.

Properties

NameSignatureDescription
frameRate?frameRate?: TimecodeFrameRateOptional sequence frame rate used to quantize playback updates to project frames.
getClockTime(): numberReturns current timeline seconds from the external media clock.
layerslayers: Record<LayerName, ActiveLayerSelector>Named active layer selectors used by the external media surface.
loop?(timelineTime: RationalTime, activeLayers: ActiveLayerResult<LayerName>): MaybePromise<void>Enables looping and realigns the external clock after Core returns to the range start. The callback is invoked once per loop transition until the clock re-enters range. Its presence and implementation are captured when each playback run begins.
onError?(error: Error): voidReceives external rendering or scheduling failures before playback is paused.
onStatus?(status: TimelineContentPlaybackStatus): voidReceives high-level playback status changes.
playbackOptions?playbackOptions?: Omit<PlaybackOptions, "clock" | "loop">Core playback range policy applied to the external clock; looping is configured by `loop`.
setClockRate?(playbackRate: number): voidApplies a validated playback-rate change to the external media clock.
stopClock?(): voidStops the external media clock when timeline playback pauses or leaves active content.
syncLayers?(details: TimelineLayerSyncDetails<LayerName>): MaybePromise<void>Synchronizes external rendering, audio, text, or effects for the active layers.