Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

embed live camera view inside a UIView

I've been trying to figure out how to embed a small(ish) live camera view inside of an iPhone's UIView to no avail.
I have not even been able to find any samples of that on the net either. I know that it's do-able, but I don't even know where to start. There seem to be a lot of examples where others have added views TO the full-blown screen view of the camera, but not the other way around...

It seems that UIImagePickerControllerSourceTypeCamera just displays the BIG modal camera viewer, picture taker, so it is unsuitable (I think) for my purposes.

I want to have a small live camera view, inside a UIView, and I can add my own buttons for taking the pic (I can probably figure this out - a delegate of some sort to capture the image)

Thank you...

like image 421
geekyaleks Avatar asked Aug 29 '11 20:08

geekyaleks


1 Answers

For your purpose you need to use AVFoundation, specifically look at AVCaptureSession , AVCaptureDeviceInput, which you can use in order to get access to the cameras and look into AVCaptureVideoPreviewLayer which will allow you to draw the camera input to the screen, everything you need is in there..

like image 113
Daniel Avatar answered Sep 28 '22 18:09

Daniel