Skip to content

media-element-playout: optional peaks (12.1.0)

Choose a tag to compare

@waveform-playlist/media-element-playout@12.1.0

Makes peaks optional so consumers can drive pure HTMLAudioElement playback (play / pause / seek / rate / timeupdate / ended) without supplying pre-computed waveform data — enabling headless and scrubber-only players (e.g. long-form radio streams that render a plain scrubber with no waveform).

Resolves #529 (PR #530).

Changes

  • MediaElementTrackOptions.peaks is now optional (peaks?: WaveformDataObject).
  • MediaElementTrack.duration degrades gracefully: audioElement.durationpeaks?.duration0 (no throw when peaks absent).
  • MediaElementPlayout.sampleRate returns the 44100 default when no peaks are present.
  • get peaks() now returns WaveformDataObject | null.
  • Adds the package's first unit suite (vitest) covering the peaks-omitted path plus backward-compat with peaks provided.

Compatibility

  • Runtime behavior with peaks provided is unchanged. The in-repo @waveform-playlist/browser consumer (which always passes decoded peaks and never reads track.peaks) is unaffected.
  • Type note: get peaks() widening to WaveformDataObject | null is a type-level change — external TypeScript consumers that read the getter and dereference it without a null guard will now need one. This drives the minor version bump (12.0.0 → 12.1.0).