mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.25k stars 1.06k forks source link

🐛 outputOrientation not working in android but working properly in iOS. #3016

Open gauravrana0-nagarro opened 2 months ago

gauravrana0-nagarro commented 2 months ago

version 4

https://github.com/mrousavy/react-native-vision-camera/assets/125337945/8d538c30-a779-4067-8d1e-545bc53638d2

version 2 https://github.com/mrousavy/react-native-vision-camera/assets/125337945/e1bccae7-a526-4d8b-b690-c6c15756388e

What's happening?

in version 4.3.2 if I add outputOrientation = landscape-right prop it always takes images in the landscape mode in android but in version 2 it used to convert landscape-right image to portrait. It is working same as in v2 in iOS

Reproduceable Code

<Camera
                ref={camera}
                style={StyleSheet.absoluteFill}
                device={device}
                outputOrientation="landscape-right"
                isActive={isFocused}
                photo={true}
                onError={onError}></Camera>

Relevant log output

06-24 15:53:09.953  6318 23920 I CameraLightSensor_Service: Open camera failed: error 2
06-24 15:53:09.953  6318 23920 I CameraLightSensor_Service: stopTask called, isCameraStopPending : false
06-24 15:53:09.954  6318 23920 I CameraLightSensor_Service: stopBackgroundThread : mBackgroundHandler is set to null
06-24 15:53:10.240  5362  5760 D NetdEventListenerService: DNS Requested by : 100, 10716, 0
06-24 15:53:10.468  5166 23637 E Camera2-FrameProcessorBase: FrameProcessorBase: Error waiting for new frames: Connection timed out (-110)
06-24 15:53:10.506  9219 10881 I SDHMS:C : SIOP:: AP:418(472,80) BAT:386(386,0) USB:0(0,0) CHG:458(458,0) WIFI:433(433,0) LRP:432(432,0) LRF:418(418) LRB:432(432) 
06-24 15:53:10.867  5026 23840 I ExynosCameraFrameManager: [CAM(0)][RUNNING FRAME WORKER]-(workerMain[983]): wait and pop fail, ret(-110)
06-24 15:53:11.028 18022 18053 I .msil.truevalu: Background young concurrent copying GC freed 338042(19MB) AllocSpace objects, 230(4600KB) LOS objects, 34% free, 45MB/69MB, paused 694us,121us total 104.740ms
06-24 15:53:11.494  5362  9315 I EDMNativeHelperService: isCameraEnabled
06-24 15:53:11.494  5362  9315 D EDMNativeHelper: isCameraEnabled
06-24 15:53:11.497  5362  9315 D EDMNativeHelper: checking for camera in EnterpriseDeviceManagerService
06-24 15:53:11.497  5362  9315 D EnterpriseDeviceManagerService: isCameraEnabledNative
06-24 15:53:11.497  5362  9315 D EnterpriseDeviceManagerService: checking for camera in restr

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "limited",
  "maxZoom": 8,
  "minZoom": 1,
  "maxExposure": 20,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": false,
  "minFocusDistance": 10,
  "minExposure": -20,
  "name": "0 (BACK) androidx.camera.camera2",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",

Device

samsung m21

VisionCamera Version

4.3.1

Can you reproduce this issue in the VisionCamera Example app?

Yes (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

maintenance-hans[bot] commented 2 months ago

Guten Tag, Hans here.

[!NOTE] New features, bugfixes, updates and other improvements are all handled mostly by @mrousavy in his free time. To support @mrousavy, please consider 💖 sponsoring him on GitHub 💖. Sponsored issues will be prioritized.

SonuGitCfcs commented 2 months ago

same issue on Redmi Note 7 Pro device & Some Samsung device

gauravrana0-nagarro commented 2 months ago

I just installed shadow lens app on my android device. the same issue is in Shadow Lens app also. It stores image in landscape mode if clicked closely and in portrait if clicked from some distance. In v2 the landscape image also got rotated to portrait in landscape-right orientation. In v4 it is not the same. NOTE: device orientation is locked to portrait

Marius-Adam commented 2 months ago

I have same issue on IOS

gabrielbull commented 1 month ago

We're also experiencing this issue on at least these devices:

-Realme C21-Y, Android Version 11 -Vivo Y27s, Android Version 14

@mrousavy, I believe this bug was introduced in version 4 as well as we didn't have it before.

https://github.com/mrousavy/react-native-vision-camera/assets/671923/687f635f-683a-4719-9d83-343abd3bf0d1

jkaufman commented 1 month ago

The ability to set outputOrientation to a specific orientation was removed.

mrousavy commented 1 month ago

Set outputOrientation="preview", that should work.

Anahita-Fakhravar commented 1 month ago

Hi @mrousavy, I tried your solution, but I'm still having issues. After taking a photo, the image preview orientation is correct, but when I save it to the device gallery, it appears sideways. This only happens with pictures taken using the front camera. Any suggestions? Thanks! Lib version: 4.4.2 (latest) Device: Samsung Galaxy A32

mannoeu commented 1 week ago

same here