dynamsoft-javascript-barcode-7.0-7
by DynamsoftTeam
HTML
<!DOCTYPE html>
<html>
<body>
<div id="div-ui-container">
<select class="dce-sel-camera"></select>
<select class="dce-sel-resolution">
<option class="dce-opt-gotResolution" value="got"></option>
<option data-width="1280" data-height="720">1280x720</option>
<option data-width="1920" data-height="1080">1920x1080</option>
</select>
<br>
<div class="dce-video-container" style="position:relative;width:100%;height:500px;"></div>
</div>
<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();
await scanner.setUIElement(document.getElementById('div-ui-container'));
scanner.onFrameRead = results => {console.log(results);};
scanner.onUniqueRead = (txt, result) => {alert(txt);};
await scanner.open();
})();
</script>
</body>
</html>