为web应用添加iOS语音识别支持? [英] Add iOS speech recognition support for web app?

查看:122
本文介绍了为web应用添加iOS语音识别支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,除移动iOS以外,所有设备的HTML5网页语音API都适用于谷歌浏览器。文字转语音作品,但不支持语音转文字。不支持 webkitSpeechRecognition 。请参阅: Chrome iOS Webkit语音识别



我无法找到解决方法。我想为我的当前使用语音识别和语音合成的网络应用添加iOS语音识别支持。有什么建议么?谢谢。

解决方案

尝试类似这样的操作

  recognition = new(window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition)(); 
recognition.lang =en-US;
recognition.interimResults = false;
recognition.maxAlternatives = 5;
recognition.onresult = function(event){
speechResults = event.results [0] [0] .transcript;
};
recognition.start();

设置识别变量的方式可以支持各种浏览器。
我在编织 =nofollow noreferrer> LiveWeave 。


Currently, the HTML5 web speech api works great on google chrome for all devices except mobile iOS. Text-to-speech works, but speech-to-text is not supported. webkitSpeechRecognition is not supported. See: Chrome iOS webkit speech-recognition

I am unable to find a workaround. I would like to add speech recognition support for iOS to my current web app that uses speech recognition and speech synthesis. Any suggestions? Thank you.

解决方案

Try something like this

recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition)();
recognition.lang = "en-US";
recognition.interimResults = false;
recognition.maxAlternatives = 5;
recognition.onresult = function(event) {
  speechResults = event.results[0][0].transcript;
};
recognition.start();

The way the recognition variable is setup allows support for a variety of browsers. I made a Weave at LiveWeave.

这篇关于为web应用添加iOS语音识别支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆