Reputation: 1227
Can we access microphone of mobile to record our voice using HTML5?
I was trying this link:
http://www.html5rocks.com/en/tutorials/getusermedia/intro/
where I get
< input type="file" accept="audio/*;capture=microphone">
I used the following input tag to access microphone but it didnt worked in the HTML viewer of device.
Please help.
Thanks in advance.
Upvotes: 2
Views: 8531
Reputation: 30434
Which browser are you using? You can use getUserMedia rather than input type="file"
. This demos works in Chrome desktop: http://jsfiddle.net/GD63T/2/ but to work in Chrome for android you have to turn it on using chrome://flags
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
var audio = document.querySelector('audio');
if (navigator.getUserMedia) {
navigator.getUserMedia({
audio: true,
video: false
}, function (stream) {
audio.src = window.URL.createObjectURL(stream);
}, onFailSoHard);
} else {
alert("sorry, not supported in your browser");
}
Upvotes: 1