【问题标题】:How to start voice recognition by codes on Chrome via HTML5 Speech Input API?如何通过 HTML5 Speech Input API 在 Chrome 上通过代码启动语音识别?
【发布时间】:2013-07-24 23:25:12
【问题描述】:

我有以下代码:

<!DOCTYPE html>
<meta charset="utf-8">
<title>A HTML Document</title>
<input x-webkit-speech speech><button>Start to recognize voice</button>

如果您在 Chrome 上单击文本框中的麦克风图标,就会开始语音识别。

这就是我想要的:

当我点击按钮元素时,文本框的语音识别开始。

我试过 startSpeechInput (http://lists.w3.org/Archives/Public/public-xg-htmlspeech/2011Feb/att-0020/api-draft.html)、SpeechReco (http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/att-1696/speechapi.html#examples) 和 SpeechInputRequest (http://lists.w3.org/Archives/Public/public-xg-htmlspeech/2011Sep/0033.html),它们都不能在 Chrome 上运行。

我怎样才能做到这一点?

HTML5 Speech Input API 由 Google 提交。除了 Chrome 之外,没有其他浏览器实现了这个 HTML5 规范。现在 HTML5 规范中引入了 3 种方法。但它们都不是由谷歌实现的。我觉得 HTML5 只是 Google 自己的游戏。 Google 应严格执行 HTML5 规范。

【问题讨论】:

    标签: html google-chrome speech-recognition voice voice-recognition


    【解决方案1】:

    您无法真正使用 javascript 管理 x-webkit-speech 输入。顺便说一句,这个功能以后会被弃用,你可以去this link看看。

    现在您必须使用 Web Speech API。该 API 是 google 在 W3C 列表上提出的非官方草案。目前,还没有关于在 HTML5 的 W3C 规范中添加此 API 的讨论。

    如果你想使用这个Web Speech API,你可以看看this link,里面有很好的解释和使用例子。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-31
      • 1970-01-01
      • 2017-01-25
      • 1970-01-01
      • 1970-01-01
      • 2015-04-05
      • 2019-06-30
      相关资源
      最近更新 更多