8

After updating from Chrome 73 to 74 navigator.getUserMedia and navigator.webkitGetUserMedia return undefined.

Here https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia I see that getUserMedia is actually deprecated in favor of navigator.mediaDevices.getUserMedia(), but in my case navigator.mediaDevices too is undefined so I cannot use it.

Anyone knows if it's a bug in the latest release of Chrome or if I need to use something else?

Dharman
  • 26,923
  • 21
  • 73
  • 125
Mauro Piccotti
  • 1,747
  • 2
  • 21
  • 32

3 Answers3

15

Since version 74 of Chrome navigator.getUserMedia, navigator.webkitGetUserMedia and navigator.mediaDevices can be used only in secure context (https), otherwise they are undefined.

I've understood what the problem was while writing the question, as usual...

Mauro Piccotti
  • 1,747
  • 2
  • 21
  • 32
3

I tried a small setting on chrome and it turned out to work for me.

I enabled: chrome://flags/#unsafely-treat-insecure-origin-as-secure

and provided my HTTP server link along with the port.

It worked for me.

You could refer to the following: 1. https://stackoverflow.com/a/61472984/12906501 2. https://medium.com/@Carmichaelize/enabling-the-microphone-camera-in-chrome-for-local-unsecure-origins-9c90c3149339

Hope it helps!! Thanks.

1

In my case HTTP was the cause of undefined for navigator.mediaDevices

with HTTPS works as expected

Alex
  • 7,986
  • 27
  • 93
  • 150