Rebar UI

1.0

opinion

WaveformAudioPlayer

An audio player with a bar waveform you can click to seek.

Voice noteClick the bars to seek; arrows and Home/End work too

0:00 / 0:00

Few bars, skip 5 seconds

0:00 / 0:00

A different track

0:00 / 0:00

In context

MessageA voice note in the crew chat
Voice note
PNPriya NairCrew interviews, 21 Oct 09:40

0:00 / 0:00

Trailing action, playback state, error

Narration barTwo bars share one playing state, so starting one pauses the other

0:00 / 0:00

0:00 / 0:00

0:00 / 0:00

Narration files are not bundled with this site, so playback itself needs real audio; the bar, state and error handling are live.

Buffering

0:00 / 0:00

On dark

0:00 / 0:00

Props

PropTypeRequiredDefault
srcstringYes—
barCountnumber | undefinedNo48
skipSecondsnumber | undefinedNo15
trailingActionReactNodeNo—
autoPlayboolean | undefinedNofalse
onPlayBlocked(() => void) | undefinedNo—
playingboolean | undefinedNo—
onPlayingChange((playing: boolean) => void) | undefinedNo—
onEnded(() => void) | undefinedNo—
onTimeUpdate((currentTime: number, duration: number) => void) | undefinedNo—
errorReactNodeNo—
onRetry(() => void) | undefinedNo—
loadingboolean | undefinedNo—
tone"default" | "onDark" | undefinedNodefault
audioRefRef<HTMLAudioElement> | undefinedNo—
crossOrigin"" | "anonymous" | "use-credentials" | undefinedNo—
controls"text" | "icons" | undefinedNotext
size"default" | "compact" | undefinedNodefault

Waveform

Bar heights are seeded from src, so the same audio always shows the same bars; there is no real amplitude analysis.

data-rebar-* attributes

data-rebar-component="waveform-audio-player"; parts include play-button, skip-back, skip-forward, waveform, bar (with data-played once passed), time.

Migrating to Ant Design

Not codemod-covered. AntD has no audio player; use a dedicated library or a native <audio controls> if you do not need the waveform.

Icon controls, compact size, audioRef

controls="icons" draws round glyph buttons (play, pause, replay, skip back/forward with the seconds) instead of the labelled text buttons; each keeps its accessible name. size="compact" tightens the bar for lists and cards. audioRef gives you the underlying <audio> element (object or callback ref) and crossOrigin is forwarded to it. The error message uses a danger tone mixed toward the text colour, at least 6:1 on the page and tints in light and dark, and a lighter one on tone="onDark".

<WaveformAudioPlayer src={url} controls="icons" size="compact" audioRef={audio} crossOrigin="anonymous" />