Currently, I am working on a project where I need to work with an audio from the users. I need to ask the user for a micrphone to be connected so I can intialize his speaking with x-webkit speech - the main problem is that the user need's to click on a button and to speak always when he needs to speak - I want the browser to ask the user if the website can make use of the micrphone and if the user accepts the request the x-webkit will work and stay live. How can I make the x-webkit speech stay live without forcing the user clicking over the button?
Thanks!
I think you need Webrtc getusermedia`
//get audio
navigator.getUserMedia({audio:true}, gotStream);
.
//display audio
function gotStream(stream) {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var audioContext = new AudioContext();
// Create an AudioNode from the stream
var mediaStreamSource = audioContext.createMediaStreamSource(stream);
// Connect it to destination to hear yourself
// or any other node for processing!
mediaStreamSource.connect(audioContext.destination);
}
Quick start: http://www.html5rocks.com/en/tutorials/webrtc/basics/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With