Bruno Bruno - 9 months ago 67
Javascript Question

Javascript: Get the browser's selected microphone name

I'm trying to build a function to get the browser's selected microphone name via Javascript. Like if we have several microphones in the system and the browser have one selected, I need to know his name to use it in other functions.

I tryed the getUserMedia method but i can't figure how to get the microphone name with this. And, as I read in some articles there are some incompatibilities with google chrome.

Is there any other way to get this info?

  • navigator.mediaDevices.enumerateDevices()


.then(function(devices) {
  devices.forEach(function(device) {
    console.log(device.kind + ": " + device.label +
            " id = " + device.deviceId);

Supported by Chrome 45, Firefox 39

  • MediaStreamTrack.getSources()



MediaStreamTrack.getSources(function(sourceInfos) {
  for (var i = 0; i != sourceInfos.length; ++i) {
    var sourceInfo = sourceInfos[i];
    console.log(, sourceInfo.label);

Deprecated in Chrome 45, removed in Chrome 47.

getUserMedia MUST be invoked before 'enumerateDevices' or 'getSources' methods