Fixed issue #518 modified Camera.kt file
Summary
Flash light issue(#518) resolved with this fix, Thanks @MdAyan101
https://github.com/teslamotors/react-native-camera-kit/issues/518 I was also facing the same issue, and was able to resolve using this. Thanks
Hi @MdAyan101,
Thanks for your first contribution!
If you want it to be merged quickly, please proactively provide details
- why is the fix addressing the issue, the explanation behind it or a doc. Should this "trick" be done elsewhere?
- steps on how you tested it, what version etc.
This helps now to get it merged, but also in the future to have enough context so it doesn't get mistakenly reverted
Hi @DavidBertet ,
I was facing the issue of toggling the flashlight through a button while camera preview was on. I was not able to turn on the flash since the camera was already in use and I was getting this exception : android.hardware.camera2.CameraAccessException: CAMERA_IN_USE (4): setTorchMode:3108: Torch for camera "0" is not available due to an existing camera user
So I changed the setTorchMode method adding a pause for camera preview and then enabling the flash and then again resuming the camera preview. Just 2 line added.
I tested this in android 11, 12, 13, 14, 15 devices. Devices were from Samsung, pixel, Motorola, one-plus and it works for every device.
@MdAyan101 I am unable to reproduce the issue with a Pixel Fold 9. Can you provide an example project or a video recording of the issue? I don't want to add one-off hacks like this without a clear use cause.
Can you have a test of v16? It fixes a bunch of issues with the new arch so it's possible it affected it.
Stale. Closing.