I'm using a simple Speech to text detection with webkitSpeechRecognition
.
This code works great on Windows Desktop.
But - on Android Chrome browser - When starting detection, the microphone on the Android status bar shows only for 1 or 2 seconds. If there is no voice activity - it turns off and the voice recognition stops. If I do speak very fast after clicking "Start", it stays on.
Any ideas how to make the Android microphone available at all time?
if ('webkitSpeechRecognition' in window) {
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.onstart = function () {
$("#status").html("Status: Recording...");
recognizing = true;
};
recognition.onerror = function (event) {
alert(event.error);
};
recognition.onend = function() {
recognizing = false;
};
recognition.onresult = function(event) {
var interim_transcript = '';
for (var i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
final_transcript += event.results[i][0].transcript;
} else {
interim_transcript += event.results[i][0].transcript;
}
}
final_transcript = capitalize(final_transcript);
$("#final_span").html(linebreak(final_transcript));
$("#interim_span").html(linebreak(interim_transcript));
};
}