cozmo / jsQR

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
https://cozmo.github.io/jsQR/
Apache License 2.0
3.72k stars 607 forks source link

Consider using native BarcodeDetector #198

Open jeznag opened 3 years ago

jeznag commented 3 years ago

Browsers now have native support for QR code detection: https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector

Would be helpful to use this if it is available.

fappaz commented 3 years ago

Browsers now have native support for QR code detection: https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector

Would be helpful to use this if it is available.

At the time of writing, Firefox and Safari don't support the Barcode Detection API yet, but it is an interesting alternative indeed.

danimoh commented 3 years ago

If you are interested in a lib that uses the BarcodeDetector if available and otherwise falls back to jsQR, have a look at this lib: https://github.com/nimiq/qr-scanner

stefansundin commented 2 years ago

Hello everyone. I have also made my own shim library. It uses the BarcodeDetector interface and falls back to jsQR. If you decide to implement my library now, it should be very easy to remove my library and move to BarcodeDetector in the future (when BarcodeDetector has become widely supported in browsers).

Package: https://www.npmjs.com/package/qr-detector

Repo: https://github.com/stefansundin/qr-detector.js

Demo: https://stefansundin.github.io/qr-detector.js/

fengdh commented 2 years ago

Please also consider using zbar.wasm (see https://github.com/undecaf/zbar-wasm, and https://github.com/samsam2310/zbar.wasm).

Here is my live sample with zbar.wasm https://output.jsbin.com/zevavin

mubarakn commented 1 year ago

@fengdh Thanks a lot for sharing your code, this has significantly improved QR detection in my app. You are a Life saver!