How to customize the controls over the camera in iphone using programming?
As there are two modes in camera, one is for taking photo and second in for recording movie, simply I want a view that does not have any recording control, and have some else option in that
How can I do that?
Help!
picker.showsCameraControls = NO;
picker.cameraOverlayView = someView;
Where someView is your custom UIView in which you design your own camera UI. UIImagePickerController class reference is a good place to get you started.
Related
I'm developing an application similar to Instagram iOS app. Instagram have a custom camera preview. I want to develop something similar and the question is - what to use better for this purpose - UIImagePickerController with custom cameraOverlayView property or should I use AVCaptureSession ? Maybe someone have such experience and can give me an advice. Will be appreciate.
AVCaptureSession is more customisable than UIImagePickerController. In case of speed, there is not much difference. If you are using AVCaptureSession it is possible to switch between whiteBalanceMode, focusMode and exposureMode when taking still images. Also we can specify the quality of the taking photo. In case of UIImagePickerController, the camera view will be presented and we can add overlay on it. But in case of AVCaptureSession, we can manage the camera as a normal view and add controls over it. So I think AVCaptureSession will be more suitable for your requirement.
The below link will give you more details about implementing AVCaptureSession.
https://developer.apple.com/library/prerelease/ios/samplecode/AVCam/Introduction/Intro.html
Is there any way to add overlay while I am recording a Video so that when I will play the video from camera roll I can see the overlay.
easy
create a view:
UIView * tempView = [UIView alloc]initWithFrame...
then ADD AS SUBVIEW to your "camera ViewController":
playerViewController
cameraViewController
(or any view you are using)
for example:
[self.playerViewController addSubView:tempView];
done √
If you want to add overlays on a recorded video, please check out this tutorial by Ray Wenderlich:
http://www.raywenderlich.com/30200/avfoundation-tutorial-adding-overlays-and-animations-to-videos
If you also want the overlay to appear during the recording of the video, you would have to add the overlay as a subview to the UIImagePickerController's cameraOverlayView. Take a look at this tutorial to see more: http://www.musicalgeometry.com/?p=821
I'm finding it difficult to search for this, background video searches for iOS typically refer to multitasking and switching apps with video.
I want to know if it's possible to have a video playing full screen without movie player controls, while displaying another view on top of that with logo, buttons, text, etc...
So,
Background: 15 second video loop -
Foreground: login / signup buttons, logo, etc...
There are a number of options, but the simplest will be to use a MPMoviePlayerController, with its repeatMode property set to loop forever, and its controlStyle set to none. That will give you a view with a looped movie with no controls that you can use as a background by adding it to your view hierarchy.
OP here - I was able to display a video full screen using this code (in viewDidLoad):
(don't forget to substantiate player as a property with MPMoviePlayerController *player;)
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:#"videoname" ofType:#"m4v"]]];
[player.view setFrame: self.view.bounds];
player.repeatMode = MPMovieRepeatModeOne;
player.controlStyle = MPMovieControlStyleNone;
[myView addSubview:player.view];
[player play];
And that worked fine - it displays a video fullscreen without video controls. What I had a problem with was displaying buttons and graphics above that. Even though my view hierarchy had the player.view seemingly behind my view with buttons, I couldn't get the buttons to appear.
I fixed that by adding in:
[player.view addSubview:overlayView];
Just set the layer you intend to display above the video to an IBOutlet and then use the video view to add that view (overlayView in this case) as a subview.
I actually prefer a way that is portrayed in this tutorial
basically the idea is to create a gif of your video, crop it to iPhone Screen size and load it into an un-interactive UIWebView. I believe this will get the job done if you don't need any audio, and it's basically done effortlessly.
I hope it helps you =)
I have a UIImagePickerController that is used to upload images to a database. It loads photos from two sources, the camera and the camera roll. When I load the photo from the camera it allows me to take a photo and select if I want to retake the photo or use it. When I load the photos from the camera roll I can select what photo library I want to use but only get a tiled preview of all photos in the library. When I click on the tiled photo preview it gets loaded to the database automatically with no full preview. How can I make it so that when I load a photo from the camera roll it allows me to preview the image before using it in a similar fashion to how it loads from the camera? Here is the coe that I use to specify the UIImagePickerController type, data source and initial settings.
UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
imgPicker.delegate = self;
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:imgPicker animated:YES completion:nil];
You have two options:
You can use the allowsEditing property, set it to YES and the final step will be a “preview” of the picked photo. Of course the user can move and scale the photo from that preview, so maybe this is not what you want.
Code your own preview. It will be a simple view controller that you will push into the UIImagePickerController when the user chooses a photo from the gallery. The simplest solution will be just an UIImageView covering all the screen, and two buttons in the navigation bar to choose another photo or choose the previewed one.
Hey thanks for all the help! I ended up using the third party libraries described here: https://github.com/gekitz/GKImagePicker. The GKImagePicker libraries allow you to easily define an editable and scalable area in the same manner as the allowsEditing does.
How can I avoid the "Preview" window displayed to a user using an image picker regardless of the editing property? I just want to save the photo directly to the Camera Roll, and then allow the user to continue taking pictures. Thanks.
Best solution is to switch to a AVCaptureDevice approach
Try imagePicker.allowsEditing = NO; to disable cropping before your app gets the image back.
Try this:
picker.showsCameraControls = NO;