recored video using UIImagePickerController

二次信任 提交于 2019-12-17 19:25:18

问题


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."

how can i handle this?


回答1:


The most probable reason seems to be the absence of the required key in your info.plist file. You will need to configure UIRequiredDeviceCapabilities. Also, you must implement the delegate object. For details, have a look at http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/TakingPicturesAndMovies.html#//apple_ref/doc/uid/TP40010406.

HTH,

Akshay




回答2:


There is no delegate callback that tells you when the camera is ready. I tried this but no luck, still your error:

if ([UIImagePickerController isCameraDeviceAvailable:[picker cameraDevice]]) {
                [picker takePicture];
}
else {
     NSLog(@"Camera not ready");
}

I called take picture after delay of 1.0, 1.5, 2.0 seconds. My observations:

At 1.0 secs: takes the picture but the full shutter closing is not seen on the screen At 1.5 secs: shutter closing is seen but very little At 2.0 secs: loads the camera, shows whats on the screen and then takes the picture.

So you might wanna use something between 1.75 to 2.25. Code i used:

[picker performSelector:@selector(takePicture) withObject:nil afterDelay:2.0];


来源:https://stackoverflow.com/questions/6817920/recored-video-using-uiimagepickercontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!