Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access Camera and Microphone in Chrome without HTTPS?

Is there any way to access the Microphone and Camera using chrome when the website is http?

I tried enabling "Insecure origins treated as secure" flag, however when the browser is closed and opened again, the domain used in this flag disappears and I have to retype and re-enable it again.

I also tried starting chrome with "--unsafely-treat-insecure-origin-as-secure=http://example.com" argument, however when this was used a message appears on Chrome saying

You are using an unsupported command line flag:--unsafely-treat-insecure-origin-as-secure=http://example.com. Stability and Security will suffer

I don't want the message to appear, so I couldn't use this technique as well.

Is there any other way to access the Microphone and Camera without getting any warnings? (I am accessing the device using WebRTC).

like image 328
Vignes Avatar asked Oct 11 '18 12:10

Vignes


2 Answers

This worked for me. Although it's for Testing purpose only.

To ignore Chrome’s secure origin policy, follow these steps. Navigate to chrome://flags/#unsafely-treat-insecure-origin-as-secure in Chrome.

Find and enable the Insecure origins treated as secure section (see below). Add any addresses you want to ignore the secure origin policy for. Remember to include the port number too (if required). Save and restart Chrome.

Remember this is for dev purposes only. The live working app will need to be hosted on https for users to be able to use their microphone or camera.

"unsafely-treat-insecure-origin-as-secure" flag is not working on Chrome

like image 129
Nafees Ahmad Avatar answered Oct 05 '22 15:10

Nafees Ahmad


You are not allowed to run webrtc on http after Chrome 47+ version, but you can do some hack for this with some changes in ngnix.cong file, as

//Make necessary changes
server {
        listen 8080;
        server_name localhost;
        location / {
            proxy_pass         http://your.dev.box.ip:8080;
        }
    }

Reference : https://webrtchacks.com/chrome-secure-origin-https/

like image 36
Nitin Dhomse Avatar answered Oct 05 '22 14:10

Nitin Dhomse