비디오 캡처 및 저장 기능이있는 앱을 만들었습니다. 저는 AVFoundation을 사용했고 Apple's AVCam은 제 가이드입니다.AVFoundation이있는 카메라 스위치에서 비디오가 동결됩니다.
는 나는 그것을 명확하게 할 수 있기를 바랍니다 : 나는 (AVCamViewController 될 것이라고 AVCam에서) 처음 AVCamCaptureManager을 처리하는 videoViewController을 해제 할 때까지
모든 것이 잘 작동합니다. 그런 다음 다시 만들면 카메라 전환 직후에 비디오가 정지됩니다. 다시 실행해도 도움이되지 않거나 치료 또는 기기 재설정이되지 않습니다. (때때로 사물 중 하나가 도움이되지만 그것은 규칙이 아닙니다.)
메모리를 절약 할 필요가 없을 때 videoViewController를 출시했습니다.
코드 카메라를 전환하는 것은 기본적으로 AVCam와 동일하다를 위해 : 나는 단순히 떠날 것입니다
[self.videoViewController.view removeFromSuperview];
self.videoViewController = nil;
내 현재의 "해결 방법"VideoView를 지켜 보면서을 기각있는
NSError *error;
AVCaptureDeviceInput *newVideoInput;
AVCaptureDevicePosition position = currentVideoInput.device.position;
if (position == AVCaptureDevicePositionBack)
newVideoInput = [[AVCaptureDeviceInput alloc] initWithDevice:frontFacingCamera error:&error];
else if (position == AVCaptureDevicePositionFront)
newVideoInput = [[AVCaptureDeviceInput alloc] initWithDevice:backFacingCamera error:&error];
if (newVideoInput != nil) {
[session beginConfiguration];
[session removeInput:currentVideoInput];
if ([session canAddInput:newVideoInput]) {
[session addInput:newVideoInput];
[self setVideoInput:newVideoInput];
} else {
[session addInput:currentVideoInput];
}
[session commitConfiguration];
[newVideoInput release];
} else if (error) {
NSLog(@"%@",[error localizedDescription]);
}
코드, 심지어 내가 필요 없다면.
누군가 이런 일이 일어나는 이유와 해결 방법을 설명 할 수 있습니까?
편집 : 다이슨 W
[[[self.videoViewController captureManager] session] stopRunning];
[self.videoViewController.view removeFromSuperview];
self.videoViewController = nil;
감사 : 다이슨 W로
해결은 내가 지금처럼 내 videoViewController을 해제하기 전에 세션을 중지해야 자신의 응답 지적했다.
아니요, 오류 로그가 없습니다. 너는 무엇을 제안 하는가? AVCam (예, 1.2 사용)을 살펴본 후 -captureManager : didFailWithError :를 구현했지만 여전히 오류 로그가 없습니다. 앱이 카메라 주위에 가운데에 있지 않습니다. 카메라는 측면에있는 것이므로 일부 카메라에서는 전혀 사용하지 못할 수도 있습니다. AVCam을 다시 확인했습니다. 유일한 차이점은 AVCam에서 카메라가 항상 존재한다는 것입니다. 위에서 언급 한 이유 때문에 카메라를 닫고 싶습니다. – Reggian
내 업데이트 된 내용보기 –
프로젝트를 보지 않고 AVCam 프로젝트의 변경 사항을 보지 않으면이 작업이 까다 롭습니다. 또한, 분석기를 실행하여 무엇인가 잡는 지 확인하십시오. –