Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

implementing quagga scanning barcodes

I am making an online scan application just with HTML5 and javascript using Quagga.js.

I need to get the webcam working for searching barcodes and imported quagga.js :

On the web page of quagga you'll find a method called Quagga.init. to initialize the webcam view. I entered in the script tags this code :

Quagga.init({
    inputStream : {
      name : "Live",
      type : "LiveStream"
    },
    decoder : {
      readers : ["code_128_reader"]
    }
  }, function() {
      console.log("Initialization finished. Ready to start");
      Quagga.start();
  });

But nothing happened. What do I need to do to get this webcam working? Any other opinions to create a web-based application for scanning barcodes ?

Thank you for answering !

like image 233
Bart Van der Linden Avatar asked Apr 05 '15 13:04

Bart Van der Linden


2 Answers

Include <div id="interactive" class="viewport"></div> into your markup.

like image 190
Eugene Avatar answered Sep 29 '22 06:09

Eugene


It's a few months old question but Eugene's answer is not full. For me, to make QuaggaJS work I had to add video tag as well:

<div id="interactive" class="viewport">
    <video autoplay="true" preload="auto"></video>
</div>
like image 43
Raff W Avatar answered Sep 29 '22 07:09

Raff W