我使用MediaPlayer播放应用中在线mp3
文件中的声音。
然而,即使在比赛结束后,我也会在控制台中获得回调线路和缓冲线。
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()
但这只会阻止播放器正常播放。
我该怎么办?
答案 0 :(得分:1)
你确定没有其他东西在后台运行(比如Pandora)吗?
我找到了你的问题,因为我的机器人正在生成相同的logcat消息。然后我意识到我的Pandora应用程序已暂停,在结束应用后消息停止了。
答案 1 :(得分:0)
嘿,我也发现了这个。
尝试添加OnCompletionListener。
voicePlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.stop();
mp.reset();
}
});