We are using openTok in iOS application for video broadcast were user can broadcast live video to other user. While broadcast all microphones record audio in which the audio get distorted. So i want to enable only rear microphone on iPhone.
For enabling the mic nearest to the video camera you can try this. To set the audio session mode to "VideoRecording" using AVFoundation you would do something like this:
func setAudioPort(){
let session = AVAudioSession.sharedInstance()
try! session.setCategory(AVAudioSessionCategoryRecord)
try! session.setMode(AVAudioSessionModeVideoRecording)
try! session.setActive(true)
}
What it does is select the mic nearest to the video camera. Hope it Helps!!