I’m engaged on an iOS app that integrates:
WebRTC for a voice communication module.
Mapbox Navigation SDK for turn-by-turn navigation audio.
The problem I am going through is that when Mapbox Navigation, which makes use of SDK’s UI NavigationViewController
, performs audio directions (e.g., “Flip left in 100 meters”), it interrupts and stops the audio of the continued WebRTC voice communication. This habits negatively impacts the consumer expertise since each real-time communication and navigation are important to the app.
Right here is the WebRTC audio session setup I’m utilizing for the voice communication module:
func setupAudioSession() {
self.rtcAudioSession.lockForConfiguration()
do {
print(self.rtcAudioSession.categoryOptions)
strive self.rtcAudioSession.setCategory(AVAudioSession.Class.playAndRecord.rawValue, with: [.mixWithOthers])
strive self.rtcAudioSession.setMode(AVAudioSession.Mode.voiceChat.rawValue)
strive self.rtcAudioSession.overrideOutputAudioPort(.speaker)
} catch let error {
debugPrint("Error altering AVAudioSession class: (error)")
}
self.rtcAudioSession.unlockForConfiguration()
}
This configuration permits the WebRTC audio stream to work completely in isolation.
When Mapbox Navigation begins taking part in an audio instruction, it appears to reconfigure AVAudioSession and adjustments it is mode to AVAudioSessionModeDefault
whereas WebRTC set it to AVAudioSessionModeVoiceChat
beforehand, inflicting WebRTC audio to cease.
After the Mapbox audio finishes, WebRTC audio doesn’t recuperate its unique state.
My Aim
I need each WebRTC voice communication and Mapbox Navigation audio to work concurrently with out interruptions. WebRTC audio shouldn’t cease after Mapbox performed directions.