You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I observed that using the audio_service in response to background events i.e location events as used in a navigation application requires specific configuration of the audio session to work on iOS.
If the session is configured with anything other than AVAudioSessionCategoryOptions.mixWithOthers or AVAudioSessionCategoryOptions.interruptSpokenAudioAndMixWithOthersno audio will be played (I'm using just_audio but I imagine it doesn't matter). If the session is configured with one of those two options audio will be played but media item updates will have no effect (interrupted audio from other apps will show) nor will stop/ skip commands from the media center have any effect on the audio_service. I believe this is not a bug, just iOS behavior but since this behavior is difficult to replicate in the simulator I think the documentation would benefit from an update.
Maybe a navigator prefconfiguration could also be added to the AudioSessionConfiguration.speech() and music preconfigurations.
The text was updated successfully, but these errors were encountered:
I agree it might be helpful to add a navigator recipe and docs to audio_session, although I'm not terribly familiar with that use case myself, so I have left it to the app developer. However, I would have guessed that you wouldn't want to use audio_service (this plugin) for a navigation app on iOS. All you really need is to add the appropriate UI background mode in your Info.plist but it wouldn't make sense to display a media notification since technically you're not playing media that has a title/artist/coverart and the use case wouldn't need controls like a seek bar and so on.
Just to be clear in our case we're using the proper background mode (location) and notfications etc. can be scheduled in response to location updates in the background but the audio session can't be activated unless configured as described above.
I agree that displaying a media item is probably a fairly exotic use case but in our case we inform users of upcoming points of interest on their route with a short audio message and adding the point of interests picture and title as album art was a nice addition. What's more annoying for our use case is that the audio messages can't be skipped when played from the background, which I feel would be great even for regular navigation guidance. But since it's a system limitation as far as I understand there is no point debating it.
Documentation request for the following page(s)
https://pub.dev/documentation/audio_service/latest/
Section(s) in question
Configuring the audio session
Suggested improvement
I observed that using the audio_service in response to background events i.e location events as used in a navigation application requires specific configuration of the audio session to work on iOS.
If the session is configured with anything other than
AVAudioSessionCategoryOptions.mixWithOthers
orAVAudioSessionCategoryOptions.interruptSpokenAudioAndMixWithOthers
no audio will be played (I'm usingjust_audio
but I imagine it doesn't matter). If the session is configured with one of those two options audio will be played but media item updates will have no effect (interrupted audio from other apps will show) nor will stop/ skip commands from the media center have any effect on the audio_service. I believe this is not a bug, just iOS behavior but since this behavior is difficult to replicate in the simulator I think the documentation would benefit from an update.Maybe a
navigator
prefconfiguration could also be added to theAudioSessionConfiguration.speech()
andmusic
preconfigurations.The text was updated successfully, but these errors were encountered: