QR / Barcode Scanner not working after 1st Scan completed - a way to restart/continue batch scanning?

0
I am using the Barcode Scanner widget ( https://docs.mendix.com/appstore/widgets/barcode-scanner ) in Mendix Studio Pro and it works perfectly fine for me. But only for 1 scan. Once the scan is completed the onDetect event calls correctly the linked Nano or Microflow and that’s it. If I want to take a following scan from the same window/view the scanner (or at least camera and view) continues running. But no new scan seems to happen. Is there any way to continue scanning or restart the scanner programmatically? Imagine scanning 10 package labels or 10 product labels before putting them in a box. Closing and opening a new window looks like the wrong approach for me if scanning in batches. Any help, advice or example is highly welcome. Even if it includes some JS or Java code.   [EDIT 2022-06-16] Here a screenshot of the current web app to visualize better what I am trying to achieve here: basically a single page application with multiple tabs and 3 (actually 5) vertical split panes. The whole app is getting loaded once at the beginning and the user is just switching between tabs, resizing panes where necessary and searching/refreshing/creating/editing database records. Currently without any additional (sub-) pages or popups.
asked
2 answers
0

See my other answer. Also found this one: https://stackoverflow.com/questions/11642926/stop-close-webcam-stream-which-is-opened-by-navigator-mediadevices-getusermedia

Gives you some more hints on how you might achieve this.

Regards,

Ronald

 

answered
0

The widget explicitly has a check that stops it from detecting a scan after the first one:

 

https://github.com/mendix/widgets-resources/blob/master/packages/pluggableWidgets/barcode-scanner-web/src/components/BarcodeScanner.tsx#L88

So currently, I think you’d need to close and open the scanner for each scan you do. That could be part of the onDetect action. You could also consider:

  • if you’re handy with TypeScript, editing the code to your needs
  • submitting a support request asking them to enhance the widget so it can scan multiple codes
answered