API
- webkitSpeechRecognition
- continuous
- interimResults
- start/stop()
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.lang = 'zh-Hans';
...
recognition.start();
...
recognition.stop();
Events
start / result / error / end
recognition.onresult = onRecognitionResult;
function onRecognitionResult(event){
for(var i=0; i<event.results.length; i++){
var result = event.results[i];
console.log('result[i] = ' + result[0].transcript);
console.log('confidence = ' + result[0].confidence);
console.log('is final ? ' + result.isFinal);
}
}
Browser Support
Chrome Only
extend
- WebRTC
- Auto Caption
- Speech > Text
- HTML5 Audio