All notable changes to this project will be documented in this file.
- JSON waveform files can now include
markers— automatically loaded if no markers are set via data attributes
- Drawing style aliases:
bar,block,dotnow accepted alongsidebars,blocks,dotsforwaveformStyle
- JSON Waveform Loading —
data-waveformnow accepts a URL to a JSON file ending in.json- Fetches the file and reads peaks from the response (supports
[...]array or{ peaks: [...] }object) - Falls back gracefully if fetch fails (player generates waveform from audio as before)
- No changes to constructor,
load(), orloadTrack()— fully backwards compatible
- Fetches the file and reads peaks from the response (supports
<!-- JSON file instead of inline peaks -->
<div data-waveform-player data-url="song.mp3" data-waveform="waveforms/song.json"></div>
<!-- WaveformBar — same attribute -->
<div data-wb-play data-url="song.mp3" data-wb-waveform="waveforms/song.json"></div>
<!-- Inline peaks still work exactly as before -->
<div data-waveform-player data-url="song.mp3" data-waveform="[0.2, 0.37, 0.41, ...]"></div>- Reverted JSON config file feature (
data-config) introduced in 1.4.0 due to breaking changes with WaveformBar integration. The feature caused layout and sizing issues when the player was used inside WaveformBar. Will be revisited in a future release with proper integration testing.
- JSON Config Files — Load track configuration from external JSON files via
data-configattribute- Single attribute setup:
<div data-waveform-player data-config="waveforms/track.json"></div> - JSON supports
url,title,subtitle,artwork,album,samples,peaks,markers, andmeta - Priority order: JSON config (base) → data attributes (override) → JS options (override)
- Config files are cached in memory — subsequent loads of the same file are instant
- Works with
loadTrack()viaoptions.configfor dynamic track loading metaobject passes through for use by extensions (e.g. WaveformBar readsmeta.bpm,meta.key)
- Single attribute setup:
{
"url": "audio/track.mp3",
"title": "Track Title",
"subtitle": "Artist Name",
"artwork": "covers/artwork.webp",
"samples": 200,
"peaks": [
0.2,
0.37,
0.41,
...
],
"markers": [],
"meta": {
"bpm": "128",
"key": "Am"
}
}Generate config files with @arraypress/waveform-gen:
npx @arraypress/waveform-gen ./audio/*.mp3 --output ./waveforms/- Fixed marker elements from previous track persisting when loading a new track without markers
- Fixed markers from previous track persisting when loading a new track without markers via
loadTrack()
- Removed inline
style.heighton canvas element that prevented it from filling available width in flex containers. Container div still controls height.
- Fixed waveform canvas not filling available width when embedded in flex containers (e.g. persistent bottom bars).
resizeCanvas()now reads width from the container div instead of the canvas element.
- Fixed uncaught
NotAllowedErrorwhenloadTrack()triggers autoplay before user interaction (e.g. on session restore). Theplay()promise returned since v1.2.2 was not being caught internally.
showControlsoption - Hide the play/pause button for custom UI implementations (data-show-controls="false")showInfooption - Hide the title, subtitle, time, and metadata bar (data-show-info="false")- Both options work via HTML data attributes or JavaScript API
- Waveform automatically fills the full width when controls are hidden
<!-- Waveform only, no button or info -->
<div data-waveform-player
data-url="song.mp3"
data-show-controls="false"
data-show-info="false">
</div>play()now returns the Promise fromHTMLMediaElement.play(), allowing callers to handle errors likeAbortError
Thanks to @scruffian for the contribution.
- Fixed null reference error when
destroy()is called during resize events - Cleaned up window resize listener on destroy to prevent memory leaks
- Added destruction guards to all event handlers to prevent race conditions
- Added
bubbles: trueto all custom events for better framework integration
Thanks to @scruffian for contributing these fixes.
- Automatic Theme Detection - Player now automatically adapts to your website's color scheme
- Detects light/dark themes automatically
- Checks background brightness, theme classes, and system preferences
- Works seamlessly on WordPress, Shopify, and all platforms
- Override with explicit
data-color-preset="light"or"dark"if needed
- 6 visual styles: bars, mirror, line, blocks, dots, seekbar
- BPM detection
- Waveform caching with pre-generated data
- Keyboard controls
- Media Session API integration
- Speed control
- Chapter markers
- Dynamic track loading
- Initial patch release
- Zero-config audio player with waveform visualization
- HTML data attribute API
- JavaScript API
- ~8KB gzipped, zero dependencies
- Framework agnostic (React, Vue, Angular, vanilla JS)