Skip to content Skip to sidebar Skip to footer

Web Audio Api Input From Specific Microphone

I'm using the Web Audio Api ( navigator.getUserMedia({audio: true}, function, function) ) for audio recording. If the user has several microphone devices, can I select the desired

Solution 1:

You want to use device enumeration and a deviceid constraint. As per @cwilso's answer, https://webaudiodemos.appspot.com/input/index.html is an example that works in Chrome. If you change the default microphone in the OS, Chrome should pick it up.

Firefox is adding deviceIds and constraints, but they haven't hit release yet. Currently on firefox the user can select any audio device for input if they don't select "Allow Always" when approving (if they do, then it will select the default device without asking the user). Note that Allow Always requires loading over https, and it's not the default action (unlike Chrome).

Solution 2:

You can (select the input device) - take a look at https://webaudiodemos.appspot.com/input/index.html, which lets the user select the input. Note that you won't get access to the actual names unless you serve securely (https instead of http).

Solution 3:

You can select any recording device you want with Web Audio API, look at https://jsfiddle.net/bomzj/beap6n2g/.

Post a Comment for "Web Audio Api Input From Specific Microphone"