MediaPlayer.prepare() throws IllegalStateException

MediaPlayer.setDataSource(“”);调用  MediaPlayer.prepare() 出现  IllegalStateException   异常

现在只需把

MediaPlayer设置一个监听事件,

mMediaPlayer.reset();mMediaPlayer.setDataSource(scenicDetailResult.getSoftyuyinurl());mMediaPlayer.setOnPreparedListener(newMediaPlayer.OnPreparedListener() {@Overridepublic voidonPrepared(MediaPlayer mp) {progressBar2.setVisibility(View.INVISIBLE);bt.setVisibility(View.VISIBLE);        Log.e("songwinter","is prepare finished");            setmMediaPlayer();    }});mMediaPlayer.prepareAsync();

你可能感兴趣的:(MediaPlayer.prepare() throws IllegalStateException)