dynamsoft-javascript-barcode-7.0-12

by DynamsoftTeam

HTML

<!DOCTYPE html>
<html>

<body>
    <!--
        Please visit https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx to get trial license.
    -->
    <script src="https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20201124110923.0/dist/dbr.js"
        data-productKeys="PRODUCT-KEYS"></script>
    <script>
        let scanner = null;
        (async()=>{
            scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
            
            let settings = await scanner.getRuntimeSettings();
            /*
             * 1 means true
             * Using a percentage is easier
             * The following code ignores 25% to each side of the video stream
             */
            settings.region.regionMeasuredByPercentage = 1;
            settings.region.regionLeft = 25;
            settings.region.regionTop = 25;
            settings.region.regionRight = 75;
            settings.region.regionBottom = 75;
            await scanner.updateRuntimeSettings(settings);
            
            scanner.onFrameRead = results => {console.log(results);};
            scanner.onUnduplicatedRead = (txt, result) => {alert(txt);};
            await scanner.show();
        })();
    </script>
</body>

</html>