I want to access the microphone input with navigator.getUserMedia()
, but am unsure of how to proceed.
I can start the audio just fine, but I have no idea what to do with it after that.
if (!navigator.getUserMedia) {
navigator.getUserMedia = navigator.getUserMedia
|| navigator.webkitGetUserMedia
|| navigator.mozGetUserMedia
|| navigator.msGetUserMedia;
}
if (navigator.getUserMedia) {
navigator.getUserMedia({audio: true}, function (e) {
// what goes here?
}, function (e) {
alert('Error capturing audio.');
});
} else {
alert('getUserMedia not supported in this browser.');
}
I would like to access it as a stream. I don't even need stereo, just a way to get the data.
EDIT: I want to send the data back to the server using websockets, to create a sort of intercom system. Here, i need to be able to access a simple audio stream, stopping and starting it on certain events.