我開始使用此瀏覽器(chrome)功能。 我已經寫了一個JS的基礎上,但問題是,它只識別一次講話,並結束。它不會持續,我需要一直按下按鈕開始語音識別。告訴我我應該在哪裏調整。我已經設置「recognition.continuous = true」仍然沒有幫助?使用Webkit語音API進行連續語音識別
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」!這就是它