You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, we're encountering an issue with react-native-vision-camera. It appears that when the camera is initiated within the app on Android, the library exclusively locks the camera, preventing other libraries (in same react-native-program) that also require camera access from gaining control.
As an example, we are using both react-native-vision-camera and react-native-torch (utilized for opening the flashlight, which camera permissions on Android).
) is not call at all even the screen dismiss/close, which may make the react-native-vision-camera exclusive lock
If we restart application again without calling the Camera screen, the torch function is working properly. So, we think that the problem comes from react-native-vision-camera exclusively lock the Camera
Hey! I just found out that I really forgot to close and dispose the locked Camera resources, so I just fixed that in this PR: #2174
Now the Camera fully & synchronously closes all resources (CameraSession, CameraDevice, OpenGL context, Video & Photo outputs, Photo Synchronizer) once the view gets removed from the React view hierarchy ("unmounted"), and things like Flash, Torch, NFC, and other Camera components should be working again.
There is still a small issue that causes once Camera component to turn into a blackscreen when navigating back and forth between two Camera components, that's a pretty rare edge case but I will still try to fix that soon when I have some free time.
If you appreciate my time, expertise and dedication to this project, pleas 💖 consider sponsoring me on GitHub 💖 to support the development of this project.
What's happening?
Hello, we're encountering an issue with react-native-vision-camera. It appears that when the camera is initiated within the app on Android, the library exclusively locks the camera, preventing other libraries (in same react-native-program) that also require camera access from gaining control.
As an example, we are using both react-native-vision-camera and react-native-torch (utilized for opening the flashlight, which camera permissions on Android).
To replicate the issue:
We got this error message "CAMERA_IN_USE (4): setTorchMode:2122: Torch for camera "0" is not available due to an existing camera user" even if the camera modal/screen is dismissed. (https://github.com/ludo/react-native-torch/blob/957db6330a0afd09455e42ce6537e0ca69518e3c/android/src/main/java/com/cubicphuse/RCTTorch/RCTTorchModule.java#L47)
We suspected that this function (
react-native-vision-camera/package/android/src/main/java/com/mrousavy/camera/core/CameraSession.kt
Line 98 in be1bb41
If we restart application again without calling the Camera screen, the torch function is working properly. So, we think that the problem comes from react-native-vision-camera exclusively lock the Camera
Reproduceable Code
Relevant log output
Camera Device
Device
Multiple Android Devices (SS Note9/Xiaomi Redmi Note9)
VisionCamera Version
3.6.4
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information
The text was updated successfully, but these errors were encountered: