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.
If you mean you want access to the raw samples of the ongoing audio stream - use a ScriptProcessorNode in Web Audio ( http://webaudio.github.io/web-audio-api/#ScriptProcessorNode ). RecordJS, mentioned above, will help show you how to do this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.