Skip to content

AudioProvider

AudioProvider = "suno" | "spotify"

Defined in: audio.ts:27

Audio engine — W3, plan v1.1 decision (b): audio is CORE-ONLY.

window.__squidAudio was an inline IIFE in the shell template. Moving it here makes it versioned and patchable: a provider changes their embed API and one package bump reaches every consumer, instead of every customer needing to re-copy a component.

The accepted trade-off is that consumers cannot customise playback behaviour without forking. The mitigation is the shape of this module: what moves into core is the ENGINE — adapters, gesture wiring, the listen clock, media session — and NOT the chrome. getState() and on() expose everything a copied component needs to render its own player UI against an engine it does not own. Moving the shell’s markup in here as well would have been “just moving the file”, and would have made every consumer’s player look like signage.

Two invariants worth stating because both are load-bearing:

  • AUTOPLAY IS NEVER USED. Tap to play, always. Autoplaying audio in someone else’s page is the single fastest way for a customer to remove the SDK.
  • ONE PLAYER AT A TIME. Mounting a second destroys the first, so a page that cycles variants cannot end up with two tracks over each other.