UIImagePickerController - Camera not ready
I'm developing an iPhone app that records video. I create a UIImagePickerController, limit it to video recording then programatically ask the camera to startVideoCapture. Unfortunatly when I run the app I get the following in the console;
"UIImagePickerController: ignoring request to start video capture; camera is not yet ready."
Obviously the iPhone is not done setting things up.
Is there a way that I can check the setup process has completed before 开发者_运维技巧starting to record?
Many thanks in advance.
Rich
startVideoCapture should return NO when it can't record. You can check that if needed.
UIImagePickerController *picker;
Check if camera is ready or NOT !
I have same button for star and stop hence a bool cameraIsOn
if ([UIImagePickerController isCameraDeviceAvailable:[picker cameraDevice]]) {
if (cameraIsOn) {
NSLog(@"stop camera");
[picker stopVideoCapture];
cameraIsOn = FALSE;
}
else {
NSLog(@"start camera");
[picker startVideoCapture];
self.videoTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(changeValue) userInfo:nil repeats:YES];
cameraIsOn = TRUE;
}
}
精彩评论