1

I am using Apple's RosyWriter sample to record video and audio. Now I need to record audio using Bluetooth headset but it is not working for me. I am doing the below work for this

 captureSession = [[AVCaptureSession alloc] init];
   /*
 * Create audio connection
 */
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")){
    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
    captureSession.usesApplicationAudioSession = true;
    captureSession.automaticallyConfiguresApplicationAudioSession = true;

}
AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
//    AVCaptureDeviceInput *audioIn = [[AVCaptureDeviceInput alloc] initWithDevice:[self audioDevice] error:nil];
AVCaptureDeviceInput *audioIn = [[AVCaptureDeviceInput alloc] initWithDevice:audioDevice error:nil];

if ([captureSession canAddInput:audioIn])
    [captureSession addInput:audioIn];

I have also followed this question

Syed Ali Salman
  • 2,894
  • 4
  • 33
  • 48

1 Answers1

0

I was able to do this by changing audio out settings like below.

_audioCompressionSettings = [[audioOut recommendedAudioSettingsForAssetWriterWithOutputFileType:AVFileTypeQuickTimeMovie] copy];
Syed Ali Salman
  • 2,894
  • 4
  • 33
  • 48