All notable changes to @arraypress/waveform-player-react are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
crossOriginprop. Exposes the option added in@arraypress/waveform-player@1.23.0: sets the CORS mode of the underlying<audio>('anonymous'|'use-credentials'). Omitted from the options bag by default so the player behaves like a native<audio>and never forces a CORS request that would break CDN media withoutAccess-Control-Allow-Origin.
-
buttonRadiusandartworkPositionprops. Exposes the two options added in@arraypress/waveform-player1.22.0:buttonRadiussets the play button's corner radius (0for square, or any CSS length), andartworkPosition('info'|'button') chooses whether the cover renders in the info row or becomes the play button itself.Both prop types already flowed through automatically, since the props derive from the core's
WaveformPlayerOptions— but the options bag is written by hand, so until now they would have type-checked and then silently done nothing. Tests now cover the mapping for exactly that reason.The peer range stays
^1.20.0: the props only appear once the consumer's own core is on 1.22.0, so nothing breaks on an older one.
- Forward the core player's new localizable UI-string options —
seekValueText,playPauseLabel,speedLabel,artworkAlt, andunknownTrackText— through to the underlying player. Requires@arraypress/waveform-player@^1.20.0.
- Public types are now adopted from the core
@arraypress/waveform-player(v1.8.0+), which ships a hand-authoredindex.d.ts. The shared option surface (WaveformStyle,ColorPreset,AudioMode,AudioPreload,ButtonAlign,WaveformMarker,WaveformPeaks) is re-exported from the core, andWaveformPlayerPropsnowextendsthe core'sWaveformPlayerOptionsinstead of re-declaring every field. The core is the single source of truth, so the wrapper's types can no longer drift out of sync. Bumped the@arraypress/waveform-playerpeer (and dev) dependency to^1.8.0. - Callback props (
onLoad,onPlay,onPause,onEnd,onTimeUpdate,onError) and theWaveformPlayerHandle.instanceaccessor are now typed with the core'sWaveformPlayerclass instead ofunknown.
accessibleSeek,seekLabel,barRadius, and gradient-array waveform / progress colours (string[]) are now exposed as typed props — picked up for free by extending the core options and wired through to the underlying player.
- Deleted
src/core-module-shim.d.ts, the loose ambientdeclare module '@arraypress/waveform-player'shim that only existed while the core had no shipped types.
- Bumped the
@arraypress/waveform-playerpeer (and dev) dependency to^1.7.2. Consumers now get the native accessible keyboard / ARIA seek slider by default. No component API changes.
Initial release.
<WaveformPlayer>React component wrapping every option exposed by@arraypress/waveform-player1.6.x as a typed prop:- Audio source (
url,audioMode,preload) - Waveform visualisation (
waveformStyle,height,samples,barWidth,barSpacing,waveform) - Colours (
colorPreset,waveformColor,progressColor,buttonColor,buttonHoverColor,textColor,textSecondaryColor,backgroundColor,borderColor) - Playback (
playbackRate,showPlaybackSpeed,playbackRates) - UI toggles (
showControls,showInfo,showTime,showHoverTime,showBPM,buttonAlign) - Markers (
markers,showMarkers) - Metadata (
title,artist,artwork,album) - Behaviour (
autoplay,singlePlay,playOnSeek,enableMediaSession) - Icons (
playIcon,pauseIcon)
- Audio source (
- Callback props (
onLoad,onPlay,onPause,onEnd,onTimeUpdate,onError) that map to the library's same-named option fields. Callbacks are deliberately NOT in the effect dep array, so a parent re-rendering with new inline functions doesn't tear the player down. - React-specific extras:
id,className,style, andrefforwarding viaWaveformPlayerHandle. WaveformPlayerHandleimperative API on the forwarded ref —play(),pause(),togglePlay(),seekTo(),seekToPercent(),setVolume(),setPlaybackRate(),setPlayingState(),setProgress(),loadTrack(), plus the rawinstance.- SSR / RSC safe: the core library is loaded via dynamic
import('@arraypress/waveform-player')inside the effect so the browser-only audio surface never runs server-side. - Identity-prop re-mount: when any library-construction prop
changes (
url,audioMode, etc.), the wrapper destroys the existing instance and creates a new one with the updated options. Simpler and more correct than diffing every option + calling granular updaters. - Public TypeScript types:
WaveformPlayerProps,WaveformPlayerHandle,WaveformStyle,WaveformMarker,WaveformPeaks,ColorPreset,AudioMode,AudioPreload,ButtonAlign. - Ambient module shim for
@arraypress/waveform-playerso the wrapper typechecks cleanly until the core library ships its own.d.ts. - Vitest test suite (17 tests, jsdom +
@testing-library/react) covering mount, unmount destroy, option pass-through, callback forwarding, identity-prop re-mount, callback-churn protection, ref forwarding, and the full imperative handle surface. The core library is mocked at the module boundary because jsdom has no Web Audio API. - Dual ESM (
dist/index.js) + CJS (dist/index.cjs) build viatsup..d.tsfor both. React + the core library are externalised so they resolve to the consumer's copies. - README with full prop reference, seven usage patterns, and the
imperative-ref control example.
examples/basic.tsxwith seven copy-paste-ready snippets.