E/MediaPlayer: start called in state 4, mPlayer(0xcc719a40)解决

在使用MediaPlayer播放音频时报出 E/MediaPlayer: start called in state 4, mPlayer(0xcc719a40)错误

贴出代码

mMediaPlayer.reset();
mMediaPlayer.setDataSource(audioList.get(0));
mMediaPlayer.prepareAsync();
mMediaPlayer.start();

原因是在调用prepareAsync()时以异步方式进入Prepared状态过程中即preparing状态中,调用了start方法

只需将prepareAsync()改为prepare()即可。

你可能感兴趣的:(E/MediaPlayer: start called in state 4, mPlayer(0xcc719a40)解决)