2

In a working webRTC app (voice only) I came across a weird bug: When prompted to select the audio input via getUserMedia() it seems that any other microphone but the built in will work.

Although the selection results in no immediate errors, there is no signal transferred when a webRTC connection is established - the line stays silent. If I select the internal microphone, everything works as expected.

I tested this with Chrome and Firefox to no avail.

Anybody more information on this behavior?

EDIT SEPTEMBER, 13th

More info on test setup: Chrome 45, with experimental features on. Chrome will list the external audio sources via navigator.mediaDevices.enumerateDevicesbut will result in no sound at all when anything else but external mic is chosen from gUM input select.

The question: Is there ANYBODY that managed to get an external mic to work with webRTC?

Armin Hierstetter
  • 1,078
  • 2
  • 12
  • 27
  • 1
    Does the microphone show up when do use the deviceEnumeration API? http://stackoverflow.com/questions/14610945/how-to-choose-input-video-device-for-webrtc – Benjamin Trent Sep 11 '15 at 13:18
  • It lists the mic in the input select that pops up as soon as getUserMedia is invoked, but I have not tried deviceEnumeration yet. Will look into this. – Armin Hierstetter Sep 11 '15 at 13:52
  • 1
    Firefox does not yet support devices selection with getUserMedia, so, for now, rule that out. – xdumaine Sep 11 '15 at 14:46
  • @xdumaine, why does firefox then bother showing the selection in the first place? bug? – Armin Hierstetter Sep 11 '15 at 18:43
  • xdumaine - Firefox should support device selection just fine. @BenjaminTrent - that device enumeration link is outdated by two years. Instead, see http://stackoverflow.com/a/31758598/918910 – jib Sep 11 '15 at 21:01
  • Glad to see an update :). I have not messed directly with that API. – Benjamin Trent Sep 11 '15 at 21:25
  • @jib are you talking about the browser device selection menu, or choosing devices with getUserMedia? Has that changed in the last couple weeks? I was testing with nightlies just a couple weeks ago and it still had no support, for example with https://webrtc.github.io/samples/src/content/devices/input-output/. Device enumeration worked, but no matter waht was passed to gUM, it used the device default. I'm remote right now and don't have a second media device to test with. – xdumaine Sep 11 '15 at 22:11
  • @xdumaine the deviceId constraint was added to gUM in Firefox 42 [two months ago](https://bugzilla.mozilla.org/show_bug.cgi?id=1037389). I'm using your link right now in Firefox 42 for android, and it works to switch between front and back camera using that page. – jib Sep 12 '15 at 01:55
  • @jib Camera is not what I am questioning: I am questioning microphones. I am using the latest Firefox on Mac and it definitely does *not* work. If something other than internal mic is chosen, there is silence. – Armin Hierstetter Sep 12 '15 at 02:16
  • @jib But I confirm the names using the example above are now more descriptive than before (proper names instead of "microphone 1"). Unfortunately, that does not solve my question. – Armin Hierstetter Sep 12 '15 at 02:26
  • @Armin note that Firefox release is 40 right now. deviceId gUM constraint requires 42+ (Firefox Developer Edition or Nightly). Is it working to pick microphone in Firefox's built-in device selector that pops up as part of the gUM permission prompt at least? That should work in any version. – jib Sep 12 '15 at 04:34
  • @jib No, that's exactly the issue. Neither Firefox nor Chrome (Mac) will work as expected when I select any other Mic than the internal (built in). – Armin Hierstetter Sep 12 '15 at 11:28
  • As a side note: It is said in http://stackoverflow.com/questions/31754529/how-to-get-hardware-information-of-in-build-microphone/31758598#31758598 that this fiddle https://jsfiddle.net/864jm6zk/ (navigator.mediaDevices.enumerateDevices) would work in Chrome 45. Not for me. (Mac) – Armin Hierstetter Sep 12 '15 at 11:36
  • @ArminHierstetter it works in Chrome 45 only if you enable the Experimental Features flag. – xdumaine Sep 12 '15 at 13:41
  • @xdumaine Ahhh, thanks, stupid me! – Armin Hierstetter Sep 12 '15 at 15:56
  • @Benjamin To finally answer you question: Yes, Chrome lists the external audio device. But when I select it, there is no sound. – Armin Hierstetter Sep 13 '15 at 07:45
  • @jib the example I linked above does not work in Firefox 42.0 for mac. It always uses the camera set in the permissions dialog. It does not matter what device is passed into gUM. – xdumaine Sep 18 '15 at 20:48
  • @jib I've also created a basic example using `deviceId` constraint and it has no effect in FF 42 on mac. – xdumaine Sep 18 '15 at 20:57
  • @xdumaine I've [submitted a fix for that page](https://github.com/webrtc/samples/pull/647) (the device passed in should still be the default though). Make sure you use the form `deviceId: { exact: id }` to restrict choices. – jib Sep 18 '15 at 23:21

1 Answers1

0

Finally, I found the solution.

The reaons why no sound was picked up is rather simple: webRTC expects the mircophone attached to input channel 1 or 2 in case you use a microphone connected with an audio interface to your computer.

I have not found a way to tell my webRTC app to chose a different input channel, so the mic simply has to be channel 1 or 2.

BTW: The same is true for Skype. Any mic connected with an audio interface needs to be plugged into channel 1 – otherwise it will not be recognized as Skype seems to use channel 1 as default, too.

Armin Hierstetter
  • 1,078
  • 2
  • 12
  • 27