Live data from Hacker News

Barcode Detection API

developer.mozilla.org

11–20 of 141 posts

Re: Barcode Detection API

#12
I'm still looking for an open source python library that can decode Data-Matrix barcodes as seen on Digikey bags. Should I give up and switch to JavaScript+browser?

Re: Barcode Detection API

#13

... it decodes the barcode too?

According to this documentation, yes, it returns the raw value encoded in the barcode.

What it does not appear to do is further decode the raw value into logical data. E.g. data matrices commonly contain GS1 element strings that are not trivial to decode. There are libraries for that, though.

Re: Barcode Detection API

#15
I recently made a webapp for scanning barcodes using the phone camera for warehouse use. I used QuaggaJS. I disabled the barcode locator because it was too heavy, instead I just draw a box on the screen that the barcode is to be positioned in. The barcode detection and decoding happens entirely in the browser and it works very well.

Re: Barcode Detection API

#16
post #4

Even thought its on mozilla.org is not supported by Firefox according to the matrix at the bottom.

MDN is meant to be a somewhat universal resource for web development. I've even seen official Google web dev resources pointing to MDN.

Re: Barcode Detection API

#18
post #2

As the page does not discuss the motivation behind the API, does anyone know why this is ”native” API and not just a generic image processing script implemented with JavaScript / WebGL / etc.?

It's a heavily standardized, very recurrent problem that can take a lot of advantage of native code and platform-specific optimization, so it's really an ideal target for a Web API.

Re: Barcode Detection API

#19

... it decodes the barcode too?

According to this documentation, yes, it returns the raw value encoded in the barcode. What it does not appear to do is further decode the raw value into logical data. E.g. data matrices commonly contain GS1 element strings that are not trivial to decode. There are libraries for that, though.

Arguably, as a Barcode Detection API that's all it should do.

Re: Barcode Detection API

#20
post #2

As the page does not discuss the motivation behind the API, does anyone know why this is ”native” API and not just a generic image processing script implemented with JavaScript / WebGL / etc.?

At this point in time it's a pain point for me that Android devices don't usually have built-in QR reader software. I can tell iOS users to just "scan the code with the Camera" app but I have to tell Android users to find a QR scanner app on the app store. My experience with an actual bottom-of-the-line prepaid phone was that the first QR scanner app I downloaded from Google Play worked right the first time but I had…

I've been scanning QR codes with my Android phone for a long time. I know at least two native cameras work, Pixel's and Samsung's since 2019. But I am sure legacy phones with older android versions don't support it natively.
Post reply on HN