I have this code which accesses the microphone and reproduces the sound created from my microphone to my speakers. But it seems that it's not working. It accesses the microphone, and a red circle blinks slowly in the favicon, but seems like it's not producing any sound. I'm not sure but I think it's a problem with the tag. What do you think is the error here?
try {
navigator.getMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||navigator.msGetUserMedia);
navigator.getMedia ({
audio: true
},
function(stream) {
var audio = document.getElementById('audio');
var streamer = window.URL.createObjectURL(stream);
audio.src = streamer;
},
function(err) {
// No permissions
}
);
}
catch(e) {
alert('Error');
}
Above that script, the audio tag lies.
<audio src="" id="audio" controls="controls" autoplay>Sad twinkies does not have audio</audio>
So what do you think is the problem here?