https://github.com/stefansundin/qr-detector.js
QrDetector is a JavaScript library that first tries to use the browser's native BarcodeDetector, with a fallback to jsQR.
https://github.com/stefansundin/qr-detector.js
barcode-detection javascript-library qrcode-scanner
Last synced: 7 months ago
JSON representation
QrDetector is a JavaScript library that first tries to use the browser's native BarcodeDetector, with a fallback to jsQR.
- Host: GitHub
- URL: https://github.com/stefansundin/qr-detector.js
- Owner: stefansundin
- License: mit
- Created: 2021-11-15T06:03:39.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-02T06:31:43.000Z (about 2 years ago)
- Last Synced: 2025-03-16T23:11:55.682Z (7 months ago)
- Topics: barcode-detection, javascript-library, qrcode-scanner
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/qr-detector
- Size: 1000 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
QrDetector is a JavaScript library that implements the [BarcodeDetector](https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector) interface, but only for QR codes. If the web browser supports it then QrDetector will use the native BarcodeDetector, otherwise it will fall back to [jsQR](https://www.npmjs.com/package/jsqr-es6).
By using the BarcodeDetector interface, it is extremely easy to swap in QrDetector. You will also be able to easily get rid of QrDetector later when BarcodeDetector becomes more widely implemented.
The library works around [a Google Chrome bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1382442) by doing a test detection on a hard-coded QR code.
You can get this package from npm, or load the code directly in a `` tag (see demo page).
- Demo: https://stefansundin.github.io/qr-detector.js/
- React demo: https://github.com/stefansundin/qr-detector.js/tree/react-demo
- https://caniuse.com/mdn-api_barcodedetector