Chrome iOS webkit语音识别

时间:2013-12-17 16:54:02

标签: ios google-chrome speech-recognition

我正试图在iPad上的Chrome上实现语音识别而没有任何运气。为了切断追逐并删除对我的webkitSpeechRecognition api实现的任何依赖,Glenn Shire的excellent sample code不能在运行iOS 5.1.1的iPad 1上的Chrome v27上运行,也不能在运行iOS 7.0的iPad3上运行Chrome v31。 4,至少据我所知。它在这一行失败了:

 if (!('webkitSpeechRecognition' in window)) {
    r.onState('upgrade');
    return;
 }

我无法找到一种解决方法,而且我没有看到任何关于语音识别的任何在线帖子都没有在iOS版Chrome中运行。还有其他人遇到过这个吗?

2 个答案:

答案 0 :(得分:11)

iOS上的Chrome目前不支持语音识别。

Google必须使用iOS UIWebView,这意味着Safari不支持特殊的网络解释功能。

您可以查看this link

答案 1 :(得分:1)

如果您想识别一些简单的命令,可以查看Pocketsphinx.js

识别语音的代码很简单:

var id = 0;
recognizer.postMessage({command: 'initialize', callbackId: id});
var keyphrase = "HELLO WORLD";
recognizer.postMessage({command: 'addKeyword', data: keyphrase, callbackId: id});
recognizer.postMessage({command: 'start', data: id});
recognizer.postMessage({command: 'process', data: array});
recognizer.postMessage({command: 'stop'});

recognizer.onmessage = function(e) {
     if (e.data.hasOwnProperty('hyp')) {
           alert(e.data.hyp);
     }
};

有关详情,请参阅完整示例here