dynamsoft-javascript-barcode-7.0-2

by DynamsoftTeam

HTML

<!DOCTYPE html>
<html>

<body>
  <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.32/dist/dbr.js"></script>
  <script>
        // specify a license, you can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=guide&product=dbr&package=js to get your own trial license good for 30 days. 
        Dynamsoft.DBR.BarcodeScanner.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
        (async()=>{
            let scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
            // scanner.onFrameRead = results => {console.log(results);};
            // scanner.onUniqueRead = (txt, result) => {alert(txt);};

            // Sets which camera and what resolution to use
            let allCameras = await scanner.getAllCameras();
            await scanner.setCurrentCamera(allCameras[0].deviceId);
            await scanner.setResolution(1280, 720);

            // Sets up the scanner behavior
            let scanSettings = await scanner.getScanSettings();
            // Disregards duplicated results found in a specified time period (in milliseconds).
            scanSettings.duplicateForgetTime = 5000; // The default is 3000
            // Sets a scan interval in milliseconds so the SDK may release the CPU from time to time.
            // (setting this value larger is a simple way to save battery power and reduce device heating).
            scanSettings.intervalTime = 100; // The default is 0.
            // Sets captureAndDecodeInParallel to false, which tells the SDK not to acquire the next frame while decoding the first.
            // This is another way to save battery power and is recommended on low-end phones. However, it does slow down the decoding speed.
            scanSettings.captureAndDecodeInParallel = false; // The default is true.
            await scanner.updateScanSettings(scanSettings);
            
          	// Uses one of the built-in RuntimeSetting templates: "single" (decode a single...