Hello,
i am trying to make qrcode with html5. I am using the following javascript. But what I want is to open the rear camera directly when the start is pressed.
How is this possible?
https://github.com/mebjas/html5-qrcode
HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5-qrcode/2.0.3/html5-qrcode.min.js"></script>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div id="qr-reader" style="width:1000px"></div>
<div id="qr-reader-results"></div>
<script>
var resultContainer = document.getElementById('qr-reader-results');
var lastResult, countResults = 0;
function onScanSuccess(decodedText, decodedResult) {
if (decodedText !== lastResult) {
++countResults;
lastResult = decodedText;
// Handle on success condition with the decoded message.
console.log(`Scan result ${decodedText}`, decodedResult);
alert(decodedText, decodedResult);
}
}
var html5QrcodeScanner = new Html5QrcodeScanner
(
"qr-reader", { fps: 10, qrbox: 750 }
);
html5QrcodeScanner.render(onScanSuccess);
</script>
</body>
</html>