React components for the WaveformPlayer family: the player, the persistent bar, the playlist and the sound list. Each component has its own sub-path, and you install only the cores you use.
Requires React 19.3+ and the 2.0 cores. ES modules only (Node 22.12+ can
require() it).
| Import | Components | Cores to install |
|---|---|---|
@arraypress/waveform-react/player |
WaveformPlayer |
@arraypress/waveform-player |
@arraypress/waveform-react/bar |
WaveformBar, WaveformBarTrigger |
@arraypress/waveform-bar, @arraypress/waveform-player |
@arraypress/waveform-react/playlist |
WaveformPlaylist |
@arraypress/waveform-playlist, @arraypress/waveform-player |
@arraypress/waveform-react/sounds |
WaveformSounds |
@arraypress/waveform-sounds, @arraypress/waveform-player |
There is no root import. Each component loads its core with a dynamic
import(), and bundlers resolve every dynamic import at build time, so one
combined entry would fail to build unless every core were installed. The cores
are optional peer dependencies for the same reason.
Every core is 2.0 or later; ./playlist needs @arraypress/waveform-playlist
2.1 or later and ./sounds needs @arraypress/waveform-sounds 2.2 or later. Each sub-path exports what the old
single-component package exported (@arraypress/waveform-player-react and the
others): same names, props, refs and types, plus the 2.0 additions in the
CHANGELOG. Moving over means changing the import path.
npm install @arraypress/waveform-react @arraypress/waveform-player reactimport '@arraypress/waveform-player/dist/waveform-player.css';
import { WaveformPlayer } from '@arraypress/waveform-react/player';
<WaveformPlayer url="/track.mp3" title="My Song" artist="The Artist" waveformStyle="mirror" />A known duration and wp1: peaks let the player show the whole track, its
length and its waveform with preload="none", before any audio is fetched:
<WaveformPlayer
url="/track.mp3"
preload="none"
duration={187}
waveform="wp1:…"
showVolume
showDownload
onSeek={(d) => console.log('seeked to', d.currentTime)}
/>npm install @arraypress/waveform-react @arraypress/waveform-bar @arraypress/waveform-player reactimport { WaveformBar, WaveformBarTrigger } from '@arraypress/waveform-react/bar';
function App() {
return (
<>
{/* Render once in your layout */}
<WaveformBar config={{ persist: true, continuous: true }} />
{/* Trigger buttons anywhere */}
<WaveformBarTrigger url="/audio/track.mp3" title="My Track" artist="Producer" />
</>
);
}npm install @arraypress/waveform-react @arraypress/waveform-playlist @arraypress/waveform-player reactimport { WaveformPlaylist } from '@arraypress/waveform-react/playlist';
<WaveformPlaylist tracks={[{ url: '/a.mp3', title: 'A', artist: 'Artist' }]} />npm install @arraypress/waveform-react @arraypress/waveform-sounds @arraypress/waveform-player reactOnce, at your app entry:
import '@arraypress/waveform-player'; // the audio engine (window.WaveformPlayer)
import '@arraypress/waveform-player/styles.css';
import '@arraypress/waveform-sounds/styles.css';import { WaveformSounds } from '@arraypress/waveform-react/sounds';
<WaveformSounds
sounds={[
{ url: '/s/bass-01.mp3', title: 'Bass Loop 01', type: 'Bass', bpm: 128, key: 'Fm' },
{ url: '/s/drum-01.mp3', title: 'Drum Loop 01', type: 'Drums', bpm: 140 },
]}
onPlay={(sound) => console.log(sound.title)}
/>MIT © ArrayPress Limited