0
와 비디오를 녹화 나는 startRecordingToOutputFileURL 호출 할 때 : recordingDelegate : 방법, 그것은 didFinishRecordingToOutputFileAtURL 대리자 메서드 호출을, 그래서 시작하지 않고 완료!내가 세션, 장치, 입력과 출력을 만들었지 만 한 AVFoundation
이것은
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
AVCaptureSession *session = [[AVCaptureSession alloc] init];
[session setSessionPreset:AVCaptureSessionPresetPhoto];
AVCaptureDevice *inputDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:inputDevice error:&error];
if ([session canAddInput:deviceInput]) {
[session addInput:deviceInput];
}
AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
[previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
CALayer *rootLayer = [[self view] layer];
[rootLayer setMasksToBounds:YES];
CGRect frame = self.view.frame;
[previewLayer setFrame:frame];
[rootLayer insertSublayer:previewLayer atIndex:0];
_movieFileOutput = [[AVCaptureMovieFileOutput alloc] init];
if ([session canAddOutput:movieFileOutput]) {
[session addOutput:movieFileOutput];
}
[session startRunning];
}
-(void)buttonClicked {
[_movieFileOutput startRecordingToOutputFileURL:url recordingDelegate:self];
}
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput
didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
fromConnections:(NSArray *)connections
error:(NSError *)error {
//This method is getting called when I press the button
NSLog(@"Finished Recording");
}
그래서 내 코드가 잘못된 것입니다 .. 내 코드? 나는 무엇이 있 었는가?
감사합니다.
AVCaptureSessionPresetPhoto – Andy