gpt4 book ai didi

Android SpeechRecognizer 在第二次收听时失败

转载 作者:行者123 更新时间:2023-11-29 14:14:12 26 4
gpt4 key购买 nike

我遇到一个问题,SpeechRecognizer 将正确收听,当我下次收听它时转到 SpeechRecognizer.ERROR_NO_MATCH,识别器立即无法 SpeechRecognizer.ERROR_NO_MATCH。第三次我听会再次工作。有任何想法吗?下面的代码:此外,当错误代码为 SpeechRecognizer.ERROR_SPEECH_TIMEOUT 时,可以完美运行,将在第二次正确收听。

@Override
public void onError(int error) {
switch (error) {
case SpeechRecognizer.ERROR_AUDIO:
showLog("ERROR_AUDIO");
endTimer();
break;
case SpeechRecognizer.ERROR_CLIENT:
showLog("ERROR_CLIENT");
endTimer();
break;
case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
showLog("ERROR_RECOGNIZER_BUSY");
endTimer();
break;
case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
showLog("ERROR_INSUFFICIENT_PERMISSIONS");
endTimer();
break;
case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
showLog("ERROR_NETWORK_TIMEOUT");
endTimer();
break;
case SpeechRecognizer.ERROR_NETWORK:
sr.destroy();
showLog("ERROR_NETWORK");
endTimer();
break;
case SpeechRecognizer.ERROR_SERVER:
showLog("ERROR_SERVER");
endTimer();
break;
case SpeechRecognizer.ERROR_NO_MATCH:
showLog("ERROR_NO_MATCH");
break;
case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
showLog("ERROR_SPEECH_TIMEOUT");
break;
default:
assert false;
return;
}
}

最佳答案

这是“谷歌应用程序”中的一个错误,卸载谷歌应用程序的更新,它会清除问题或按照这个答案做 SpeechRecognizer throws onError on the first listening

关于Android SpeechRecognizer 在第二次收听时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31274294/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com