Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have quirc run in the browser by compiling to web assembly #76

Closed
wants to merge 47 commits into from

Conversation

JaapHaitsma
Copy link
Contributor

You need to install emscripten See: https://emscripten.org/docs/getting_started/downloads.html

After that run
make quirc.js

Then serve the js directory in a webserver and open demo.html in your browser and you will see that your browser recognized the QR code

I made also PWA app that uses the the js library. Open it with your phone https://qrcode-quirc.glitch.me/ It also works offline and you can install it. The only I still need to do is show the detected QR code in a nice interface. If you click on the QR code icon it will copy it to the clipboard.
If you are interested in the code of the app you can find it here https://glitch.com/edit/#!/qrcode-quirc?path=script.js%3A1%3A0

Nice thing is that because all the heavylifting is in the wasm engine that it runs quite smoothly even on an older mid range processor like a snapdragon 625

What I did in a nutshell to get quirc in the browser

  • Add a cpp wrapper to quirc
  • Make a webidl file such that emscripten knows how to map cpp class to javascript
  • Build the wasm and corresponding js binding with emscripten
  • Write a wrapper QuircJS.js around this to make using the resulting library easier

@dlbeer
Copy link
Owner

dlbeer commented May 25, 2020 via email

@JaapHaitsma
Copy link
Contributor Author

JaapHaitsma commented May 25, 2020 via email

@dlbeer
Copy link
Owner

dlbeer commented May 25, 2020 via email

@JaapHaitsma
Copy link
Contributor Author

Daniel,

I made a separate repo https://github.com/JaapHaitsma/QuircJS where I put quirc as submodule. So closing this merge request.

@kaworu
Copy link
Collaborator

kaworu commented May 26, 2020

Should we have a list of theses type of projects, i.e. "versions" of quirc, in the README?

@dlbeer
Copy link
Owner

dlbeer commented May 26, 2020 via email

@kaworu kaworu mentioned this pull request May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants