javascript - mac Safari 上的 SpeechRecognition 事件监听器
问题描述
我正在使用 Web API SpeechRecognition 构建应用程序,但 onspeechstart 和 onspeechend 侦听器不起作用。 https://developer.mozilla.org/ja/docs/Web/API/SpeechRecognition
Safari 的版本是 15.0。
相关代码如下。语言是打字稿(javascript)。
const SpeechRecognitionrecognition = (window as any).webkitSpeechRecognition;
speechRecognizer = new SpeechRecognitionrecognition();
speechRecognizer.onspeechstart = () => {
// Process when the user starts speaking
};
speechRecognizer.onspeechend = () => {
// Processing when speech is finished
};
在 Safari 中使用这些事件侦听器是否需要任何设置?如果您对此有所了解,如果您能告诉我,我将不胜感激。
解决方案
推荐阅读
- django - 我应该将 Flutter Web 用于不应该在夏季之前投入生产的网站项目吗?
- db2 - 无法在 IBM Cloud 中创建数据库实例
- git - git log --reflog vs git reflog
- c - 试图在 int 变量中存储无效的十六进制数
- android - React-Native Native UI 组件不调整大小(Android)
- c++ - 图 BFS 遍历 - C++
- c - 如何从结构数组中获取所有元素,并将它们添加到 c 中的字符串中?
- angular - 从变量 Angular 9 渲染组件
- javascript - 如何以不同的方式处理异步需求?
- python - 将 Pandas 数据帧保存到 csv 时更改浮动值的原因