关于Raspberry Pi Chromium的webkitSpeechRecognition

时间:2014-05-03 15:23:03

标签: speech-recognition chromium raspbian

我想在Raspbian上从Chromium查看的网页上启用语音识别。它在Windows 7 / Chrome上运行良好,但它不适用于Raspbian。这适用于Linux上的Chromium,还是尚不可用?

我使用以下代码:

if(!('webkitSpeechRecognition' in window)) {
    upgrade();
} else {
    var recognition = new webkitSpeechRecognition();
    recognition.continuous = true;
    recognition.interimResults = true;
    recognition.lang = Language;
    recognition.start();

    recognition.onresult = function(event) {
        console.log(event);
        for(var i = event.resultIndex; i < event.results.length; ++i) {
            if(event.results[i].isFinal) {
                lastRecognition = event.results[i][0].transcript;
                showRecognition(lastRecognition);
            }
        }
    }

    recognition.onerror = function(event) {
        console.log(event);
    }

    recognition.onend = function() {
        recognition.start();
    }
}

0 个答案:

没有答案