react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

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

Open gauravrana0-nagarro opened this issue 1 year ago • 9 comments

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

gauravrana0-nagarro avatar Jun 24 '24 10:06 gauravrana0-nagarro

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.

maintenance-hans[bot] avatar Jun 24 '24 10:06 maintenance-hans[bot]

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

SonuGitCfcs avatar Jun 24 '24 10:06 SonuGitCfcs

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

gauravrana0-nagarro avatar Jun 24 '24 13:06 gauravrana0-nagarro

I have same issue on IOS

Marius-Adam avatar Jul 06 '24 17:07 Marius-Adam

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

gabrielbull avatar Jul 11 '24 13:07 gabrielbull

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

jkaufman avatar Jul 11 '24 15:07 jkaufman

Set outputOrientation="preview", that should work.

mrousavy avatar Jul 11 '24 16:07 mrousavy

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

Anahita-Fakhravar avatar Jul 12 '24 07:07 Anahita-Fakhravar

same here

mannoeu avatar Aug 30 '24 14:08 mannoeu

same issue

duonghungit24 avatar Nov 20 '24 09:11 duonghungit24

Set outputOrientation="preview", that should work.

not working, please support me

duonghungit24 avatar Nov 20 '24 09:11 duonghungit24