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 –