update index.js
This commit is contained in:
@@ -15,16 +15,18 @@ PAGES.index = {
|
|||||||
<h1>Buscar con Aztec</h1>
|
<h1>Buscar con Aztec</h1>
|
||||||
<div id="${qrscan}"></div>
|
<div id="${qrscan}"></div>
|
||||||
<br><br>`;
|
<br><br>`;
|
||||||
const html5QrCode = new Html5Qrcode(
|
var html5QrcodeScanner = new Html5QrcodeScanner(
|
||||||
qrscan, { formatsToSupport: [Html5QrcodeSupportedFormats.AZTEC] });
|
qrscan, { fps: 10, qrbox: 250 });
|
||||||
const qrCodeSuccessCallback = (decodedText, decodedResult) => {
|
|
||||||
/* handle success */
|
function onScanSuccess(decodedText, decodedResult) {
|
||||||
alert(decodedText)
|
// Handle on success condition with the decoded text or result.
|
||||||
html5QrCode.stop()
|
alert(`Scan result: ${decodedText}`, decodedResult);
|
||||||
};
|
// ...
|
||||||
const config = { fps: 10, qrbox: { width: 250, height: 250 } };
|
html5QrcodeScanner.clear();
|
||||||
|
// ^ this will stop the scanner (video feed) and clear the scan area.
|
||||||
|
|
||||||
// If you want to prefer front camera
|
|
||||||
html5QrCode.start({ facingMode: "user" }, config, qrCodeSuccessCallback);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
html5QrcodeScanner.render(onScanSuccess);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user