I need to straight up the image taken by custom camera capture view but with physical device rotation block enabled it seem impossible.
physical device rotation block
UIDevice.current.orientation works only with device rotation "unlocked". Someone can help me with this tedious bug? Thanks.
Unfortunately there is no way to unlock rotation while physical block enabled, but you can turn landscape mode as your main in project settings
landscape mode as main
Related
This is regarding image orientation when captured with the device rotation lock on.'
self.photoOutput.connection(with: AVMediaType.video)?.videoOrientation = self.stillImageOrientation
I have self.stillImageOrientation listening to status bar orientation
UIApplication.shared.statusBarOrientation
However, when the user activates device rotation lock and rotates the device, captured photos get saved in the wrong orientation.
I expected this might solve the issue:
UIDevice.current.orientation
That also stops changing after the device rotation lock.
I noticed the native camera app still registers proper orientation even after the device rotation lock. Is there a way to achieve this?
I have an iOS app that only supports portrait. When rotating the device the video captured by the RTCCameraVideoCapturer (WebRTC) rotates to landscape orientation, even when the rest of the UI stays in portrait. How to avoid this?
Do you have access to RTCCameraVideoCapturer codebases ? Also, I am not sure which version of the WebRTC codebases you are working with. And, in your application ; is landscape mode is the only mode that you are intending to support ?
There should be rotation calculation method that listen to rotation changes. You can just disabled it, or can use your preferred fixed set of rotation in spite of default.
For example, taking from this sample codebase ; you can just only use RTCVideoRotation_90 to have landscape orientation only.
Today I was surprised by a feature of camera in apple when I rotate device to landscape mode icons were also rotated in landscape mode, Although the Automatic rotation was off for my device, How it can happen?
If default device rotation is off then how can camera app know that device orientation is changed?
I double checked my phones settings of Auto-Rotation and they were off.
The device-orientation setting is ignored for the camera. This was done so that people can keep orientation-lock on and take landscape photos at the same time, without having to constantly change the setting.
So I have an app that needs to not use autorotate. Instead of rotating the screen the buttons on the screen are just supposed to rotate.
I have the interface locked in landscape left. How do I detect what rotation the buttons should be?
I am using a custom opengl engine so I can set the rotation of objects.
You can get the device orientation from:
UIDevice.orientation
This is not the interface orientation, so you get two more possible values for face up and face down. Also the landscape left and right are swapped compared to UIInterfaceOrientation.
You can listen for changes in device orientation by subscribing to the UIDeviceOrientationDidChange notification from NSNotificationCenter. You may have to enable these notifications by calling UIDevice.beginGeneratingDeviceOrientationNotifications().
If the interface orientation is locked on the device, it is not listening to any delegate methods related to orientation changes.
I can receive UIDeviceOrientationDidChangeNotification event, if auto-rotation is set.
But when screen auto rotation is disable, orientation notification doesn't work any more.
The effect I want to achieve is as iPhone Camera and Camera+: whatever the user lock or not lock the screen rotation, application can correspond to the rotation change immediately and correctly.
Does anyone has any idea why notification not sent when user lock the screen rotation?
How could I correspond to the device orientation change even if auto-rotation is disabled?
I also want to get the effect of the Camera app, where the app detects the orientation of the device even if the user has set Portrait Orientation Locked. UIDeviceOrientationDidChangeNotification is not posted when the user has portrait orientation locked. I believe the only way to determine the orientation of the device when the user has locked the orientation to portrait is to manually work out the orientation using UIAccelerometer.
The list of questions & answers below are all related to this issue. I found them when I was searching for an answer, and you might find them helpful too.
Related questions:
How to detect Camera Overlay view rotation
How to do Orientation Detection even the device has locked orientation
Detect iOS device orientation lock
Detect iPhone screen orientation
Callback method on auto rotation, iOS and iPad