implementing quagga scanning barcodes

Bart Van der Linden picture Bart Van der Linden · Apr 5, 2015 · Viewed 11.2k times · Source

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 !

Answer

Eugene picture Eugene · Apr 6, 2015

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