Post

Replies

Boosts

Views

Activity

Poor audio using AVAudioSession.Category.playAndRecord with CarPlay
I'm building an app that is mostly around audio playback, but I occasionally want to record small bit from the microphone. I'm setting up my audio session like this: try? AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: [.allowBluetoothA2DP] ) When connected to bluetooth headphones, or via bluetooth audio to the car (a 2022 VW ID.4) this gives me the results I desire: playback is high quality via A2DP, and the recordings use the built-in iphone microphone. However, when connected to CarPlay, the output audio quality suffers greatly; it sounds like it's using a bluetooth HFP connection. Note that this only happens when using .playAndRecord -- if I setup the session with .playback the audio quality using carplay is just fine. I've tried bludgeoning some workarounds like setting .playAndRecord at the last minute, or calling setPreferredInput() to force using the ios mic, but nothing seems to help.
0
1
799
May ’23