我开始使用这个浏览器(chrome)功能。我已经基于此编写了一个 JS,但问题是偶数,它只识别一次语音并结束。它不会连续运行,我需要一次又一次地按下按钮才能开始语音识别。告诉我应该在哪里调整。我设置了“recognition.continuous=true”仍然没有帮助?
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();
}
我从一个按钮调用“start_speech”!而已