mapbox-navigation-ios icon indicating copy to clipboard operation
mapbox-navigation-ios copied to clipboard

Route voice controller stops playing music in car

Open hastiranjkesh opened this issue 7 years ago • 0 comments

I have a problem with playing navigation instruction voice in some bluetooth devices through a Hands-Free profile, like cars. While iPhone connected to a car audio system via USB playing navigation instruction voice makes car music player stopped. based on this method in RouteVoiveController:

func duckAudio() throws {
    let categoryOptions: AVAudioSessionCategoryOptions = [.duckOthers, .interruptSpokenAudioAndMixWithOthers]
    try AVAudioSession.sharedInstance().setMode(AVAudioSessionModeSpokenAudio)
    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, with: categoryOptions)
    try AVAudioSession.sharedInstance().setActive(true)
}

This method does not handle these two AVAudioSessionCategoryOptions allowBluetooth and allowBluetoothA2DP. I tried to add these two options to categoryOptions but it does not work and instruction voice does not play. How can I handle playing route voice controller in cars?

Mapbox Navigation SDK version: 0.25

hastiranjkesh avatar Dec 04 '18 12:12 hastiranjkesh