Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android player continues callbacks , buffering

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?

like image 512
CodyBugstein Avatar asked Oct 24 '14 05:10

CodyBugstein


2 Answers

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(); } });

like image 57
Fergus Wang Avatar answered Nov 05 '22 15:11

Fergus Wang


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.

like image 2
Logic1 Avatar answered Nov 05 '22 17:11

Logic1