Skip to content

Optional playout engines + injectable PlayoutAdapter (browser v14.0.0)

Choose a tag to compare

@naomiaro naomiaro released this 28 Jun 01:06
9fc76c6

@waveform-playlist/browser@14.0.0 makes the audio engine optional and injectable. Tone.js and the playout packages are no longer hard dependencies, so MediaElement-only and custom-adapter consumers no longer bundle them. PR #510.

Published packages

Package Version
@waveform-playlist/browser 14.0.0

Breaking changes

tone, @waveform-playlist/playout, @waveform-playlist/media-element-playout are now optional peer dependencies

They are declared in peerDependenciesMeta as optional and no longer arrive transitively. If you use the default Tone-based playout, install the peers explicitly:

npm install tone @waveform-playlist/playout

Or inject your own backend instead (see "New" below).

The Tone-coupled surface moved to @waveform-playlist/browser/tone

The core @waveform-playlist/browser entry is now engine-free under every bundler. The batteries-included Tone exports moved to the /tone subpath: useAudioTracks, useDynamicTracks, the effects hooks (useDynamicEffects, useTrackDynamicEffects) plus the effect factory/definitions, useExportWav, ExportWavButton, useOutputMeter, and useMasterAnalyser.

- import { useAudioTracks, ExportWavButton } from '@waveform-playlist/browser';
+ import { useAudioTracks, ExportWavButton } from '@waveform-playlist/browser/tone';

The Tone convenience re-export was removed

Import Tone directly:

- // previously re-exported from @waveform-playlist/browser
+ import * as Tone from 'tone';

New

Injectable adapters

  • WaveformPlaylistProvider accepts createAdapter?: () => PlayoutAdapter.
  • MediaElementPlaylistProvider accepts createPlayout?: () => MediaElementPlayout.

When supplied, no default engine is imported at all. When omitted, the default engine is loaded lazily via dynamic import(), with an actionable install-hint error if the optional peer is missing.

onError prop on both providers

Surfaces async engine-load / playout failures (e.g. a missing optional peer) to the consumer instead of throwing into the void.

Also shipped in this line

  • useAnnotationKeyboardControls is now usable without a WaveformPlaylistProvider (#509).
  • Cross-package peer dependencies publish as caret ranges to avoid exact-pin deadlock (#508).
  • New example: a MediaElement-only React starter that depends on neither playout nor tone.

Migration summary

  1. Using the default Tone playout? npm install tone @waveform-playlist/playout.
  2. Update Tone-coupled imports to @waveform-playlist/browser/tone.
  3. Replace any Tone import from @waveform-playlist/browser with import * as Tone from 'tone'.
  4. MediaElement-only or custom-adapter consumers can now drop tone/playout from their bundle entirely.