Timeline Usage
Component Integration
Import and use the timeline components in your React application.
For optimal performance and proper functionality, structure your components like this:
tsx
This structure ensures:
- Timeline state management through TimelineProvider
- Zoom functionality with TimelineZoomProvider
- Proper sizing calculations with TimelineSizeProvider
- Responsive timeline container with TimelineContainer
Default state structure
The project includes a predefined state structure for timeline tracks and items. You can check TimelineProvider component for the state structure.
Video Preview
This project includes a CanvasComposition, a Remotion composition that renders the timeline state in the Remotion Player.
You can:
- Use the provided composition as-is for quick prototyping
- Adapt it to your needs
- Replace it with your own composition while keeping the timeline functionality
Check video-preview.tsx and App.tsx for implementation examples.
State Persistence
The TimelineProvider includes an onChange callback that fires whenever the timeline state changes (adding/removing tracks, moving items, etc.). Use this to save the editor state to your backend:
tsx
Example Project Structure
In App.tsx, you can see the complete implementation of the timeline component.
The example project demonstrates:
- Importing the timeline components
- Using the ActionRowcomponent to use timeline zoom and add clips
- Using the TimelineRootcomponent to render the timeline