Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iagolast/qrcodejs

Javascript library to read QR codes in the browser
https://github.com/iagolast/qrcodejs

Last synced: 24 days ago
JSON representation

Javascript library to read QR codes in the browser

Awesome Lists containing this project

README

        

# QrCode.js

Javascript library to read QR codes in the browser

# Installation

Note: The script creates a grobal variable named QrReader, in future versions this library will be compatible with
different module loaders.

## Using Bower

Install the library using:

bower install --save qrcode-reader.js

Use it from the html.

```html

```

## Using Npm

npm i qrcode-reader.js

Use it from the html.

```html

```

## Manually including scripts

Download the javascript file from the next link and add it to your source:

https://raw.githubusercontent.com/IagoLast/qrcodejs/master/dist/qrcode.js

# Simple example

This code creates a webcam canvas which border will turn green when a code is readed.

```html

QRCode.js

function onSuccess(data) {
document.getElementById('video').setAttribute("style", "border: 3px solid #52e250");
console.log('Sucess:', data);
}

function onError(err) {
console.error(err);
}

QrReader.getBackCamera().then(function(device) {
new QrReader({
sucessCallback: onSuccess, // Required
errorCallback: onError, // Required
videoSelector: '#video', // If not provided creates an invisible element and decode in background
stopOnRead: true, // Default false, When true the video will stop once the first QR is read.
deviceId: device.deviceId, // Id of the device used for recording video.
});
});

```

## Author
@iagolast

## License
MIT