Stop or release MediaPlayer while it is still preparing

后端 未结 2 1379
日久生厌
日久生厌 2020-12-10 05:54

Is it a bug or is it not possible to release, stop or kill MediaPlayer while it\'s preparing?

I have an instance of MediaPlayer running in

2条回答
  •  悲哀的现实
    2020-12-10 06:31

    Another solution could be to implement the OnBufferingUpdateListener and override its method like this:

    @Override
    public void onBufferingUpdate(MediaPlayer mp, int percent) {
        if (cancel) {
            mp.release();
            mMediaPlayer = null;
    
        }
    }
    

提交回复
热议问题