MediaPlayer stops and restarts

I get a strange error. I play with MediaPlayer as a media stream (e.g. shoutcast or icecast).
Sometimes when playing a stream (all random) an error occurs, the stream stops and restarts.
OnErrorListener not starting!

Logcat:

03-02 17:50:36.274: W/MediaPlayer(16799): info/warning (702, 0) 03-02 17:50:36.274: I/MediaPlayer(16799): Info (702,0) 

or like this:

 03-02 17:50:14.250: W/MediaPlayer(16799): info/warning (703, 0) 03-02 17:50:14.250: W/MediaPlayer(16799): info/warning (701, 0) 03-02 17:50:14.250: I/MediaPlayer(16799): Info (703,0) 03-02 17:50:14.250: I/MediaPlayer(16799): Info (701,0) 

or

 03-02 18:03:33.906: W/MediaPlayer(16799): info/warning (703, 126) <br> 03-02 18:03:33.906: I/MediaPlayer(16799): Info (703,126) 

Any ideas on this?

Edit:

Ahhh. One more information. 701 means MEDIA_INFO_BUFFERING_START and 702 means MEDIA_INFO_BUFFERING_END . I think I can fix them if I increase the size of the buffer?

Edit: But wait. BufferingSize is baked into the system. Damn.:)

+7
source share
3 answers

As you wrote, buffering ...

Sorry, no other suggestions.

+1
source

This buffering, as you wrote, is the only thing I would like to add is that while it annoys that it stops or starts, this information is very useful for your user. You might want to update it using Toast (or Crouton!) Or indicate some kind of buffering status so that they do not blame your application (they will still be at all!) Or so they know that their connection is most likely to blame - connecting to WIFI in this case is an action that will help.

+1
source

I had the same problem, but this only happened when using a specific Bluetooth headset, and the screen on my phone was turned off. The application in which it happened was Just Playlists, a music player that I developed and maintain.

This only happened when streaming over Wi-Fi, not over a cellular network. I was able to get around this problem by going to the advanced Wi-Fi settings of Android and turning off the “Wi-Fi Optimization” option, which claims to “minimize battery consumption when connecting Wi-Fi”. I already used advanced options for saving Wi-Fi.

Headset make and model - Phiaton PS 210 BTNC. They support Bluetooth 3.0, which makes me suspect that this is part of the problem. I had this problem both in Android 4.1.x and in 4.2.2. Here is an excerpt from the log when the problem occurs and then is restored:

 I/AwesomePlayer( 131): cache is running low (1.90 secs) , pausing. W/MediaPlayer( 3028): info/warning (703, 0) W/MediaPlayer( 3028): info/warning (701, 0) I/MediaPlayer( 3028): Info (703,0) I/MediaPlayer( 3028): Info (701,0) I/audio_a2dp_hw( 131): suspend_audio_datapath: state 1 E/bt-btif ( 889): bta_av_str_stopped:audio_open_cnt=1, p_data 586a58f8 W/bt-btif ( 889): bta_dm_rm_cback:1, status:6 W/bt-btif ( 889): bta_dm_rm_cback:1, status:6 I/BluetoothA2dpServiceJni( 889): bta2dp_audio_state_callback I/audio_a2dp_hw( 131): skt_disconnect: fd 46 D/A2dpStateMachine( 889): Connected process message: 101 D/A2dpStateMachine( 889): A2DP Playing state : device: 00:18:09:06:08:0C State:10->11 I/AwesomePlayer( 131): cache has filled up (6.00 secs), resuming. 

I still do not understand what effect on battery usage after turning off Wi-Fi optimization.

+1
source

All Articles