Scanner: launch barcode scanner programmatically

Hi !

I'm trying to find a way to launch the barcode scanner from javascript.

Description of my problem:

  • I've a scanner button on my app. Clicking on it works fine.
  • in the app I also display some modals and want to also be able to launch the scanner from a modal, i've tried a few things:
    • add another Scanner button in the modal: it does not work fine: the scanner popup shows up, but no image is present - my supposition is that we can not have more than one scanner component in a single app (I also think that the scanner component is always "opened" even when the scanner button is not clicked: my mobile phone shows a system notification "this chrome site is using your camera" and the battery is drained very quickly).
    • tried to trigger the main scanner button from a script, without success. I did not found any API to do that.

Thanks,
Tom.

Hey @thomasltd!

Thanks for flagging this! It looks like this is indeed a bug, I've linked this thread to a related bug report and will keep this thread up to date as a fix is addressed! :slight_smile:

1 Like

Hi,

My case is similar to this in that sometimes the camera shows up without the camera screen. Sometimes the screen appears but images are not captured: they are captured only once but after clicking the button again, it seems capturing an image doesn’t work.