Last week I mentioned an excellent library for easier disk I/O from Andrew Sliwinski and earlier today I mentioned a helpful tutorial for anyone looking to do video capture and video editing with AVFoundation.
Since finding that tutorial I’ve come across another open source library by Andrew for that makes video recording using AVFoundation dead simple.
This library allows you to quickly set up a camera, start/stop recordings, check if the camera is in use, preview the recording and more with just a few lines of code.
To set up the camera you could do something like this taken from the example:
cam = [[DIYCam alloc] init];
[[self cam] setDelegate:self];
[[self cam] setup];
// Preview
cam.preview.frame = display.frame;
[display.layer addSublayer:cam.preview];
CGRect bounds = display.layer.bounds;
cam.preview.bounds = bounds;
cam.preview.position = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
and start the capture with:
You can find the library on Github here with further documentation.
Definitely a library to keep handy in case you ever want to drop video recording into an app and don’t want to go through the pain of learning to use AVFoundation yourself.
via @romainbriche





