I am trying to listen music (streaming) in background but the streaming stop when I open another app.
const soundObject = new Audio.Sound();
async function playAudio() {
try {
await soundObject.loadAsync({
uri: "http://suaradio2.dyndns.ws:11004/stream"
});
await soundObject.playAsync();
soundObject.setAudioModeAsync({
staysActiveInBackground: true
});
// Your sound is playing!
} catch (error) {
// An error occurred!
}
}
wodin
October 19, 2019, 3:31am
2
Hi. It seems a few people are having a this problem:
I have an app that plays a list of sound files in sequence. It works fine when the app is in the foreground. When the app is backgrounded, the audio continues to play. However, once the current audio file ends, and it tries to play the next in the list, I get the following error:
Play encountered an error: audio session not activated.
I’m on SDK 35 with staysActiveInBackground: true, and “UIBackgroundModes”: [“audio”].
Is this a known issue/limitation? Are there any workarounds?
There’s also an issue for this. If there’s any relevant info missing from the bug report, please add a comment there. Otherwise subscribe to it to for progress notifications.
system
Closed
November 18, 2019, 3:31am
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.