Javascript Google 语音搜索的工作原理是什么?有没有相关的 API?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6389039/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How Google Voice Search works? Is there an API for that?
提问by bbosak
I'm not sure if this is the right site for this question, but I was wondering how the voice activated search on Google's homepage works. Does it use Flash, some kind of plugin built into Google Chrome, or how does it use the microphone? This could be a dangerous privacy invasion if it is allowed to work the same way on any website, because no dialog asking for permission comes up, and I find this startling that Google (and who knows what other sites) can use my microphone without my permission. How is Google doing this? Javascript? Actionscript? Some custom plugin?
我不确定这是否适合回答这个问题,但我想知道 Google 主页上的语音激活搜索是如何工作的。它是否使用 Flash、Google Chrome 内置的某种插件,或者它如何使用麦克风?如果允许在任何网站上以相同的方式工作,这可能是一种危险的隐私侵犯,因为没有出现请求许可的对话框,而且我发现令人吃惊的是,Google(以及谁知道其他网站)可以在没有我的情况下使用我的麦克风允许。谷歌是如何做到这一点的?Javascript?动作脚本?一些自定义插件?
采纳答案by Curt
It's available to anyone. There's more information here:
任何人都可以使用。这里有更多信息:
http://chrome.blogspot.com/2011/04/everybodys-talking-and-translating-with.html
http://chrome.blogspot.com/2011/04/everybodys-talking-and-translating-with.html
and an example here: http://www.web2voice.com/chrome-speech-input.html
和一个例子:http: //www.web2voice.com/chrome-speech-input.html
I'm glad I'm not the only one who thinks the lack of a permissions prompt feels a little bit big-brother-esque.
我很高兴我不是唯一一个认为缺少权限提示感觉有点老大哥式的人。
回答by Jeff
It's using HTML5 speech input via <input type="text" x-webkit-speech />
它通过使用 HTML5 语音输入 <input type="text" x-webkit-speech />
as the name suggests, this only works in webkit. Not sure if there are alternatives for other browsers.
顾名思义,这只适用于 webkit。不确定是否有其他浏览器的替代品。
回答by mhu
A nice wrapper for the Web Speech API is available here: talater.com/annyang.
一个很好的 Web Speech API 包装器可以在这里找到:talater.com/annyang。
This library allows you to easily bind functions to voice commands, eg:
该库允许您轻松地将功能绑定到语音命令,例如:
annyang.init({
"help": function() {$("#help").show();}
});
annyang.start();