QR codes are very easy to scan in-browser, but 1D barcodes are significantly more challenging. ~75% of the cannabis industry deals with Metrc, which forces companies to place 1D Code-128 barcode tags on everything they grow or manufacture. As a result, I've spent a lot of time investigating ways to scan these barcodes with a phone camera in a cross-browser webpage.<p>Ultimately, after much experimentation, the unavoidable conclusion is that the optical scanning solutions are junk. Connecting a crappy $20 HID bluetooth barcode scanner to a phone is so <i>crazily</i> better at scanning a 1D barcode than even the most massaged optical barcode scanning libraries. Industry workers that deal with these barcodes don't even bother with phone camera scanning, it's way too slow and temperamental.
There’s also the experimental <a href="https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Det...</a> — already live in Chrome.
Hopefully there's an API to access the back camera on phones instead? The front really doesn't have the resolution necessary for many barcodes.
eBay did a similar experiment with ZBar in WebAssembly in 2019: <a href="https://innovation.ebayinc.com/tech/engineering/webassembly-at-ebay-a-real-world-use-case/" rel="nofollow">https://innovation.ebayinc.com/tech/engineering/webassembly-...</a>