使用蓝牙设备在 AVCaptureSession 中录制音频

Use Bluetooth device to record audio in AVCaptureSession

我正在使用 Apple's RosyWriter 示例来录制视频和音频。现在我需要使用蓝牙耳机录制音频,但它对我不起作用。我正在为此做以下工作

 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];

我也关注了这个

我可以通过如下更改音频输出设置来做到这一点。

_audioCompressionSettings = [[audioOut recommendedAudioSettingsForAssetWriterWithOutputFileType:AVFileTypeQuickTimeMovie] copy];