main.swift3439 chars95 lines
This code uses an AVCaptureSession to capture frames from the camera and an AVAssetWriter to write those frames to file. The startCapture method sets a capturing flag to true, waits for 3 seconds, and then starts writing frames to file. The stopCapture method sets the capturing flag to false, finishes writing frames to file, and calls a completion block. The captureOutput method is an AVCaptureVideoDataOutputSampleBufferDelegate method that gets called whenever a new frame is captured. It checks if capturing is true and if so, starts writing frames to file.
gistlibby LogSnag