In the iOS(9) camera app the controls overlay does not rotate but when 'Record' is selected the video is outputted with the correct orientation. Has anyone got any ideas how apple implemented this.
You've got a few different options to achieve the same effect:
You can rotate the camera, but keep the UI the same, when the device itself is rotated so that it matches UIDevice.currentDevice().orientation.
You could store the device orientation at the time of capture and then rotate the video afterwards.
You could even set the capture connection of the capture session to match the devices orientation while keeping the preview connection the same. Check this out for a similar question
I implemented exactly what you're looking for using 2 different UIWindow instances, one for the video preview layer and one for the UI to be displayed on top of it. The UIWindow with the UI needs to have a transparent background in order for the preview layer to remain visible.
Related
I would like to know the best way to handle the device orientation change while viewing a video like how it works in the YouTube app. In landscape, the video is full screen but when the user rotates to portrait the video is pinned to top of screen and a list of 'recommended' videos are listed below it. How can I achieve this? Any help would be greatly appreciated. Thanks in advance.
Youtube only takes care the orientation when rotation of device is unlock.
If you want to do like this, implement this function
(void)willAnimateRotationToInterfaceOrientation(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
to handle when orientation changes.
I currently have an app that displays the front facing camera atop a video preview layer. By default in iOS 9, the preview layer is interrupted/paused and will not resume until split-view is dismissed. Based on the nature of the app, maintaining the running camera preview layer while multitasking is essential.
Is there any way to force the capture session to continue previewing while in split view?
Update: Seems as if Apple does not allow any sort of camera use while the device has more than one application open. You can, however, invoke UIImagePickerController in order to take a photo while in split-view. Of course this solution only allows you to snap a single photo, and nothing more. Hope this helps someone!
I have an UIImagePickerController and want to know, when a user changes from the back to front camera (and back)?
Is it possible to get this information?
As second part.
After taking a picture UIImagePickerController shows a preview with (Retake and Use Photo Buttons). Is it possible to detect when this view is shown?
You can write your own camera overlay view to have total control over the camera switching and preview behavior. Without a custom camera overlay view, I think you're limited to just receiving the user's final choice in the UIImagePickerControllerDelegate callback.
Is there a way to find out if the camera is currently focusing with UIImagePicker? Similar to the way the adjustingFocus observer works with AVFoundation.
I'm currently using AVFoundation, but I would like to be able to have the image quality that is achieved with UIImagePicker.
Thanks!
You need to define your exact requirement here - what is that you want adjusting focus observer for? As the name suggests, it is a way to signal you that AVCaptureDevice (reference to "real" device - one of these devices) is adjusting its focus. UIImagePicker is nothing but a file open dialog, not a real device. It works on top of either camera or static list of image files. While in camera mode, you can observe adjustingFocus.
In case that is your requirement, here is nearest you can refer to.
Refer to UIImagePickerController documentation to define how you can implement this for your own needs.
I'm working on an app that does full screen captures, but have a need to have a control view be visible at the same time. I'd like to be able to do the screen capture without capturing the view, however. I'm recording screen activity to a .mov file, not doing discrete screenshots.
I'm using AVCaptureScreenInput and successfully doing my screen captures. I realize this is an open-ended question (apologies!) but I'm not sure where to begin searching for the answer.
Is there a property of UIView's that can be applied?