- Docs
- Components
- Interface
- Data & Media
- Waveform Player
An audio player you scrub along its own waveform
| Name | Type | Default | Description |
|---|---|---|---|
src | string | — | Audio file to play. It is also decoded once to draw the waveform, so cross-origin files need CORS. |
peaks | number[] | — | Precomputed waveform levels. Skips decoding, which is best for long episodes. |
title | string | — | Track title shown in the card. |
artist | string | — | Line under the title. |
cover | string | — | Cover image shown beside the title. |
chapters | { time, title }[] | — | Splits the waveform with small gaps and names the chapter in the hover tooltip. |
variant | "card" | "inline" | "card" | A full card with cover and times, or a compact row like a voice message. |
barWidth | number | 3 | Width of each bar in pixels. |
barGap | number | 2 | Space between bars in pixels. |
height | number | 52 card, 30 inline | Height of the waveform. |
rates | number[] | — | Playback speeds to cycle through with a small chip, like [1, 1.5, 2]. Hidden when empty. |
loop | boolean | false | Starts again from the top when the track ends. |
exclusive | boolean | true | Pauses any other player on the page when this one starts. |
live | boolean | true | The bars around the playhead lift with the loudness of the music. |
intro | boolean | true | The player fades in and the bars grow from left to right the first time it scrolls into view. |
theme | "auto" | "light" | "dark" | "auto" | Auto matches the player to the background behind it. |
accentColor | string | text colour | Colour of the played bars and the play button. |
waveColor | string | faded text colour | Colour of the bars that have not played yet. |
surfaceColor | string | faint tint | Colour of the player panel. |
onPlay / onPause / onEnded | () => void | — | Called as playback starts, pauses and finishes. |
onTimeUpdate | (time: number) => void | — | Called four times a second while playing, with the current time in seconds. |
ref | { play, pause, toggle, seek } | — | Controls playback from your own code. seek takes seconds. |
className | string | — | Classes for the root element. |
style | CSSProperties | — | Inline styles for the root element. |
srcstringAudio file to play. It is also decoded once to draw the waveform, so cross-origin files need CORS.
—peaksnumber[]Precomputed waveform levels. Skips decoding, which is best for long episodes.
—titlestringTrack title shown in the card.
—artiststringLine under the title.
—coverstringCover image shown beside the title.
—chapters{ time, title }[]Splits the waveform with small gaps and names the chapter in the hover tooltip.
—variant"card" | "inline"A full card with cover and times, or a compact row like a voice message.
"card"barWidthnumberWidth of each bar in pixels.
3barGapnumberSpace between bars in pixels.
2heightnumberHeight of the waveform.
52 card, 30 inlineratesnumber[]Playback speeds to cycle through with a small chip, like [1, 1.5, 2]. Hidden when empty.
—loopbooleanStarts again from the top when the track ends.
falseexclusivebooleanPauses any other player on the page when this one starts.
truelivebooleanThe bars around the playhead lift with the loudness of the music.
trueintrobooleanThe player fades in and the bars grow from left to right the first time it scrolls into view.
truetheme"auto" | "light" | "dark"Auto matches the player to the background behind it.
"auto"accentColorstringColour of the played bars and the play button.
text colourwaveColorstringColour of the bars that have not played yet.
faded text coloursurfaceColorstringColour of the player panel.
faint tintonPlay / onPause / onEnded() => voidCalled as playback starts, pauses and finishes.
—onTimeUpdate(time: number) => voidCalled four times a second while playing, with the current time in seconds.
—ref{ play, pause, toggle, seek }Controls playback from your own code. seek takes seconds.
—classNamestringClasses for the root element.
—styleCSSPropertiesInline styles for the root element.
—