i started using this browser(chrome) feature. i ve written a JS based on this , but the problem is even , it recognises the speech only once and ends . its not going continuously, i need to press the button again and again to start speech recognition . tell me where i should tweak . i ve set "recognition.continuous=true" still not helping ?
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.onstart = function() {
console.log("Recognition started");
};
recognition.onresult = function(event){
console.log(event.results);
};
recognition.onerror = function(e) {
console.log("Error");
};
recognition.onend = function() {
console.log("Speech recognition ended");
};
function start_speech() {
recognition.lang = 'en-IN'; // 'en-US' works too, as do many others
recognition.start();
}
I call "start_speech" from a button ! thats it
The HTML5 Speech Recognition API allows JavaScript to have access to a browser's audio stream and to convert it to text. I'm going to show you how to use the web speech API so that you can invite your users to talk with your current or future web application.
Continuous speech recognition systems allow the user to talk to the system without stops and pauses. Continuous speech recognition systems can recognize more utterances than a command-and-control system. The guidelines for continuous speech recognition differ somewhat from those for command-and-control.
I know this is an old thread, but I had this problem too. I found that, even with the continuous flag set, if there are pauses in the input speech, a "no-speech" error gets thrown (triggers the onerror event) and the engine is shut down. I just added code in the onend to restart the engine:
recognition.onend = function() {
recognition.start();
};
The next problem you might get is, every time the engine restarts, the user has to re-grant permission to let the browser use the microphone. The only solution at this time seems to be to make sure you connect to your site over HTTPS (source: http://updates.html5rocks.com/2013/01/Voice-Driven-Web-Apps-Introduction-to-the-Web-Speech-API bottom of post in bold)
Perhaps the typo on this line:
recognition.continuos = true;
Should equal:
recognition.continuous = true;
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