Multi-Clip Editing
The multi-clip example demonstrates advanced clip editing with drag-and-drop repositioning, trim handles, collision detection, and keyboard-based clip splitting. View Live Demo →What It Demonstrates
- Drag-to-move clips - Drag clip headers to reposition on timeline
- Trim handles - Adjust clip start/end boundaries by dragging edges
- Collision detection - Clips snap and prevent overlap
- Clip splitting - Press ‘S’ to split clip at playhead
- Gap handling - Multiple clips per track with gaps
- Progressive loading - Tracks appear as audio files load
Complete Example
Key Features
Drag-and-Drop Setup
Integrate with@dnd-kit for clip dragging:
The
collisionModifier prevents clips from overlapping during drag operations. It snaps clips to adjacent clip boundaries and track edges.Interactive Clips
Enable clip headers and trim handles:- Display clip name and time range
- Draggable to reposition clip
- Click to select track
- Left edge: Adjust clip start (offset into audio)
- Right edge: Adjust clip duration
- Show
col-resizecursor on hover
Clip Splitting
Split clips at the playhead position:Creating Clips with Gaps
UsecreateClipFromSeconds to position clips with gaps:
Collision Detection
ThecollisionModifier from useClipDragHandlers prevents overlaps:
- Clips snap to adjacent clip edges
- Cannot drag past track start (0)
- Visual feedback during collision
Keyboard Shortcuts
| Key | Action |
|---|---|
| Space | Play/pause |
| Escape | Stop |
| 0 | Rewind to start |
| S | Split clip at playhead (on selected track) |
Source Code
View the complete source code:- Example component:
website/src/components/examples/MultiClipExample.tsx - E2E tests:
e2e/multi-clip.spec.ts