8

在REST API(Google Sppech API for Node:https://cloud.google.com/nodejs/apis)的文档和教程中,所以我的问题是如何在JavaScript中使用Cloud Speech API。有人用JavaScript的任何页面?使用Javascript的Google云语音

感谢,

蒂亚戈

+0

我觉得你有什么谷歌的云API的也全是错误的想法 - 也许[这](https://developers.google.com/web/updates/2013/01/Voice-Driven-Web-Apps-Introduction-to-the-Web-Speech-API?hl = en)更接近你需要的东西 –

回答

4

的谷歌云API更具体用于服务器端的语音处理。如果您希望通过浏览器使用语音识别功能,则应使用内置的Web Speech API内置的浏览器。这里有一个简单的例子:

var recognition = new webkitSpeechRecognition(); 
 
recognition.continuous = true; 
 

 
var output = document.getElementById('output'); 
 
recognition.onresult = function(event) { 
 
    output.textContent = event.results[0][0].transcript; 
 
};
<div id="output"></div> 
 
<button onclick="recognition.start()">Start</button> 
 
<button onclick="recognition.stop()">Stop</button>

+3

它们是完全不同的API。您建议的Web Speech API是私有API,每天限制50个请求!我们不能使用这个限制的商业项目。在决定使用Speech Web API之前,请通过https://www.chromium.org/developers/how-tos/api-keys –

+1

这完全不正确。 [Web Speech API](https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html)是一种W3C支持的跨浏览器功能,即使存在于[Firefox]中, (https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API)。这取决于浏览器供应商决定如何解析语音,并且默认情况下Google API密钥已内置到Google的Chrome版本中。对于定制的Chromium版本,您需要获取API密钥。 – fny

+1

https://www.chromium.org/developers/how-tos/api-keys –