Thanks for downloading Dynamsoft Barcode Reader Package!
Your download will start shortly. If your download does not begin, click here to retry.
How to stop the camera stream from opening right away after DBR JS demo is loaded? How to enable the camera on the click of a button?
Instead of creating the BarcodeScanner
instance on page load, trigger the creation on the click of the Start Scanning
button instead, as shown in the sample code below -
let startScanBtn = document.getElementById("StartScanning"); // double check the ID of the button
startScanBtn.addEventListener("click", async function () {
let scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
scanner.onFrameRead = (results) => {
console.log(results);
};
scanner.onUniqueRead = (txt, result) => {
alert(txt);
};
await scanner.show();
});