Closed SK-bool closed 8 months ago
Removed the following line(446) : captureRequest.setZoom(config.zoom, cameraCharacteristics) in node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\core\CameraSession.kt
Which fixed my camera problem but when scanning a qr code the app crashes(sometimes). Yes I can reproduce.
Same problem here, in devices like Motorola g6 plus (Android 9) (always black screen), Samsung Galaxy s21 FE (Android 13) but in this only when bring the app from background y open the camera again.
Camera.onError(session/camera-has-been-disconnected): [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: CAMERA_IS_DISABLED_BY_ANDROID [session/camera-has-been-disconnected: [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: CAMERA_IS_DISABLED_BY_ANDROID]
@MicaelaWaigel i think this is because we are not propertly closing the camera session when it goes to background, need to double check, if someone have more time than me to test this theory please go ahead
@MicaelaWaigel i think this is because we are not propertly closing the camera session when it goes to background, need to double check, if someone have more time than me to test this theory please go ahead
We set the isActive according the isFocused and appState, so when the app is in background after a while the error Camera.onError(session/camera-has-been-disconnected): [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: CAMERA_IS_DISABLED_BY_ANDROID
occurs.
When the appState changed to active, then the error is Camera.onError(unknown/unknown): [unknown/unknown] CameraDevice was already closed [unknown/unknown: [unknown/unknown] CameraDevice was already closed]
Hey! Thanks for reporting this issue.
I've been working the past days on making sure the Camera lifecycle is safely handled and released when needed to make sure this crash doesn't occur anymore.
I just created a PR for this - can you please this to see if that fixes the issue for you? https://github.com/mrousavy/react-native-vision-camera/pull/2339
If this fixes your issue, please consider 💖 sponsoring me on GitHub 💖 to support me / thank me for building VisionCamera and continuously improving it.
If this does not fix your issue, please clone the repo, check out the branch fix/blackscreen
(the PR above), run the Example app, reproduce your issue there and share the adb logcat
logs with me (upload to pastebin or gist) so I can investigate this further.
Thank you! 🙏
What's happening?
While the app is trying to open the camera I am getting the following error:
11-27 13:37:00.659 20287 20369 E ReactNativeJS: _message: '[session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR',
Reproduceable Code
Relevant log output
Camera Device
Device
Motorola g5
VisionCamera Version
3.6.10
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information