0

I am developing an application that uses WebRTC and I want Chrome to use the system camera. From what I understand, the use of the camera is allowed (in the latest versions of Chrome) only from "secure locations" (https://www.chromium.org/Home/chromium-security/deprecating-powerful-features-on-insecure-origins), like localhost and 127.0.0.1.

I want to test it locally and connect to the server both from a client that resides on the same pc as the server, and from a client from another pc. In particular, the client that connects from another pc needs to connect to the server using its IP address (I am developing/testing it in an Intranet), but the client cannot use the camera because it is not calling localhost.

Is there a way to disable this constraint, so that I am able to test it in an Intranet? If not, are there any alternatives?

Luigi Rubino
  • 564
  • 1
  • 7
  • 17
  • I think you will have to create some kind of certification in order to use it with https... I had to do something like this.. https://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl. If you are using node.js....something like.. var options = { key:fs.readFileSync('./cert/file.pem'), cert:fs.readFileSync('./cert/file.crt') }; Regards – Albeis Jun 16 '17 at 13:54
  • I did it, but the browser recognizes it as an auto-generated certificate and considers it as insecure. This way, every time I load the page, scripts are not loaded, and I need to accept them manually, causing a page reload, which I do not want because it restarts my Angular application. – Luigi Rubino Jun 16 '17 at 13:59
  • Ups, I did it with pure javascript..Regards – Albeis Jun 16 '17 at 14:12

1 Answers1

0

try the unsafely-treat-insecure-origin-as-secure flag in Chrome: http://peter.sh/experiments/chromium-command-line-switches/#unsafely-treat-insecure-origin-as-secure

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31
  • Unfortunately, I keep getting the same error: NotAllowedError: Only secure origins are allowed (see: "https:// goo.gl/Y0ZkNV"). I tried: open /Applications/Google\ Chrome.app/ --args --unsafely-treat-insecure-origin-as-secure=http://192.168.1.8 --user-data-dir=/Users/luigi/Documents/tmp/chrome I have also seen this message in the console: VM230:1372 [Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See "https:// goo.gl/rStTGz" for more details. – Luigi Rubino Jun 16 '17 at 19:49