I wrote a app to record video from iPhone. It work fine but have one big problem. When AVCaptureSession start running and user try to play audio from thier library(iPod). This action will make AVCaptureSession terminate. Have any idea can prevent user try to play audio or solve this problem?
这是我的法典:
videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
AVCaptureDeviceInput *videoDeviceInput = [[AVCaptureDeviceInput alloc] initWithDevice:videoDevice error:nil];
AVCaptureDeviceInput *audioDeviceInput = [[AVCaptureDeviceInput alloc] initWithDevice:audioDevice error:nil];
movieFileOutput = [[AVCaptureMovieFileOutput alloc] init];
captureSession = [[AVCaptureSession alloc] init];
[captureSession beginConfiguration];
[captureSession setSessionPreset:AVCaptureSessionPresetHigh];
[captureSession addInput:videoDeviceInput];
[captureSession addInput:audioDeviceInput];
[captureSession addOutput:movieFileOutput];
[captureSession commitConfiguration];
[captureSession startRunning];