Record a Video in a UIView and save it to Camera Roll - IOS
#import "ViewController.h" #define CAPTURE_FRAMES_PER_SECOND 20 @interface ViewController () @end @implementation ViewController - ( void )viewDidLoad { [ super viewDidLoad ]; recording = NO ; [ self initializeCamera ]; } //AVCaptureSession to show live video feed in view - ( void )initializeCamera { captureSession = [[ AVCaptureSession alloc ] init ]; captureSession . sessionPreset = AVCaptureSessionPresetHigh ; _previewLayer = [[ AVCaptureVideoPreviewLayer alloc ] initWithSession : captureSession ]; [ _previewLayer setVideoGravity : AVLayerVideoGravityResizeAspectFill ]; _previewLayer . frame = self . imagePreview . bounds ; [ self . imagePreview . layer addSublayer : _previewLayer ]; UIView *view = [ self imagePreview ]; CALayer *viewLayer = [view layer ]; [viewLayer setMasksToBounds : YES ]; CGRect bounds = [vie