Overview
Playback control components provide pre-built buttons that integrate withWaveformPlaylistProvider context. All components are fully controlled via context and automatically reflect the current playback state.
Package: @waveform-playlist/browser
Requires: WaveformPlaylistProvider context
PlayButton
Starts audio playback from the current cursor position or plays the selection region.Props
Additional CSS class name for styling.
Behavior
- With selection (no loop): Plays the selection region only, then stops
- Without selection or with loop enabled: Plays from current cursor position (Transport loop handles boundaries when enabled)
- Disabled when: Already playing
Usage
PauseButton
Pauses audio playback at the current position.Props
Additional CSS class name for styling.
Behavior
- Pauses playback and maintains cursor position
- Disabled when: Not playing
Usage
StopButton
Stops audio playback.Props
Additional CSS class name for styling.
Behavior
- Stops playback completely
- Disabled when: Not playing
Usage
RewindButton
Rewinds playback to the beginning (0:00).Props
Additional CSS class name for styling.
Behavior
- Sets cursor to 0:00
- If currently playing, restarts playback from 0:00
- Always enabled
Usage
FastForwardButton
Fast forwards to the end of the audio.Props
Additional CSS class name for styling.
Behavior
- Sets cursor to end of duration
- If currently playing, restarts playback from end position
- Always enabled
Usage
SkipBackwardButton
Skips backward by a specified number of seconds.Props
Number of seconds to skip backward.
Additional CSS class name for styling.
Behavior
- Moves cursor backward by
skipAmountseconds (minimum 0:00) - If currently playing, restarts playback from new position
- Always enabled
Usage
SkipForwardButton
Skips forward by a specified number of seconds.Props
Number of seconds to skip forward.
Additional CSS class name for styling.
Behavior
- Moves cursor forward by
skipAmountseconds (maximum: duration) - If currently playing, restarts playback from new position
- Always enabled
Usage
LoopButton
Toggles loop mode on/off. When loop is enabled, playback repeats within the loop region boundaries.Props
Additional CSS class name for styling.
Behavior
- Toggles loop enabled state
- When enabling loop without a valid loop region, creates a default loop region (first 10 seconds or 25% of duration, whichever is smaller)
- Button text changes to “Loop On” or “Loop Off” based on state
- Always enabled
Usage
SetLoopRegionButton
Sets or clears the loop region based on the current selection.Props
Additional CSS class name for styling.
Behavior
- If loop region exists: Clears it (button shows “Clear Loop”)
- If valid selection exists: Sets loop region from selection (button shows “Set Loop”)
- Disabled when: No valid selection and no existing loop region
- Button title provides contextual help text
Usage
AudioPosition
Displays the current audio playback position as formatted text. Package:@waveform-playlist/ui-components
Props
The formatted time string to display (e.g., “00:05”, “1:23.456”).
Additional CSS class name for styling.
Usage
This component is typically used with theuseTimeFormat hook to format the current time: