I am developing an app with javascript which records audio using html 5 audio context. I want to develop a feature which needs whether the current active sound device is connected microphone or default laptop/computer microphone and adjust its settings like decreasing its volume. Is there a way to achieve this ?
Asked
Active
Viewed 1,255 times
1 Answers
2
You can use the MediaDevices.getUserMedia() API method. The user will be prompted for permission to use the audio input device. Browser support is currently limited to Chrome, Firefox and Opera,see http://caniuse.com/#search=MediaRecorder.
navigator.mediaDevices.getUserMedia({ audio: true })
.then(function (stream) {
// the audio stream is available here
recorder = new MediaRecorder(stream);
// listen to dataavailable, which gets triggered
// when an audio blob is available
recorder.addEventListener('dataavailable', onRecordingReady);
});
function onRecordingReady(e) {
// e.data contains a blob that represents the recording
}

Dan Nagle
- 4,384
- 1
- 16
- 28