Speech to text button in textbox on a webpage

走远了吗. 提交于 2019-12-06 09:20:46

问题


Is is possible to have a working Google speech to text button in a textbox on a webpage?

How can it be done?


回答1:


it's an HTML5 thingy ...

<input type="text" id="txtSearch" x-webkit-speech />

so, will only work in available browsers.

Live code: http://jsbin.com/afifaw/3




回答2:


This is a really crude implementation of TTS that you might find acceptable. It's going to need some tender love and care, but it's a starting point.

<p id="tts">The maximum number of characters, including punctuation marks and all spaces, that I can read is 100</p>

<a target="new" id="ttsLink" onclick="document.getElementById('ttsReader').src='http://translate.google.com/translate_tts?tl=en&q='+encodeURIComponent(document.getElementById('tts').innerHTML)">  <u>click me<u></a>

<br/ ><br />
<iframe id="ttsReader" width="10" height="10"></iframe>


来源:https://stackoverflow.com/questions/7959439/speech-to-text-button-in-textbox-on-a-webpage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!