0
我在嘗試嵌入語音識別API,但下面的代碼失敗。控制不進入功能(事件)。有人可以幫助和建議。忽略HTML5語音識別回調
function startDictation() {
if (window.hasOwnProperty('webkitSpeechRecognition')) {
var recognition = new webkitSpeechRecognition();
recognition.continuous = false;
recognition.interimResults = false;
recognition.lang = "en-US";
recognition.start();
recognition.onresult = function(event) {
document.getElementById('transcript').value = event.results[0][0].transcript;
console.log(event);
recognition.stop();
document.getElementById('saurabh').submit();
};
recognition.onerror = function(event) {
console.log("Hello");
console.log(recognition.onerror);
recognition.stop();
}
}
}
請分享html代碼以便調試 –