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

Camera is not loading on certain devices.

Open xtl-geiger opened this issue 3 years ago β€’ 11 comments

What were you trying to do?

The Camera is working fine on most devices. However, there are a few on which it just won't work. The camera will simply try to load and stay black.

Samsung S22 Ultra | SM-S908B | Android 13 Huawei | MAR-LX1B | Android 10

It might be related to https://github.com/mrousavy/react-native-vision-camera/issues/238

Sadly, I have no logs seeing as I do not own the phones mentioned and have no access to these phones, yet.

What happened instead?

The camera did not load correctly.

Device

As mentioned above

VisionCamera Version

2.15.2

Additional information

xtl-geiger avatar Jan 11 '23 09:01 xtl-geiger

Try disabling frame processors. Also, see which device and formats it’s using. I can confirm that it works on the S22 ultra.

hocaltar avatar Jan 11 '23 20:01 hocaltar

@xtl-geiger are you rendering it inside Modal?

ManarHussein avatar Jan 31 '23 13:01 ManarHussein

I was using useCameraDevices('wide-angle-camera') and it is returning only front camera on S22 Ultra, other ones are undefined. So @xtl-geiger maybe it is the same case for you? useCameraDevices() solves it for me

EwaGuziejko avatar Feb 08 '23 09:02 EwaGuziejko

Try disabling frame processors. Also, see which device and formats it’s using. I can confirm that it works on the S22 ultra.

@hocaltar What camera device and format are you using?

powerpivar avatar Feb 27 '23 13:02 powerpivar

I was using useCameraDevices('wide-angle-camera') and it is returning only front camera on S22 Ultra, other ones are undefined. So @xtl-geiger maybe it is the same case for you? useCameraDevices() solves it for me

Same on S23 Ultra

OtayNacef avatar May 27 '23 12:05 OtayNacef

Try this https://www.youtube.com/playlist?list=PLQhQEGkwKZUrempLnmxjt7ZCZJu1W3p2i

myselfuser1 avatar Jun 12 '23 03:06 myselfuser1

@ManarHussein hey! I have the same issue and I am rendering the camera view in a modal. Mine works fine for other android devices, but we have this problem with the Xiaomi Redmi 9A, Android Version 10. If you click on the camera, it just shows a loader and nothing else. I'm also using useCameraDevices() but I don't pass anything. Also, for the modal, I implemented this hook: = gestureHandlerRootHOC() because otherwise it wasn't zooming. Any thoughts?

tatianavazquez avatar Jun 18 '23 21:06 tatianavazquez

We have the exact same issue with Android 13, Xiaomi POCO X4 Pro 5G, using const devices = useCameraDevices('wide-angle-camera')

cervebar avatar Jul 10 '23 14:07 cervebar

To resolve the problem, you can simply remove the 'wide-angle-camera' parameter, like this: const devices = useCameraDevices();

OtayNacef avatar Jul 16 '23 19:07 OtayNacef

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: https://github.com/mrousavy/react-native-vision-camera/pull/1674#issuecomment-1684104217

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! πŸŽ‰ Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

mrousavy avatar Aug 18 '23 16:08 mrousavy

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: #1674 (comment)

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! πŸŽ‰ Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

Hi, I have same issues with some phones not opening camera, how can I npm install the new V3 version? Do i have to change code or syntax for this rewrite?

Appreciate so much.

Alejandro

alexvazquez avatar Nov 08 '23 15:11 alexvazquez