Skip to content
Browse Docs and Help
how-to

Respect pause, mute and audio activation

Keep sound under the host's lifecycle controls.

On this page

Track independent states

Track host pause and user mute separately. Audio should be audible only when the ready gate has completed, the host is not paused and the player has not muted.

  1. Subscribe to pause, resume, mute and unmute.
  2. Initialise the SDK and use context.muted as the initial preference.
  3. Prepare audio without starting playback.
  4. Await ready() before activating audio.
  5. Apply the combined pause/mute state whenever it changes.
  6. Stop or suspend engine audio during pause, including long-running music and scheduled notes.
  7. Dispose audio resources and listeners when replacing a scene or audio subsystem.

Resume must not automatically unmute. Starting a new scene must not create a second copy of background music.

Choose one integration approach

  • Use accepted WAV assets through the SDK.
  • Use a supported procedural sound library.
  • Use the Studio-generated music engine, following its pause and mute instructions.

Pin any library in the manifest. Use the exact engine version’s audio API. For decoded audio, get bytes through llvls.assets.bytes(); do not bypass the SDK with a URL fetch.

Tone.js features that depend on AudioWorklet or microphone access are not compatible with this sandbox. An available library does not imply every feature it contains is permitted.

Test

Play sound, mute, pause, resume, unmute and change tabs in different orders. Listen for lingering music while covered. A muted sample with no audio cannot establish that a real audio integration passes these tests.