capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 172 forks source link

need light surport! #182

Closed luoliang222 closed 1 year ago

luoliang222 commented 1 year ago

Is your feature request related to a problem? Please describe. i need open light when scan at night, but the flashlight control is can't open when i open scan.

thegnuu commented 1 year ago

Torch support is already implemented, you can use the following functions:

  enableTorch(): Promise<void>;
  disableTorch(): Promise<void>;
  toggleTorch(): Promise<void>;
  getTorchState(): Promise<TorchStateResult>;

You will need to build your own interface the allow the users to enable/disable the torch.

jonasphp commented 1 year ago

@thegnuu How to keep the torch going while scanning? .enableTorch isn't doing it alone torch is flashing for 1 sec and as soon as camera starts it turns off.

thegnuu commented 1 year ago

@jonasphp the torch can currently only be used reliably while using the continuous scan method. If you start the scan, the camera settings will be reset depending on the device and it will disable the torch again. If you start the scan in continuous mode and toggle the torch after this you should be able to use it. Unfortunately this is as far as I know not an easy fix since it would require a lot of changes.