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:
parent
0be854b244
commit
82b1f29085
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
// =============================================================================
|
||||
|
|
|
|||
Loading…
Reference in a new issue