I got this answer from apple support regarding this issue. This solved my problem. I hadn't added the option mixWithOthers.
With the following code (in a basic iOS app from the Xcode template, using Xcode 13.2 with iOS 15.2):
override func viewDidLoad() {
super.viewDidLoad()
let session = AVAudioSession.sharedInstance()
try! session.setCategory(.playAndRecord, mode: .measurement, options: [.mixWithOthers, .defaultToSpeaker])
try! session.setActive(true)
print(session.currentRoute)
}
I get the following output:
<AVAudioSessionRouteDescription: 0x28348c9a0,
inputs = (
"<AVAudioSessionPortDescription: 0x28348c960, type = MicrophoneBuiltIn; name = iPhone Microphone; UID = Built-In Microphone; selectedDataSource = Bottom>"
);
outputs = (
"<AVAudioSessionPortDescription: 0x28348c8e0, type = Speaker; name = Speaker; UID = Speaker; selectedDataSource = (null)>"
)>
That seems to be what you want: both input and output at the bottom of the device. Is this the configuration you’re looking for?
Post
Replies
Boosts
Views
Activity
Does anyone have any idea on how to solve this problem?