Input sound built in mic lower when headphones are plugged
I have an app that record by the built in mic of the iPhone even if headphones are plugged with TAAE. To do that I used :
let session = AVAudioSession.sharedInstance()
session.setPreferredInput(session.availableInputs as! AVAudioSessionPortDescription, error: nil)
The problem is that when headphones are plugged, the voice of the user is recorded by the built in mic but at a lower level that if no headphones are plugged. We almost don't here his voice.
I tried to print the gain of the input with and without headphones but in both case it is at 1.0, the maximum.
Any idea from where it can come ?