schmich / instascan

HTML5 QR code scanner using your webcam
https://schmich.github.io/instascan/
MIT License
2.97k stars 865 forks source link

No cameras found on my android #150

Open fannlock opened 6 years ago

fannlock commented 6 years ago

It work on my laptop webcam, but not work on my android..... But your demo work on my android device.

1895496375

demimurych commented 6 years ago

https:// nedded

ralyodio commented 6 years ago

I tried with a self-signed cert after loading up https://localhost:8443 via my android inside chrome debugger's remote devices, I still can't see the camera. No errors or anything. I thought that https would fix it but apparently not. Also the demo works on android/chrome but not my version.

md8n commented 6 years ago

Have you also checked your Content Security Policy settings?

ralyodio commented 6 years ago

Not sure how do I check this?

md8n commented 6 years ago

If you are using the Chrome Remote Debugger - then a CSP violation will show up. A CSP is a list of clauses covering different kinds of content - these are separated by semi-colons. Then each clause you have the type of content, followed by a space delimited list of terms. So something like this (I've formatted it to be a little more readable):

Have a look at MDN for more info.

md8n commented 6 years ago

And it dropped the content - I'll try again:

    <meta http-equiv="Content-Security-Policy" content="
        default-src https://codepush.azurewebsites.net * gap://ready file:;
        style-src 'self' 'unsafe-inline' *;
        script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *;
        img-src data: 'unsafe-inline' blob: *;
        worker-src blob:;
        child-src blob:;">
md8n commented 6 years ago

For a barcode scanner you'll almost certainly need blob: defined for script-src, img-src and worker-src, and probably also child-src

ralyodio commented 6 years ago

My implementation doesn't work in android 7. It works fine in 4, 6, 8

jordanmarvin commented 5 years ago

i have the same issue.. no cameras found in my mobile android.. plss help how to fix