Set audioSession.type to playback in sheet music app (#489)

Use the Audio Session API to declare audio as media playback so the
platform handles it correctly: background audio, lock screen controls,
Dynamic Island integration, and bypassing the iOS silent switch.
This commit is contained in:
Mel Ludowise 2026-02-23 17:58:32 -08:00 • committed by GitHub
commit 82b1f29085
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,6 +30,17 @@ const statusEl = document.getElementById("status")!;
const sheetMusicEl = document.getElementById("sheet-music")!;
const audioControlsEl = document.getElementById("audio-controls")!;
// =============================================================================
// Audio Session
// =============================================================================
// Declare this app's audio as media playback so the platform can handle it
// correctly: background audio, lock screen controls, Dynamic Island, and
// bypassing the iOS silent switch. See https://w3c.github.io/audio-session/
if ("audioSession" in navigator) {
(navigator.audioSession as { type: string }).type = "playback";
}
// =============================================================================
// ABC Rendering
// =============================================================================