开发者

Wrapping AVCam demo from WWDC 2010

开发者 https://www.devze.com 2023-03-03 09:57 出处:网络
I have three camera-based apps (that take still pictures) in the app-store and have got feedback that the UIImagePickerController interface is very slow - and I can\'t deny that.So, to improve the per

I have three camera-based apps (that take still pictures) in the app-store and have got feedback that the UIImagePickerController interface is very slow - and I can't deny that. So, to improve the performance of the app, I started to experiment with the AVCam Demo source code from the WWDC 2010.

Since the AVFoundation framework does not interact with the UI Kit, I have been successful at wrapping a view around the demo. I am able to transition between the view controllers successfully. The only thing that I've modified is replaced the Record button with the Exit button (to exit to the wrapping view controller)

The modified app works fine during the first session (wrapper -> demo) If I exit the demo to the wrapper, and come back to the demo second time , the video frame in the preview layer freezes a second or two after. The app itself does not freeze - just the video is frozen. At this point, all UI buttons are active. But, when I tap "Still" button to capture the image, I get the following error in an alert:

The operation cannot be completed (AVFoundationErrorDomain error - 11800.)

This cannot be duplicated in the original 开发者_Go百科demo code - because you can't close and reopen the session. So, I am wondering if it has anything to do with the way I "exit" from the session in my test. Here's the "exit" action that I added in the demo code:

- (IBAction)exit:(id)sender
{
    [[self captureManager] stopRecording];
    [self dismissModalViewControllerAnimated:YES];
}

Is this sufficient - or did I miss something?

Regards, Sam.


There's a little problem of cleaning up a capture session in an orderly fashion, as there's some asynchroneous calls with no alerts of when they're done.

Try stopping and releasing as suggested in this question: How to properly release an AVCaptureSession (take the solution with most up votes)

If that doesn't help you may need to post some more code here. Are you sure that's all you changed?

Good luck!

Oded.

0

精彩评论

暂无评论...
验证码 换一张
取 消