QuaggaJS is a barcode-scanner entirely written in JavaScript supporting real-time localization and decoding of various types of barcodes such as EAN and CODE128. The library is also capable of using getUserMedia to get direct access to the user's camera stream.
http://serratus.github.io/quaggaJS/
examples with webcam, etc http://serratus.github.io/quaggaJS/examples/
blog post: http://www.oberhofer.co/how-barcode-localization-works-in-quaggajs/