Skip to content

Version 2.2.1

Compare
Choose a tag to compare
@mebjas mebjas released this 07 Apr 13:45
· 81 commits to master since this release
ced1209

Version 2.2.1 - version 2.2.3 (no code changes).

  • Added support for supportedScanType in Html5QrcodeScanner. This feature
    was implemented by our latest contributor - mohsinaav@

    Now users can decide to only use camera based scan or file based scan or use
    them in different order. How to use:

     function onScanSuccess(decodedText, decodedResult) {
         // handle the scanned code as you like, for example:
         console.log(`Code matched = ${decodedText}`, decodedResult);
     }
    
     let config = {
         fps: 10,
         qrbox: {width: 100, height: 100},
         rememberLastUsedCamera: true,
         // Only support camera scan type.
         supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA]
     };
    
     let html5QrcodeScanner = new Html5QrcodeScanner(
         "reader", config, /* verbose= */ false);
     html5QrcodeScanner.render(onScanSuccess);

    For file based scan only choose:

    supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_FILE]

    For supporting both as it is today, you can ignore this field or set as:

    supportedScanTypes: [
        Html5QrcodeScanType.SCAN_TYPE_CAMERA,
         Html5QrcodeScanType.SCAN_TYPE_FILE]

    To set the file based scan as defult change the order:

       supportedScanTypes: [
         Html5QrcodeScanType.SCAN_TYPE_FILE,
         Html5QrcodeScanType.SCAN_TYPE_CAMERA]