Android media player returns IllegalStateException

后端 未结 3 1696
北荒
北荒 2021-01-12 00:25

I have following code to play small audio files

private void playVoice() {

     if (mPlayVoice != null) {
         if (mPlayVoice.isPlaying()) {
                    


        
3条回答
  •  有刺的猬
    2021-01-12 01:15

    You may have to clear the audioGroup joined with audioStream. Mine worked with the following code:

    public static void audioPlayCaptureStop()
            {
    
                try 
                {
                     if(audioStream.isBusy()) 
                     {
                         audioGroup.clear();
                         audioStream.release();
                         System.out.println("audioStream released");
                     }
    
                } catch (Exception e) {
                    System.out.println("audioStream release exception: "+e.toString());
                }
            }
    

提交回复
热议问题