我正在开发Android,并使用SpeechRecognizer
来实现连续语音识别。为什么SpeechRecognizer在onEndOfSpeech被调用后启动时很忙?
开始后通过下面的代码语音识别:
private void startListening(){
recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getActivity().getPackageName());
recognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS,Long.valueOf(3000L));
recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,1);
}
并再次调用startListening()
当onEndOfSpeech
被调用。
但onError
将被调用,并显示SpeechRecognizer.ERROR_RECOGNIZER_BUSY
。
Q1: 为什么SpeechRecognizer
忙,当我onEndOfSpeech
后开始已叫什么名字?
Q2 如何实现连续语音识别的方式?
谢谢,我会试试! – Wun
为什么在几次尝试后停止工作?还是我用它错了? – edwardffs