mobile_scanner icon indicating copy to clipboard operation
mobile_scanner copied to clipboard

Stopping camera resets torch state to off

Open novas1r1 opened this issue 2 years ago • 1 comments

Hello, I have an app where I need to stop the camera in order to take some time for processing the qrcode. I also have a torchlight implemented using the ValueListenableBuilder in the example. If I'm running controller.stop() the flashlight is turned of. Is this intentional? I somehow wanted to reenable it when running controller.start() but it seems like if it's ignored.

I somehow managed to work around by introducing another variable called _isTorchEnabled but then I run into the following issue and my camera just doesn't scan any codes anymore:

W/System  (26528): A resource failed to call Surface.release.
I/BpBinder(26528): onLastStrongRef automatically unlinking death recipients: <uncached descriptor>

Any hints? Or any way to enable the torch if it was enabled before stopping the controller?

Best regards and thanks a lot for your hard work <3! Verry

novas1r1 avatar Aug 28 '22 07:08 novas1r1

  • Might be related to #194 and #190

teolemon avatar Aug 28 '22 10:08 teolemon

The torch is linked to the camera state, in other words, you can only turn the torch on when the camera is running.

So the torch turning off when the camera does is intentional.

navaronbracke avatar Mar 05 '24 10:03 navaronbracke