Flutter-AssetsAudioPlayer
Flutter-AssetsAudioPlayer copied to clipboard
Unable to play audio in background if spotify is playing in IOS.
Flutter Version
My version : 2.2.3
Lib Version
My version : 3.0.3+6
Platform (Android / iOS / web) + version
Platform : IOS
Describe the bug
My app triggers the audio player in the background after reaching a certain geofence. This works fine in android. But in IOS the player starts playing audio under normal circumstances. But if the app is running in background and a music player is playing then the player does not play audio.
The expected behaviour in IOS should be ducking of the audio that is currently playing for the duration our audio player plays the audio.
Small code to reproduce
await assetsAudioPlayer.open(
Audio.network(poi_list[index].audioUrl),
autoStart: true,
respectSilentMode: false,
showNotification: false,
forceOpen: true,
playInBackground: PlayInBackground.enabled,
audioFocusStrategy: AudioFocusStrategy.request(
resumeOthersPlayersAfterDone: true,
resumeAfterInterruption: true));
@kalismeras61 Can you give some insights on this?
Hello @aadesh93 , I am in a similar situation, My app is having a background process scanning stuff in bluetooth, and when I get a specific message, I would like the app to play a sound. So the playSound() function is triggered from my Background process (which is actually a forground service). It works well in android. But it doesn't work at all in IOS. Even when I have no music player.
Does it works for you for IOS when you don't have an audio player ?
If yes, car you tell me which background process do you use ? Thanks a lot.