fix(mobile): only take over audio when playback starts
Restoring a paused queue activated the iOS audio session, which stopped other apps' audio on launch. play() already activates it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dce66b7697
commit
9d5dce1ba7
1 file changed
+2
-9
@@ -2,7 +2,6 @@ import { dolbyAtmosSupported } from "@/lib/playback-capabilities"
|
||||
import {
|
||||
createAudioPlaylist,
|
||||
setAudioModeAsync,
|
||||
setIsAudioActiveAsync,
|
||||
type AudioMetadata,
|
||||
type AudioPlaylist,
|
||||
type AudioPlaylistStatus,
|
||||
@@ -801,15 +800,9 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
setIsPlayingState(true)
|
||||
playlist.play()
|
||||
} else {
|
||||
// Activating the session here would stop other apps' audio.
|
||||
// `play()` activates it (iOS) and requests focus (Android).
|
||||
playlist.pause()
|
||||
// Enable audio for the restored queue without starting playback.
|
||||
try {
|
||||
await setIsAudioActiveAsync(true)
|
||||
} catch {
|
||||
if (isCurrentLoad()) {
|
||||
showError("Audio playback could not be initialized.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user