Android: mediaplayer went away with unhandled events

后端 未结 2 1823
一向
一向 2021-01-31 13:37

I need to get the duration of an audio file for a series of voice announcements that need to play from an app. I have added the audio files as resources and they do play just f

相关标签:
2条回答
  • 2021-01-31 14:02

    The holy five:

        if(mp!=null) {
            if(mp.isPlaying())
                mp.stop();
            mp.reset();
            mp.release();
            mp=null;
        }
    
    0 讨论(0)
  • 2021-01-31 14:10

    Just put mp.reset(); before mp.release();.

    0 讨论(0)
提交回复
热议问题