Hello,
I am developing a native CarPlay application and would appreciate some clarification regarding AVAudioSession behaviour when using the vehicle microphone.
The application is intentionally simple and designed to minimise driver distraction.
The user presses a single button on the CarPlay screen, the application performs a brief (approximately five second) audio capture, performs application-specific processing on the captured audio, displays a simple confirmation to the user, and immediately releases the audio session.
The goal is to allow the driver to continue their journey with as little interaction as possible.
Because the audio being captured is often originating from the vehicle’s native DAB/FM radio rather than from the iPhone itself, preserving the existing listening experience during the brief capture is fundamental to the intended design.
To better understand what is supported by CarPlay, I have carried out a number of controlled experiments.
Test Environment
- Native CarPlay application
- Swift
- AVFoundation
- AVAudioSession
- AVAudioRecorder
- Vehicle connected via CarPlay
- Vehicle playing its native DAB radio
Experiment 1
Configuration
Category: AVAudioSession.Category.playAndRecord
Mode: AVAudioSession.Mode.default
Observed Route
Input: CarPlay — CarAudio
Output: CarPlay — CarAudio
Result
- Recording succeeds using the vehicle microphone.
- Native DAB audio is muted during recording.
- The vehicle changes from “Audio Volume” to “Voice Volume”.
- When recording finishes and the AVAudioSession is deactivated, DAB resumes normally.
Experiment 2
Changed only the session mode to:
AVAudioSession.Mode.measurement
Result
Behaviour was identical to Experiment 1.
Experiment 3
Changed only the session mode to:
AVAudioSession.Mode.videoRecording
Observed Route
Input: iPhone microphone
Output: CarPlay — CarAudio
Result
- Input automatically switched from the vehicle microphone to the iPhone microphone.
- The vehicle remained in normal “Audio Volume”.
- However, the head unit switched away from its native DAB source to the CarPlay media source.
Observation
These experiments appear to suggest that the behaviour is specifically related to using the CarPlay “CarAudio” microphone route, rather than audio recording itself.
Question
Is this the expected behaviour for third-party CarPlay applications?
More specifically:
Is there any supported AVAudioSession configuration or CarPlay API that allows a third-party CarPlay application to perform a brief, user-initiated audio capture using the vehicle microphone without causing the head unit to enter its communications/voice audio mode or interrupt the vehicle’s native radio playback?
If this behaviour is by design and no supported mechanism exists to achieve this, confirmation of that would be extremely valuable, as it would allow us to design the application accordingly.
If additional information, sample code, AVAudioSession logs or detailed reproduction steps would be helpful, I would be more than happy to provide them.
Thank you very much for your time.
Kind regards,
Neil Jenner Developer, HearSave