nimiq / qr-scanner

Lightweight Javascript QR Code Scanner
https://nimiq.github.io/qr-scanner/demo
MIT License
2.35k stars 509 forks source link

Native BarcodeDetector API performance is bad #237

Open jvhellemond opened 1 year ago

jvhellemond commented 1 year ago

☝️ This is more of a tip than an issue:

The performance of the native BarcodeDetector API 1 can be pretty bad 2, causing animations while scanning to be very choppy. Reducing the maximum number of scans per second helps, a bit. Disabling (or removing) window.BarcodeDetector (before calling .start()) makes QrScanner load the worker script and do its detecting there:

delete window.BarcodeDetector;

1: Chrome on non-M1/M2 macOS or Chrome OS or Android only, for now 2: In Chrome on my non-M1/M2 Macbook Pro at least, #YMMV

DonkeyBear commented 1 week ago

Thanks bro, this tip saves my ass 🥹