简体   繁体   English

是否可以使用 JavaScript 以编程方式在 iOS 移动 Safari 中的文本输入表单字段上触发语音听写?

[英]Is it possible to programmatically trigger voice dictation on a text input form field in iOS mobile Safari using JavaScript?

I need for the voice input functionality on the iOS keyboard to trigger programmatically via JavaScript by clicking on a microphone icon.我需要通过单击麦克风图标通过 JavaScript 以编程方式触发 iOS 键盘上的语音输入功能。 Not just by detecting the "paste" event: I mean prompting the user for voice dictation.不仅仅是通过检测“粘贴”事件:我的意思是提示用户进行语音听写。

I know that iOS sports VoiceOver at the OS level, but other than a few accessibility attributes, I am unable to find any references how to manipulate voice input on an HTML text field.我知道 iOS 在操作系统级别运行 VoiceOver,但除了一些可访问性属性之外,我找不到任何关于如何在 HTML 文本字段上操作语音输入的参考。

I have seen demos of the WebKit Speech API such as this , but none of them are honored in iOS mobile Safari.我看过像这样的 WebKit Speech API 的演示,但没有一个在 iOS 移动 Safari 中受到尊重。 Nor does adding the now deprecated -x-webkit-speech attribute to my text input fields.也不会将现已弃用的 -x-webkit-speech 属性添加到我的文本输入字段。 I have also seen people suggest wrapping web apps using PhoneGap, which doesn't actually solve the problem.我还看到有人建议使用 PhoneGap 包装网络应用程序,这实际上并没有解决问题。

I have searched exhaustively and even Stack Overflow's automatic scrubbing for my answer didn't help.我已经进行了详尽的搜索,甚至 Stack Overflow 对我的答案的自动清理也没有帮助。

Any wisdom on how one might go about doing this or if it's even possible?关于如何去做这件事或者是否有可能的任何智慧? Thanks in advance!提前致谢!

You are asking about speech recognition, right?你问的是语音识别,对吧? That's not supported by safari yet, maybe iOS 8 brings it. safari 还不支持,也许 iOS 8 会带来它。

Wrapping the web app using Phonegap might be a solution if you use one of the speech recognition plugins available, but your user will need to use the app instead the regular browser.如果您使用可用的语音识别插件之一,则使用 Phonegap 包装 Web 应用程序可能是一种解决方案,但您的用户将需要使用该应用程序而不是常规浏览器。

As you talk about Voice Over, thats for Text To Speech, not Speech recognition, Text To Speech is possible with iOS 7, take a look to this article http://www.sitepoint.com/talking-web-pages-and-the-speech-synthesis-api/ and this live demo http://aurelio.audero.it/demo/speech-synthesis-api-demo.html当你谈论旁白时,那是文本到语音,而不是语音识别,iOS 7 可以实现文本到语音,看看这篇文章http://www.sitepoint.com/talking-web-pages-and- the-speech-synthesis-api/和这个现场演示http://aurelio.audero.it/demo/speech-synthesis-api-demo.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以编程方式在iOS设备上的输入字段中选择文本(移动版Safari) - Programmatically selecting text in an input field on iOS devices (mobile Safari) 使用javascript以编程方式触发iOS safari中的复制菜单? - Programmatically trigger copy menu in iOS safari using javascript? iOS5移动Safari:使用语音助手处理HTML输入文本键盘上/下键? - iOS5 Mobile Safari: Handle HTML Input Text keyup/keydown with Voice Assistant? 以编程方式关注移动 Safari 中的下一个输入字段 - Programmatically focus on next input field in mobile safari 使用 JavaScript 在 iOS 上停止听写 - Stop dictation on iOS using JavaScript 是否可以在Mobile Safari中使用Javascript在输入或文本区域上调用键盘? - Is it possible to invoke the Keyboard on an input or textarea using Javascript in Mobile Safari? 使用javascript / VBA以编程方式输入angularjs文本字段 - Programmatically input angularjs text field using javascript/VBA 以编程方式选择文本Safari - Selecting text Programmatically Mobile Safari 如何在输入文本字段上以编程方式触发输入事件? - Howto trigger input event programmatically on input text field? React Native:iOS听写无法清除文本输入 - React Native: iOS dictation unable to clear text input
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM