Home » Android » Android player continues callbacks , buffering

Android player continues callbacks , buffering

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m using a MediaPlayer to play some sound from an online mp3 file in my app.

However, even after the play completes, I’m getting lines and lines of callsbacks and buffering in the console.

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

I tried calling stop() on the player but this just prevents the player from ever playing properly.

What can I do?

How to&Answers:

Are you sure that nothing else is running in the background (like Pandora)?

I found your question because my droid was producing the same logcat messages. Then I realized my Pandora app was paused, after ending the app the messages stopped.

Answer:

Hey I found this in my case too.

Try to add a OnCompletionListener.

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