I'm working on a project and we would like to be able to record a UIView
. The idea I had and implemented would be to take continuous screen shots and store them on disc and then after the UIView
is done combine all the images to make a movie. Right now I'm using UIImage
to combine and make a movie. This seems like a pretty slow process and I've read some things online, like RecordMyScreen project, but that uses private APIs like IOSurface and so on. I'm just wondering if theres a quick way to take screen shots. I would require to take about 25 a second. Right now I'm doing something like this:
UIGraphicsBeginImageContextWithOptions(self.captureView.frame.size, YES, 0.0);
// CGContextRef context = UIGraphicsGetCurrentContext();
// [self.captureView.layer renderInContext:context];
[self.captureView drawViewHierarchyInRect:weakSelf.captureView.bounds afterScreenUpdates:YES];
UIImage* screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSLog(@"saving image");
[self saveImageToFolder:self.tempFolderPath image:screenShot];
this is in an NSOperationBlock
to be performed in the background. Saving to disc is also done on another thread.
I know that AVAssetWriterInputPixelBufferAdaptor
takes CVPixelBufferRef
to create the movie so I'm not sure if theres a way to get that directly from the UIView
?
Anyway any help would be great!
Thanks