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
I am trying to save the state of the torch so that when a user re-opens the camera the torch is set to the same state as when they last closed the camera. However, if I enable to torch right after opening the camera, the torch flashes but does not stay on. If I add a 200ms delay the torch stays on as expected. I suspect this is because the torch is being turned on before the camera is finished being initialized/open and when it is open it defaults the torch to be off.
Preferred solution
An observable for the camera being initalized and/or opened would be a more elegant and reliable solution. I worry that with older and slower deviced the 200ms delay won't be enough, but I don't want to increase that delay to the point it's noticable by users.
Alternative options
The torch not being reset by the camera opening would be great, but I assume that is being set at the OS level.
Additional context
I only selected bardcode scanning as that is the only part of the library I have used, but I suspect the same issue woudl happen for all of the features.
@robingenz Both, I've observed the issue on an Android phone and a iPad mini. I was going back and forth but now I'm feeling like this is more of a bug? I have some free time later today, I'll fork the demo project and see if I can reproduce it there.
I was mistaken, this only occurs in iOS (testing on iPad mini), and only occurs on the second time the scanner is open. I modifed the demo code to add a initialTorchState parameter to the Barcode Reader component. For this demo I set initialTorchState to always be True.
Plugin(s)
Current problem
I am trying to save the state of the torch so that when a user re-opens the camera the torch is set to the same state as when they last closed the camera. However, if I enable to torch right after opening the camera, the torch flashes but does not stay on. If I add a 200ms delay the torch stays on as expected. I suspect this is because the torch is being turned on before the camera is finished being initialized/open and when it is open it defaults the torch to be off.
Preferred solution
An observable for the camera being initalized and/or opened would be a more elegant and reliable solution. I worry that with older and slower deviced the 200ms delay won't be enough, but I don't want to increase that delay to the point it's noticable by users.
Alternative options
The torch not being reset by the camera opening would be great, but I assume that is being set at the OS level.
Additional context
I only selected bardcode scanning as that is the only part of the library I have used, but I suspect the same issue woudl happen for all of the features.
Before submitting
The text was updated successfully, but these errors were encountered: