Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
331 views
in Technique[技术] by (71.8m points)

iphone - recored video using UIImagePickerController

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...