CarPlay output is mono when AVAudioSession configured as playAndRecord

When configuring an AVAudioSession as playAndRecord, I have to select the CarPlay input as preferredInput to make sure that the output is also routed to the car - if I set the preferredInput to the built-in mic, the output is routed to the speakers instead.

However, when I select the CarPlay input as preferredInput, AVAudioSession configures the output as mono:

(lldb) po session.currentRoute.inputs.first!
<AVAudioSessionPortDescription: 0x282fcec30, type = CarAudio; name = CarPlay; UID = 48:F0:7B:C6:21:A8-Audio-AudioMain-92004763965583; selectedDataSource = (null)>
(lldb) po session.currentRoute.inputs.first!.channels
▿ Optional<Array<AVAudioSessionChannelDescription>>
  ▿ some : 1 element
    - 0 : <AVAudioSessionChannelDescription: 0x282fccc70, name = CarPlay; label = 0 (0x0); number = 1; port UID = 48:F0:7B:C6:21:A8-Audio-AudioMain-92004763965583>
(lldb) po session.currentRoute.outputs
▿ 1 element
  - 0 : <AVAudioSessionPortDescription: 0x282fce9d0, type = CarAudio; name = CarPlay; UID = 48:F0:7B:C6:21:A8-Audio-AudioMain-92004763965583; selectedDataSource = (null)>
(lldb) po session.currentRoute.outputs.first!.channels
▿ Optional<Array<AVAudioSessionChannelDescription>>
  ▿ some : 1 element
    - 0 : <AVAudioSessionChannelDescription: 0x282fd8590, name = CarPlay; label = 0 (0x0); number = 1; port UID = 48:F0:7B:C6:21:A8-Audio-AudioMain-92004763965583>

When I configure the session only for playback, the output is stereo, as you'd expect from a car system.

This is on iOS 17 beta1, and I'm afraid I can't check whether this is a new regression or has already existed before, but it's quite likely it has existed before. Any advice on how I can circumvent this issue?

Post not yet marked as solved Up vote post of thomastapeit Down vote post of thomastapeit
738 views