Android播放器继续callback,缓冲

我正在使用MediaPlayer从我的应用中的在线mp3文件播放一些声音。

但是,即使播放完成后,我仍然在控制台中获得线路和callback和缓冲。

 10-24 08:08:48.467 19221-19233/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:48.467 19221-19233/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:49.468 19221-19232/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:49.468 19221-19232/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:49.468 19221-19232/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:49.468 19221-19232/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:50.469 19221-19233/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:50.469 19221-19233/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:50.469 19221-19233/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:50.469 19221-19233/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:51.470 19221-19232/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:51.470 19221-19232/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:51.470 19221-19232/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:51.470 19221-19232/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:52.471 19221-19233/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:52.471 19221-19233/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:52.471 19221-19233/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:52.471 19221-19233/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:53.472 19221-19232/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:53.472 19221-19232/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:53.472 19221-19232/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:53.472 19221-19232/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:54.473 19221-19233/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:54.473 19221-19233/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:54.473 19221-19233/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:54.473 19221-19233/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:55.473 19221-19232/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:55.473 19221-19232/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:55.473 19221-19232/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:55.473 19221-19232/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:56.474 19221-19233/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 10-24 08:08:56.474 19221-19233/com.myapp V/MediaPlayer﹕ buffering 100 10-24 08:08:56.474 19221-19233/com.myapp V/MediaPlayer﹕ callback application 10-24 08:08:56.474 19221-19233/com.myapp V/MediaPlayer﹕ back from callback 10-24 08:08:57.475 19221-19232/com.myapp V/MediaPlayer﹕ message received msg=3, ext1=100, ext2=0 

我尝试过在播放器上调用stop() ,但是这只能防止播放器正常播放。

我能做什么?

  • 对于2.3.4上文件路径设置的铃声,MediaPlayer setDataSource失败,状态= 0x80000000
  • Android MediaPlayer需要很长时间来准备和缓冲
  • Androidaudio效果的WAV文件并保存
  • Android ExoPlayer:它是否解决Android媒体播放器的无缝/无缝播放问题
  • Android HTTP直播使用mediaplayer的URL
  • Android ExoPlayer通过HTTPstream式传输mp3
  • Android媒体播放器库
  • 我应该如何从通知返回到活动没有新的意图
  • 你确定没有别的东西在背景中运行吗(像潘多拉)?

    我发现你的问题,因为我的机器人产生相同的logcat消息。 然后我意识到我的潘多拉的应用程序已经暂停,结束了应用程序的消息停止。

    嘿,我也发现在我的情况。

    尝试添加一个OnCompletionListener。

    voicePlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.stop(); mp.reset(); } });