Giter Club home page Giter Club logo

reactive-qr's Introduction

Reactive-QR

Reactive QR Demo

React.js + HTML5 WebWorker QR Code scanner!

There is few other QR code scanner React components out there, but because non of them are using WebWorkers for concurrent image processing, performance is extremely bad on mobile devices, or if performance is fine, QR codes not always detected. Main bottleneck for decoding QR codes is to do it a lot in a short amount of time. In avg. from live camera decoder should process 20+ frames in other to recognize QR code text. So if component is doing that synchronous way, CPU goes high and UI is blocking, or you are just processing less frames to unblock UI, but getting poor accuracy.

This component aims to break that bottleneck with WebWorker as a main source of decoding images, which is the most CPU intensive operation. That allows to unblock UI and React component life cycle, and process frames whenever they are available from WebRTC video component.

Live working example: Demo

Installation

This is a regular NPM package which is currently using jsQR to decode captured frames. But because of the principle how this component built, QR code decoding library is working only in WebWorker, so we can change to any JS library without touching React component!

NPM

Component available on npm, and can be used with any bundler such us Webpack, Browserify or Gulp.

npm install --save reactive-qr
// ES6 import
import ReactiveQR from "reactive-qr";

.....
<ReactiveQR onCode={code => console.log(code)} />
.....

Props

Configurations

shouldDecode - Boolean | default: true

Sometimes we need to have a condition to stop or allow deciding images

rearCamera - Boolean | default: true

Choosing between rear and front cameras.

className - String

className for VideoStream component wrapper.

style - Object | default: {}

style object for wrapper component

videoStyle - Object | default: {}

style object for HTML5 video component, which displays camera stream

Events

onInit - Function(error: Boolean, message: String)

This function triggers when camera is ready to process images. This mainly happens when HTML5 Camera API receives callback that camera exists on device and hardware initialization is completed.

onCode - Function(code: String)

Callback when there is a valid decoded QR code text. Sometimes QR code text can be irrelevant because of the image decoding issues when there is a lighting issues, or image quality is poor. So you definitely have to check decoded text.

reactive-qr's People

Contributors

joshgentry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

reactive-qr's Issues

Not working

Hi I tried using the steps to load the component on a react project. It doesn't seem to be working.

Demo broken

it doesn't look like anyone is maintaining this module. does anyone know of a React component that actually works? everything I've seen out there is dead in the water

Latest changes not published to NPM

Checking from a fresh npm install, I can see that the changes (changes that are necessary to run) made in #6 are not reflected in the downloaded code.

Not sure what your deploy process is, but there hasn't been a version change since, so if your deploy to npm is triggered by a patch I don't think it's been kicked off. At the very least, a manual publish to NPM should resolve.

Import errors

Similar to #3 I am getting
./node_modules/reactive-qr/dist/index.js Attempted import error: './qr_decode.worker' does not contain a default export (imported as 'QRWorker')

When running a minimal example. I am using HTTPS.

Error on import reactive-qr

I get this error when I import your ReactiveQR component :

Uncaught TypeError: Cannot read property 'length' of undefined
at Object.binarize (jsQR.js?ae76:389)
at x (jsQR.js?ae76:332)
at eval (qr_decode.worker.js?2c11:9)

Maybe you know why and how to solve it? ๐Ÿคทโ€โ™‚๏ธ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.