

The region is specified as x, y, width and height the dimensions for the downscaled region as downScaledWidth and downScaledHeight. This region can optionally also be scaled down before performing the scan as an additional performance improvement. If supported by the browser, the scan rate is never higher than the camera's frame rate to avoid unnecessary duplicate scans on the same frame.Ī method that determines a region to which scanning should be restricted as a performance improvement. This option can be used to throttle the scans for less battery consumption. Note that there is no guarantee that the preference can actually be fulfilled. The preference can be either a device id as returned by listCameras or a facing mode specified as 'environment' or 'user'. Handler to be invoked on decoding errors.

log ( 'decoded qr code:', result ) ) Īs an optional third parameter an options object can be provided. Create HTMLĬreate a element where the web cam video stream should get rendered:Ĭonst qrScanner = new QrScanner ( videoElem, result => console. Especially if you want to scan from the device's camera, camera support by the browser is the stricter restriction. You will likely not need to use the legacy build though, as general browser support is already very good for the regular build. Note, that the legacy build is larger as it includes some polyfills and, to support browsers that don't support dynamic imports, inlines the worker script which however would be needed to be loaded in legacy browsers anyway. It's a UMD build and can be used as a replacement for, see above. If you need to support old browsers, you can use, which is ECMAScript 2015 (ES6) compatible. This library uses ECMAScript 2017 features like async functions. The development of this library is sponsored by nimiq, world's first browser based blockchain.Ĭonst QrScanner = require ( 'qr-scanner' ) // if installed via package const QrScanner = require ( 'path/to/' ) // if not installed via package // do something with QrScanner The library supports scanning a continuous video stream from a web cam as well as scanning of single images. Also the other library oftentimes misreads the content of QR codes, while for this project no misreads occurred in the benchmarking.
#QREADER FREE DOWNLOAD CODE#
Javascript QR Code Scanner based on Cosmo Wolfe's javascript port of Google's ZXing library.
