NativeScript/mlkit

Feature Request: Allow for IR-LED activation/deactivation

cjohn001 opened this issue · 6 comments

Hello,
would be great if you could add an option to the MLKitView (similar to old firebase plugin) which allows for activation and deactivation of the IR LEDs on the camera. Thanks!

@cjohn001 Can you point me to this feature ?

@triniwiz : Thanks for fixing the other bug already. Will try out things tomorrow. I am not sure what you mean with your question. I assume my feature request was not clear? The old firebase plugin had the following signature for angular

<MLKitBarcodeScanner formats="UPC_A, UPC_E, EAN_13, EAN_8" beepOnScan="false"
supportInverseBarcodes="false" processEveryNthFrame="5" [torchOn]="_torchOn" [pause]="_pause"
(scanResult)="onBarcodeScanResult($event)" style="background-color: black;">

The torchOn Option activates/deactivates the camera LEDs. It would be very great if you could add a LED light activation/deactivation option to the MLKitView as well. The barcode scanning does require a good contrast for the scanner to work. For low light conditions this is a very important feature, which I um using quite frequently.

When playing with the plugin, I also realized, that the camera is automatically started when the view is created, and there is no option to request the current camera state.
From an interface point of view, I think it would be great if the activation/deactivation of the camera could also be bound to a flag like the [pause] flag in the old plugin. Then the camera state would also be available from outer components. However, this would be already a second feature request.

Ah the torch, sure why not

As for the pause there is the stop/start preview but I can also add an autoStart prop or so

@triniwiz: I was thinking a little different. I thought not for an autostart option but rather a toggle flag which starts/stops the camera.
The view component which contains the camera view might need to know the current state of the camera (running/stopped) on startup.
Currently one needs to make the assumption that the camera is in running state when the page is visited. In case you could bind it to a flag (like pause) then the state would be explicit in the page component. And the page component could directly manipulate the running/stopped state of the camera via the toggle flag.
I think what is always a little difficult with Angular is, that the view creation is not in sync with the lifecycle of the component which contains it (i.e. in ngOnInit the reference to the camera view will not be accessible). Hence if one could activiate/deactivate the camera in a declarative way (via pause flag or similar) this makes things easier.

And thank you very much for looking into it!

closed by: c7ee498