在使用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()即可。

相关文章:

  • 2022-12-23
  • 2022-02-14
  • 2021-09-03
  • 2022-12-23
  • 2021-06-02
  • 2021-05-27
  • 2021-08-05
  • 2022-12-23
猜你喜欢
  • 2022-01-16
  • 2021-09-17
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案