cozmo / jsQR

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
https://cozmo.github.io/jsQR/
Apache License 2.0
3.64k stars 602 forks source link

Installation/usage issue #146

Closed HuTieu closed 2 years ago

HuTieu commented 4 years ago

With my iPhone I accessed the demo app at https://cozmo.github.io/jsQR/ and successfully scanned a QR code. I then cloned the demo html page, the javascript source jsQR.js and placed them on my IIS site. I changed the source reference in the html page to the correct script source location /Scripts/jsQR.js. Now, when I accessed the demo page on my web server using the same iPhone, the page is loaded with the message to allow camera access but the camera is not open!

I have verified that the page and script loaded correctly. What am I missing? Thanks!

cozmo commented 4 years ago

This sounds like an issue with webcams/getUserMedia, which I unfortunately don't know much about.

That said I believe getUserMedia calls require http (or maybe https?) to work - Are there errors in the console?

SantoshPisini commented 4 years ago

getUserMedia needs https, but to run in localhost chrome you can go to 1) chrome://flags/#unsafely-treat-insecure-origin-as-secure 2) Find the "Insecure origins treated as secure" under that. 3)Enable it and enter your local URL (example: http://192.168.0.1 or http://192.168.0.1:5500 if using live server ) 4) Restart the chrome and then refresh the page.