簡體   English   中英

Cordova 中的語音識別插件只聽一次

[英]Speech Recognition Plugin in Cordova listens only once

我在 Cordova/Ionic 中使用這個插件進行語音識別。 https://github.com/macdonst/SpeechRecognitionPlugin

當我第一次打開應用程序時,識別只對我有效一次(Android)

我在調試器中沒有看到任何錯誤。 識別.開始()第二次觸發,我聽到聲音(開始和停止)。 但是 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();
   }

對此有任何建議。

使用 ng-speech-recognition 指令,你不需要在你的混合應用中安裝任何 Cordova 插件:

ng-語音識別

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM