Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera with Custom View

My Application uses camera, I would like to add overlay over the camera preview. For example, I want to use a picture frame when I use Camera, also I would like to add a custom bar for camera operations. Kindly help me to do the same.

like image 599
cyclingIsBetter Avatar asked Oct 03 '11 18:10

cyclingIsBetter


People also ask

How do I open the front camera in IOS Swift?

The devices() method of AVCapture returns the list of cameras available. From that list of the camera, we'll use the filter function in which we'll check if the position is a camera in front or not. We can convert this to a function and use the front camera.


1 Answers

You might be trying using UIImagePickerController. But I know this one solution to your problem. You can do it easily using AVCamCaptureManager and AVCamRecorder classes. Apple has a demo program build on its developer site here. It is named AVCam. In simple words what it does is when you click to open the camera, it calls the classes and methods which are responsible for opening the iPhone's camera and record video or capture audio. It calls the same classes which are called by UIImagePickerController. So your camera will open and start taking input.

Now, if you open the xib file of that AVCam project, you'll find a small UIView object. This view is responsible for displaying the camera's feed. You can resize that view as per the size you want and the camera's input will be displayed in that much area. You can also put the frame image around it as per your choice.

It worked for me when I wanted to resize the camera's input feed and capture photos. I hope it works for you as well.

like image 53
Dip Dhingani Avatar answered Oct 02 '22 14:10

Dip Dhingani