소셜 네트워킹 응용 프로그램에서 프로필 이미지를 업로드하는 데 사용할 수있는 UIImagePickerController
이 있습니다.활성 AVSession이있을 때 UIImagePickerController가 느림
혼자서 사용하면 다른 카메라끼리 간섭하지 않아도 잘 작동합니다.
다른보기에서 카메라보기를보기에 포함하려면 AVCaptureSession
및 AVCaptureVideoPreviewLayer
을 사용하고 있습니다. 여기에서 사용자는 캡처 한 다양한 사진을 업로드 할 수 있습니다.
이 기능은 단독으로 사용할 때, 즉 다른 카메라 간섭이없는 경우에도 정상적으로 작동합니다.
AVCapturePreviewLayer
가 활성화되어, 나는이 UIImagePickerController
와보기를 입력 할 때마다 imagePicker로드하는 데 시간이 오래 걸리고, 때로는 그냥 정지 (이것은 탭 바 응용 프로그램입니다).
이 내가 초기화 방법입니다 AVSession/AVCapturePreviewLayer
:
self.session = [[AVCaptureSession alloc] init];
self.session.sessionPreset = AVCaptureSessionPreset640x480;
self.captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.session];
self.captureVideoPreviewLayer.frame = self.cameraView.bounds;
[self.captureVideoPreviewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
[self.cameraView.layer addSublayer:self.captureVideoPreviewLayer];
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (!input) {
// Handle the error appropriately.
NSLog(@"ERROR: trying to open camera: %@", error);
}else
[self.session addInput:input];
self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys: AVVideoCodecJPEG, AVVideoCodecKey, nil];
[self.stillImageOutput setOutputSettings:outputSettings];
[self.session addOutput:self.stillImageOutput];
이 내가 초기화 방법입니다 UIImagePickerController
:
self.picker = [[UIImagePickerController alloc] init];
self.picker.delegate = self;
self.picker.allowsEditing = YES;
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:self.picker animated:YES completion:NULL];
UIImagePickerController
가 previewLayer가에서 활성화 될 때로드 영원히 걸립니까 왜
- 다른보기?
UIImagePickerController
의 로딩 시간은 어떻게 줄일 수 있습니까?