I am trying to make a barcode scanner with Quagga . But I can only see the live version of the webcam, but it does not recognize the barcode ( code 128). (This snippet does not show the webcam in stackoverflow.)
I think I am missing a step, but I hope that someone here can push me in the right direction.
Quagga.init({
inputStream : {
name : "Live",
type : "LiveStream",
target: document.querySelector('#scanblock')
},
decoder : {
readers : ["code_128_reader"]
}
}, function(err) {
if (err) {
console.log(err);
return
}
console.log("Initialization finished. Ready to start");
Quagga.start();
});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://serratus.imtqy.com/quaggaJS/examples/js/quagga.min.js" type="text/javascript"></script>
</head>
<body>
<header style="text-align: center; margin-top:3%;">
<h3>Barcode Scanner</h3>
<hr/>
</header>
<div style="text-align: center; margin-top: 6%;">
<div id="scanblock"></div>
</div>
</body>
</html>
Run codeHide result
source
share