7.0s
Playback controls preview
Transport, range, snapping, and viewport controls driven by focused editor hooks.
Installation
pnpm add @techsquidtv/canvas-timeline-reactnpm install @techsquidtv/canvas-timeline-reactyarn add @techsquidtv/canvas-timeline-reactbun add @techsquidtv/canvas-timeline-react- 1
Install the package.
The command above adds the React bindings and their package dependencies.
- 2
Import from the React entrypoint.
@techsquidtv/canvas-timeline-react/hooks
Usage
import { useTimelinePlayback, useTimelineSnapping, useTimelineViewport,} from '@techsquidtv/canvas-timeline-react/hooks';
export function Transport() { const playback = useTimelinePlayback(); const snapping = useTimelineSnapping(); const viewport = useTimelineViewport();
return ( <> <button onClick={playback.togglePlayback}> {playback.playing ? 'Pause' : 'Play'} </button> <button onClick={() => snapping.setEnabled(!snapping.enabled)}> {snapping.enabled ? 'Snapping on' : 'Snapping off'} </button> <button onClick={() => viewport.setZoomScale(viewport.zoomScale - 50)}>Zoom out</button> <button onClick={() => viewport.setZoomScale(viewport.zoomScale + 50)}>Zoom in</button> </> );}API Reference
Playback Controls
Hooks for transport state, snapping, media synchronization, and clip playback effects.
Exports
transport
| Name | Reference | Description |
|---|---|---|
useTimelinePlayback | API reference | Reads playback state and exposes play, pause, rate, and toggle commands. |
useTimelinePlayheadTime | API reference | Subscribes to the live playhead time for readouts and frame-sensitive buttons. |
snapping
| Name | Reference | Description |
|---|---|---|
useTimelineSnapping | API reference | Reads snapping state and exposes threshold, feedback, and snap commands. |
effects
| Name | Reference | Description |
|---|---|---|
usePlaybackEffect | API reference | Runs effects as the playhead enters, updates, and leaves a clip. |
media
| Name | Reference | Description |
|---|---|---|
useTimelineMediaSync | API reference | Synchronizes external media adapters to active timeline layers. |
useTimelineMediaPlayback | API reference | Controls media adapter playback state alongside the TimelineEngine. |