Instascan: Does this lib only decode QR codes?

Created on 14 Jul 2017  ·  8Comments  ·  Source: schmich/instascan

Scanning QR code works fine. I was wondering if this library supports decoding any other barcode formats. I am particularly interested in decoding Data Matrix codes.

Is there any way I can modify the core code to decode datamatrix instead?

Most helpful comment

Same here, with ZXing._decode_any the QR codes still work, but barcodes throw an error Runtime.functionPointers[index] is not a function

All 8 comments

Sorry for the delay in responding. At the moment, the library does not officially support anything other than QR codes, though supporting multiple formats and multiple codes in the same frame is a longer-term goal.

The core of the library is a bit of a Frankenstein. It's powered by the Emscripten JavaScript build of the C++ port of the ZXing Java library.

If you look at the Emscripten example, you'll see they make calls to ZXing._decode_qr (which this library uses) as well as ZXing._decode_any. Since ZXing supports Data Matrix, I believe ZXing._decode_any will recognize QR codes, barcodes, Data Matrix, Aztec, etc.

The relevant call is in scanner.js. Unfortunately, I don't have the time to test it, but the change is small if you'd like to try.

Alright. I'll try it out and let you know.

On side related note: Do you have any idea why the demo website stopped working? I am getting the error Error: Cannot access video stream (DevicesNotFoundError). on all browsers

screen shot 2017-07-18 at 14 27 16

Perhaps you have camera access blocked by default or you blocked access for the demo site sometime in the past?

You should see this prompt when first visiting the demo site:

screen shot 2017-07-18 at 7 02 49 am

Camera access should be allowed:

screen shot 2017-07-18 at 7 04 24 am

Closing the issue since all formats are supported when replacing ZXing._decode_qr with ZXing._decode_any at line https://github.com/schmich/instascan/blob/master/src/scanner.js#L145

Thanks for your help.

Thanks for testing this and reporting back. I'm hesitant to officially support other formats right now since I haven't tested them all myself, but again, I definitely want to support them in the future. For now, I created #61 to track this. Thanks again.

Is it also possible that when I use instascan.min.js minified to scan barcodes?
I tried to change u._decode_qr(this.decodeCallback) to u._decode_any(this.decodeCallback)
QR now still works, but barcode does not.

Same here, with ZXing._decode_any the QR codes still work, but barcodes throw an error Runtime.functionPointers[index] is not a function

I also facing same issues with @eggyyy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marvinex123 picture marvinex123  ·  11Comments

desmond0412 picture desmond0412  ·  4Comments

TomRauchenwald picture TomRauchenwald  ·  9Comments

werthdavid picture werthdavid  ·  5Comments

jeroenbreen picture jeroenbreen  ·  7Comments