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

Play Navigation Route Voice in Bluetooth handsfree devices

Open hastiranjkesh opened this issue 8 years ago • 0 comments

I'm having issues with Bluetooth playback. I need to determine whether Bluetooth handsfree devices appear as available input routes. In RouteVoiceController in duckAudio() method, I added another AVAudioSessionCategoryOptions like this:

func duckAudio() throws {
    var categoryOptions: AVAudioSessionCategoryOptions = [.duckOthers, .interruptSpokenAudioAndMixWithOthers, .allowBluetooth]
    if #available(iOS 10.0, *) {
        categoryOptions.insert(.allowBluetoothA2DP)
        categoryOptions.insert(.allowAirPlay)
    }
    try AVAudioSession.sharedInstance().setMode(AVAudioSessionModeSpokenAudio)
    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, with: categoryOptions)
    try AVAudioSession.sharedInstance().setActive(true)
}

But it makes other's app background music stopped and also route voice does not play. Am I missing something with the way I'm setting the category for my AVAudioSession?

Mapbox Navigation SDK version: 0.25.0

hastiranjkesh avatar Dec 02 '18 10:12 hastiranjkesh