ios - cordova-plugin-speechrecognition 在 adrioid 上运行良好,但在 ios 13.3 中失败
问题描述
我创建了 ionic 应用程序并使用 cordova-plugin-speechrecognition 进行语音到文本的转换。这在 android mobile 和 ios 模拟器中运行良好,但不适用于 IOS 13.3
initSpeech() {
this.speechRecognition.hasPermission()
.then((hasPermission: boolean) => {
console.log(hasPermission)
if (!hasPermission) {
this.speechRecognition.requestPermission()
.then(
() => console.log('granted'),
() => console.log('Denied')
)
}
})
}
start() {
// Start the recognition process
this.speechRecognition.startListening()
.subscribe(
(matches: Array<string>) => { this.voicetext = matches[0]; this.mainForm.controls['comments'].setValue(matches[0]); },
(onerror) => console.log('error:', onerror)
)
}
//stop listening for(ios only)
stop() {
this.speechRecognition.stopListening();
}
链接https://ionicframework.com/docs/native/speech-recognition中指定的代码是我使用的。
对于 IOS,我还实现了停止监听并在 ios 的 info.list 中添加了 NSMicrophoneUsageDescription 权限 NSSpeechRecognitionUsageDescription 权限。
请帮我解决一下这个。提前致谢
解决方案
它实际上有效,但有延迟,因此无法识别它被触发。
推荐阅读
- php - 添加`$b ?? []` 到 PHP 中的数组
- ios - UINavigationBar 自定义颜色细线边框
- ios - 界面生成器中的 iOS 阴影视图
- r - 使用 dplyr 将开始和结束日期扩展到不平衡的每月面板
- android - 尝试使用 FirebaseUI RecylerView 显示数据时应用程序崩溃
- javascript - 将数据从php导出到html网页
- r - R-一种方法anova提取p_value
- sql - golang db.ping()
- python-3.x - Outlook FreeBusy 方法给出不正确的输出
- ios - 禁用从 UITabBarController 滑动