16

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

Vignes
  • 241
  • 1
  • 3
  • 5
  • I was able to retain the setting on my desktop, but on mobile, I had the same problem you report. Are you using mobile? – James Newton Jul 18 '19 at 02:13

3 Answers3

31

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

Nafees Ahmad
  • 473
  • 5
  • 7
3

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/

Nitin Dhomse
  • 2,524
  • 1
  • 12
  • 24
0

Update: this flag trick from Nafees Ahmad works for Chrome 89, also Chrome Android (I use huawei Mate 20 pro). It helps the website on Chrom access camera or NFC function.

ngock
  • 25
  • 4