-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support orientation change on iOS #2643
base: main
Are you sure you want to change the base?
feat: Support orientation change on iOS #2643
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
e704c65
to
71d2c63
Compare
09699a9
to
c6cdcc2
Compare
c6cdcc2
to
b4d0133
Compare
db49ab9
to
6b71d4f
Compare
Thanks for your PR, but I wonder why you didn't use the react-native-vision-camera/package/ios/Extensions/AVCaptureOutput+mirror.swift Lines 24 to 58 in 6b71d4f
Is that different from your code? |
@mrousavy I did that as a first try ! The issue that I encountered is that it's updating the output. In the case of a phone. Basically, that would be good for tablet, but not for phones or locked tablets. Here, I feel that we really want something "UI wise". Which is : does the camera feed orientation follows the UI orientation or not. So the difference that I see is that the piece of code you highlighted apply to the output (AVCaptureOuput) of the photo capture. Which I don't think this is always what we want. Because the input (camera feed) and the output can be different. But the logic of this extension can be extracted somewhere else to be reused. |
This may be related. |
Hi, I am using react native v0.70.4 and react-native-vision-camera v2.16.2, I solved camera orientation for both iOS and Android. And I want to share this trick for everyone. Please follow below steps:
Hope this helps!! |
any update here ? cause I encountered the same problem, in version 3.9.1, if the app orientation is locked, the output of the camera is not the same as expected, just like @ldalzottomp said |
@IamHungry113 The changes in this PR were enough to cover the use case that I mentioned. So you can grab it and apply it to a local fork. My public fork is here (https://github.com/ldalzottomp/react-native-vision-camera). However there is build issue regarding older iOS version. If your app don't target iOS lower than the requested verion, you can add if conditions to prevent build errors. I discussed with @mrousavy about this PR and this is not going to be merged as the video feed/frame processor have not been thoroughly tested. |
Thank you, this fixed my problem. |
What
While integrating the react-native-vision-camera library in our application, we stumbled upon an issue.
When rotating the device, the camera feed were not folloing the interface orientation.
Changes
I tried to add support for auto orientation on iOS by listening to the orientation change notification.
Then, update the connection input orientations based on UI interface orientation.
I also updated the input orientation on session start.
I have tried to integrate this feature as close as possible as the current architecture. As I am not familiar with camera and your project, feel free to tell me what to change.
I did not observed the initial faulty behaviour on different Android devices.
Before :
before_compressed.mov
After : I entered in the device home screen at some point
after_compressed.mov
Tested on
iPad Pro (11-inch) (2nd generation). With both orientation locked screen and unlocked.
iPhone 11. No orientation change as the UI is orientation locked.
Related issues