这是识别语音的代码,它会在几秒钟内停止录制。标题栏中的麦克风图标消失。
var streaming = new webkitSpeechRecognition();
streaming.lang = 'en-IN';
streaming.continuous = true;
streaming.interimResults = true;
streaming.onresult = function(event) {
l_pos = event.results.length - 1 ;
console.log(event.results[l_pos][0].transcript);
}
streaming.onend = function(event) {
console.log("1")
streaming.start();
console.log("2")
}
streaming.start();
如何让它连续记录?