2

I'm using enumerateDevices (See reference here) to get the user's camera and microphones list.

This code works great on Chrome:

$(document).ready(function(){
    navigator.mediaDevices.enumerateDevices()
    .then(gotDevices)
});

But since it's unsupported on IE, it throws an error:

Unable to get property 'enumerateDevices' of undefined or null reference

My question: Is there any alternative I can use that works across all browsers?

Kaiido
  • 123,334
  • 13
  • 219
  • 285
Koby Douek
  • 16,156
  • 19
  • 74
  • 103
  • So you are talking about InternetExplorer, not Edge right ? Because Edge does support `enumerateDevices`, but IE doesn't support anything from the MediaStream API, so I wonder what you'll do with this list of devices, even if it were possible to get it ? (ps : it isn't from web API, maybe some flash, or java, or who knows what, can tell). – Kaiido Apr 03 '17 at 12:15
  • Yes, I need IE support as well. – Koby Douek Apr 03 '17 at 12:20
  • @Kaiido I use webRTC which is supported in IE 10,11. the get devices is just to make sure that the user has a camera and a mic. – Koby Douek Apr 03 '17 at 12:21
  • How ? IE doesn't support getUserMedia, I guess you are using some flash or java fallback aren't you ? If so, don't tag your question javascript, you won't have any js solution. And check with he authors of your fallback if they provide a way to get this list somehow – Kaiido Apr 03 '17 at 12:23
  • IE does support it. – Koby Douek Apr 03 '17 at 12:25
  • Hum [nope](http://caniuse.com/#feat=stream) and this from any source and from my VMs too. You probably have a plugin. – Kaiido Apr 03 '17 at 12:26
  • PS: if your plugin makes the `MediaStreamTrack` object available, and its `getSources()` method (normally blink only), you could try with it, just like the [adapter.js](https://github.com/webrtc/adapter/blob/master/release/adapter.js#L1140) shim does. – Kaiido Apr 03 '17 at 12:42
  • See http://stackoverflow.com/questions/24676240/how-to-access-webcam-via-internet-explorer-11. Any support for what you're asking would need to come from the polyfill you're using for `getUserMedia`. The two go together. – jib Apr 03 '17 at 19:27

2 Answers2

11

navigator.mediadevices can also be undefined in insecure context.

You need to have https: instead of http:


There's some experiment flags on chrome to allow it:

chrome://flags/#allow-insecure-localhost

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

Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
0

According to mediaDevices.enumerateDevices method api. This method doesn't support IE.

Browser Compatibility for This method are:

chrome : 45.0
FireFox(GecKo) : 39
Internet Explorer: not supported
opera: not supported
safari(webKit): not Supported

Hope This Helps!

saktivel
  • 64
  • 6
  • Flash has access to the users camera and mic (if they have enabled it in their Flash control panel)... you might first feature test for mediaDevices support and if not fall back to a third party flash control (flash is an ActiveX control in MSIE). This web search link lists Flash chat applications. http://www.bing.com/search?q=flash+chat+applications – Rob Parsons Apr 03 '17 at 22:00