在移动浏览器直接语音/语音输入 [英] Direct Voice/Speech Input on Mobile Browser
问题描述
我想提出一个web应用程序,这将需要处理许多短的用户输入,但不是输入的所有文本,用户应该能够使用麦克风。
I would like to make a web application which will need to deal with many short user inputs, but instead of typing all the texts the user should be able to use the microphone.
我知道,iPhone和Android智能手机确实有键盘上的话筒按钮,但是这两个平台需要首先关注的输入,以开始录制。这将是更好的,如果我有仅按钮,否则你真的不觉得你是打算用自己的声音来进行输入。
I know that iPhones and Android Smartphones do have a "microphone button" on the keyboard, but both platforms require to focus the input first in order to start recording. It would be much better if I had only a button, because otherwise you don't really feel like you're intended to perform the input using your voice.
我尝试使用在我的Android手机的X WebKit的语音
属性,但无论是海豚高清也没有谷歌Chrome浏览器确实表现出一个真正的语音输入字段。
I tried using the x-webkit-speech
attribute on my Android phone, but either Dolphin HD nor Google Chrome did show a real speech input field.
有没有办法直接打开语音输入对话未做键盘可见光第一还是我只是希望有多大?
Is there a way to open the speech input dialogue directly without making the keyboard visible first or do I simply expect to much?
推荐答案
(假设语音输入实际上是在浏览器中启用,)你只能显示'麦克风按钮和重定向的输入,无论你想,像在这个例子中一个文本框:
(Assuming speech-input is actually enabled in the browser,) you could only show the 'microphone-button' and redirect the input to wherever you want, like in this example a text-box:
<script type="text/javascript">
function transcribe(words){
document.getElementById("mic").value="";
document.getElementById("speech").value=words;
document.getElementById("speech").focus();
}
</script>
Speech input for textarea - click the microphone icon and talk: <br>
<br>
<textarea id="speech" cols="50"></textarea>
<input id="mic" style="width:15px; height:20px; border:0px; background-color:transparent" x-webkit-speech onwebkitspeechchange="transcribe(this.value)">
希望这helpes!
Hope this helpes!
这篇关于在移动浏览器直接语音/语音输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!