我正在使用文档中概述的离子原生语音识别:https://ionicframework.com/docs/native/speech-recognition
startListening() {
this.speechRecognition.startListening()
.subscribe(
(matches: Array<string>) => {
console.log(matches)
},
(onerror) => {
console.log('error:', onerror)
}
)
}但是,这只能侦听一定的时间。如果没有人发言,或者演讲者听不到,我会收到消息"Tap to speech . Try“。然而,为此,用户需要按下一个按钮才能再次说话。因此,有没有一种方法可以在这种情况发生时捕捉到,这样我就可以再次触发this.startListening()?
发布于 2019-04-24 22:20:50
我在文档中发现,语音识别只进行了5次,之后就停止了。
https://github.com/pbakondy/cordova-plugin-speechrecognition。
您可以使用以下选项开始收听:
let options = { String language, Number matches, // increase this number if don't want to stop listening String prompt, // Android only Boolean showPopup, // Android only Boolean showPartial }
this.speechRecognition.startListening(options) .subscribe( (matches: Array<string>) => console.log(matches), (onerror) => console.log('error:', onerror) )
https://stackoverflow.com/questions/55768435
复制相似问题