Android speech recognizing and audio recording in the same time

后端 未结 5 1380
野趣味
野趣味 2020-12-02 17:21

My application records audio using MediaRecorder class in AsyncTask and also use Google API transform speech to text - Recognizer Intent - using the code from this question

5条回答
  •  离开以前
    2020-12-02 18:04

    Late Answer, but for the first Exception, You have to destroy Your SpeechRecognizer after this what You want has done, for example (in onStop() or onDestroy() or directly after You don´t need the SpeechRecognizer anymore):

        if (YourSpeechRecognizer != null)
        {
            YourSpeechRecognizer.stopListening();
            YourSpeechRecognizer.cancel();
            YourSpeechRecognizer.destroy();
        }
    

提交回复
热议问题