Vignes
Vignes

Reputation: 371

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).

Upvotes: 29

Views: 71883

Answers (2)

Nafees Ahmad
Nafees Ahmad

Reputation: 693

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). Make sure to add the protocol (probably http://) to the front or the value will be lost after restarting. 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

Upvotes: 51

Nitin Dhomse
Nitin Dhomse

Reputation: 2602

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/

Upvotes: 5

Related Questions