0
어떤 비디오 미리보기를 가져올 수 없습니다
내가 설정 내 AVCaptureSession
과 같이 : 내보기로 미리보기 레이어를 추가 한 후가 AVCaptureSession
AVCaptureSession *newSession = [[AVCaptureSession alloc] init];
AVCaptureDevice *camera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
AVCaptureDeviceInput *newInput = [[AVCaptureDeviceInput alloc] initWithDevice:camera error:&error];
if(error) {
NSLog([error localizedDescription]);
}
AVCaptureMovieFileOutput *newOutput = [[AVCaptureMovieFileOutput alloc] init];
if([newSession canAddInput:newInput])
[newSession addInput:newInput];
if ([newSession canAddOutput:newOutput])
[newSession addOutput:newOutput];
[self setSession:newSession];
[self setInput:newInput];
[self setOutput:newOutput];
그리고 :
AVCaptureVideoPreviewLayer *layer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:[recorder session]];
[layer setBounds:[recordingView bounds]];
[layer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
[[recordingView layer] insertSublayer:layer above:[recordingView layer]];
그러나 나는 늘 하나를 얻을 시사.
나는 아이팟 터치 4 창
감사와 IOS 5입니다.
'recordingView'는 제 'MainViewController' 내부의 UIView입니다. 변경되었지만 수정하지 못했습니다 ... – tonekk
init 후에도 세션을 시작해야합니다. '[newSession startRunning]; ' – yinkou
글쎄, 그냥 복사하는 걸 깜빡 했어. 다른 곳에서 문제가 있다고 생각합니다 ... 다음은 전체 프로젝트입니다 (허용되는 경우 ...) : http://www21.zippyshare.com/v/26365272/file.html 그다지, 단지 5 개의 클래스 정도. – tonekk