How to pick a specific microphone when recording video AVCaptureSession

My app is recording video using the front camera, and I'd like to lock the audio portion to use a specific microphone.

Code Block
let captureSession = AVCaptureSession()
captureSession.sessionPreset = .hd1280x720       
guard let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front) else {return}       
// Get Audio Device       
guard let audioInputDevice = AVCaptureDevice.default(for: .audio) else {print("Could not get audio"); return}       
guard let videoInput = try? AVCaptureDeviceInput(device:captureDevice) else {return}
guard let audioInput = try? AVCaptureDeviceInput(device:audioInputDevice) else {return}
captureSession.addInput(videoInput)       
captureSession.addInput(audioInput)


I can set the video to the specific camera, but I haven't seen how to set the audio device to a specific microphone when using AVCaptureSession.


How to pick a specific microphone when recording video AVCaptureSession
 
 
Q