Node Webkit语音识别API

5

我将尝试使用Node Webkit语音识别API,但它给我奇怪的行为。我像这样初始化录音器:

var rec = new webkitSpeechRecognition();
rec.continuous = true;
rec.interimResults = true;
rec.onresult = function(e){ alert('result') };
rec.onstart = function(e){ alert('start') };
rec.onerror = function(e){ console.log(e); };
rec.onend  = function(e){ alert('end') };
rec.onspeechstart = function(e){ alert('speechStart') };
rec.start();

start()方法调用后没有任何反应。只有end()方法有效,我无法弄清楚这一个为什么有效而其他方法不行...我失去了什么?

我浏览了Github问题页面(适用于桌面应用的webkitSpeechRecognition?),但没有找到任何有用的信息。

1个回答

4
`webkitSpeechRecognition`需要一个后端语音识别系统。
Chrome可以使用Google的语音识别系统,所以我们可以在Chrome上轻松使用`webkitSpeechRecognition`。但是在其他浏览器上,即使基于webkit,也可能无法正常工作。
我认为在支持Google或其他引擎之前,在node-webkit上使用语音识别功能很困难。
此外,CHANGELOG 0.8.0 / 10-30-2013表示:
- 在支持之前取消定义window.webkitSpeechRecognition

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接