首页 文章

Cordova中的语音识别插件只能听一次

提问于
浏览
0

我在Cordova / Ionic中使用此插件进行语音识别 . https://github.com/macdonst/SpeechRecognitionPlugin

当我第一次打开应用程序时,识别仅适用于我(Android)

我没有在调试器中看到任何错误 . recogn.start()第二次触发,我听到声音(开始和停止) . 然而,onresult事件仅在第一次触发 .

$scope.record = function(){     
   recognition = new SpeechRecognition(options);
        recognition.onresult = function(event) {
            console.log("On Result called");
            if (event.results.length > 0) {
                console.log(event.results[0][0].transcript);
            }else{
                console.log("no word");
            }
        };
        recognition.start();
   }

对此有任何建议 .

1 回答

  • 0

    使用ng-speech-recognition指令,您无需在混合应用程序中安装任何Cordova插件:

    ng-speech-recognition

相关问题