Closed likecarson closed 2 months ago
What does inverted mean? Please attach a sample video.
Here is a screen recording using the Android Pixel 6 Pro API 34 emulator. The same happens on physical device:
Okay, this is a CameraX bug then, nothing I am doing explicitly - could you create a bug report in the Google CameraX issue tracker about this? Thanks!
@mrousavy I think I figured out the issue -- at least doing this change fixes it for me:
In this file: node_modules/react-native-vision-camera/android/src/main/java/com/mrousavy/camera/core/CameraSession.kt
I commented out line 308: val video = VideoCapture.Builder(recorder).also { video -> // Configure Video Output // video.setMirrorMode(MirrorMode.MIRROR_MODE_ON_FRONT_ONLY)
And the issue was resolved. I think this is because in my use case, the recording starts using the back camera and the CameraX must set a certain orientation, and when I switch to Front camera during the same recording the orientation is not updated to relative to Front camera, so mirrorMode causes the inversion.
I'm not sure if there is a way to adjust the code to check if the orientation is correct before applying the setMirrorMode or maybe this is the desired behavior just an issue with CameraX as you say.
Thanks.
Hey - I think I fixed this issue in the latest releases. I update orientation immediately after switching devices. Can you confirm if that works for you?
Hi Marc,
Yes the latest version seems to be working now! No more inverted selfie videos on Android.
I appreciate your follow up and all the work you are doing for this great package.
Thanks, Carson
On Wed, Jul 10, 2024 at 8:17 AM Marc Rousavy @.***> wrote:
Hey - I think I fixed this issue in the latest releases. I update orientation immediately after switching devices. Can you confirm if that works for you?
— Reply to this email directly, view it on GitHub https://github.com/mrousavy/react-native-vision-camera/issues/2854#issuecomment-2220360780, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDDN2OQZNIOHYOC43ADQHIDZLUQ6LAVCNFSM6AAAAABHLQAYRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRQGM3DANZYGA . You are receiving this because you authored the thread.Message ID: @.***>
Awesome thank you. If you appreciate my work and dedication please consider sponsoring me on GitHub :)
What's happening?
On an Android device, while taking a video recording with the Back camera started, if user switches to Front camera during the same recording the Front video recording becomes inverted -- it looks okay during the recording session but the saved video recording of the Front camera is inverted (upside-down).
Interestingly, if I start the recording using the Front camera then switch to Back camera the recording of the Front video is fine.
Reproduceable Code
Relevant log output
Camera Device
Device
Android Pixel 6 Pro API 34 (emulator), Pixel 5 API 34 (physical device)
VisionCamera Version
4.0.3
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (⚠️ your issue might get ignored & closed if you don't try this)
Additional information