fix(mobile): only take over audio when playback starts #105
@@ -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