Skip to content

Version 2.0.8

Choose a tag to compare

@mebjas mebjas released this 13 Jun 05:28
· 144 commits to master since this release
0168a2b

Version 2.0.8

  • Added support for configuring supported formats in Html5Qrcode & Html5QrcodeScanner.

Example usage:

Only scanning with QR code - using Html5Qrcode

const html5QrCode = new Html5Qrcode(
    "reader", { formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ] });
const qrCodeSuccessCallback = message => { /* handle success */ }
const config = { fps: 10, qrbox: 250 };

// If you want to prefer front camera
html5QrCode.start({ facingMode: "user" }, config, qrCodeSuccessCallback);

Scanning with QR code and bunch of UPC codes - using Html5QrcodeScanner

function onScanSuccess(qrMessage) {
    // handle the scanned code as you like, for example:
    console.log(`QR matched = ${qrMessage}`);
}

const formatsToSupport = [
    Html5QrcodeSupportedFormats.QR_CODE,
    Html5QrcodeSupportedFormats.UPC_A,
    Html5QrcodeSupportedFormats.UPC_E,
    Html5QrcodeSupportedFormats.UPC_EAN_EXTENSION,
];
const html5QrcodeScanner = new Html5QrcodeScanner(
    "reader",
    { fps: 10, qrbox: 250, formatsToSupport: formatsToSupport },
    /* verbose= */ false);
html5QrcodeScanner.render(onScanSuccess);

By default scanning with all formats supported today

function onScanSuccess(qrMessage) {
    // handle the scanned code as you like, for example:
    console.log(`QR matched = ${qrMessage}`);
}

const html5QrcodeScanner = new Html5QrcodeScanner(
    "reader", { fps: 10, qrbox: 250 }, /* verbose= */ false);
html5QrcodeScanner.render(onScanSuccess);
  • Feature request: #177
  • Pull request: #222