Skip to content

Instantly share code, notes, and snippets.

@cloudwalking
Created December 2, 2014 00:11
Show Gist options
  • Save cloudwalking/f93d21200f88d2b82873 to your computer and use it in GitHub Desktop.
Save cloudwalking/f93d21200f88d2b82873 to your computer and use it in GitHub Desktop.
UIView *videoView = [[UIView alloc] init];
...
AVCaptureSession *session = [[AVCaptureSession alloc] init];
AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
previewLayer.frame = videoView.bounds;
[videoView.layer addSublayer:previewLayer];
[session startRunning];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment