WaveformBar.init(config = {}) builds the bar, the queue panel, and the embedded player; binds triggers; observes the DOM and theme; restores persisted volume/favorites/queue state; and applies any share-link target from the URL. Every option is optional.
Buttons render only when their flag (or the relevant config) is set. The methods behind them still work programmatically even when the button is hidden.
Option
Type
Default
Description
showRepeat
boolean
true
Render the repeat-cycle button.
showQueue
boolean
true
Render the queue toggle button and create the queue panel. false = no panel at all.
showPrevNext
boolean
true
Render the prev/next skip buttons.
showVolume
boolean
true
Render the volume popup slider.
showMute
boolean
true
Render the mute/volume button. The volume wrapper renders if showMuteorshowVolume is true.
showMeta
boolean
true
Render the metadata tag strip (BPM/key/duration/custom).
showTrackLink
boolean
true
Make the track-info area clickable, navigating to the track’s data-link (scheme-guarded).
maxMeta
number
3
Maximum number of metadata tags shown in the bar.
collapsible
boolean
false
Render a collapse button that shrinks the bar to a floating transport pill.
share
boolean
false
Render a “copy share link” button (emits a URL with the timestamp + track identity).
These pass through to the bar’s single embedded WaveformPlayer instance.
Option
Type
Default
Description
waveform
boolean
true
false forces the player’s built-in seekbar style (classic Spotify-style progress bar instead of a waveform).
waveformStyle
string
'mirror'
Player style: 'bars', 'mirror', 'line', 'blocks', 'dots', 'seekbar'. Ignored when waveform: false.
waveformHeight
number
32
Waveform height in px (passed to the player as height).
barWidth
number
2
Waveform bar width in px.
barSpacing
number
2
Gap between waveform bars in px.
waveformColor
string | null
null
Waveform color. Only passed to the player when truthy (else the player auto-detects from the theme).
progressColor
string | null
null
Progress color. Only passed when truthy.
markerColor
string
'rgba(255, 255, 255, 0.25)'
Default marker line color for markers lacking their own color.
errorText
string | null
null
Custom “audio failed to load” message passed to the player. null = the player’s own default.
crossOrigin
'anonymous' | 'use-credentials' | null
null
CORS mode forwarded to the embedded <audio>. Only passed when truthy. null leaves it unset (native <audio> behavior — avoids breaking CDN media without CORS headers).