Home:ALL Converter>Wrapping AVCam demo from WWDC 2010

Wrapping AVCam demo from WWDC 2010

Ask Time:2011-05-08T01:49:16         Author:Sam

Json Formatter

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

Author:Sam,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/5922923/wrapping-avcam-demo-from-wwdc-2010
yy