Skip to content

sugakenn/barcodescanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

barcodescanner class

image

バーコードスキャンライブラリQuaggaJSのブラウザ実装です。日本語の解説はブログ:「QuaggaJSを使ってブラウザでバーコードスキャン」に載せています。

A browser implementation of the barcode scan library QuaggaJS

Require

QuaggaJS

Optional

WebRTC adapter

Usage

  • import QuaagaJS

  • import WebRTC adapter(Optional)

  • import or copy barcodescanner.js

  • write html

    <div clas="control"><input type="tel" id="barcode-input" maxlength="13" /><button onClick="toggleScan()">start/stop</button></div>

    <div id="barcode-wrapper" style="visibility: hidden; border: 2px solid #099;">

    <canvas id="barcode-view"></canvas>

    <p id="message">initializing camera</p>

    </div>

  • make instance in script like this

    const barcodescanner = new ( videoSizeW, videoSizeH, viewSizeW, viewSizeH, targetSizeW, targetSizeH, borderLineSize, scanInterval, validationCnt);

    • videoSize: Background video size.
    • viewSize: View in HTML size.
    • targetSize: Area of sending QuaagaJS
    • borderLineSize: guide line size
    • scanInterval: Interval to send to QuaagaJS(milliseconds)
    • validationCnt: If the same code value is obtained the specified number of times, it is considered successful.

The html button event calls the method in the barcodescanner.js class b to window.togglescan

About

quaggajs implementation class

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published