MediaPlayer stops and restarts

I get a weird error. I play with a MediaPlayer a mediastream (like shoutcast or icecast).
Sometimes suddenly on playing stream (total random) happens a error, the stream stops and restart.
OnErrorListener don't get triggered!

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 that?

Edit:

Ahh. One more information. 701 means MEDIA_INFO_BUFFERING_START and 702 means MEDIA_INFO_BUFFERING_END . I think I could fix these if I increase buffer size?

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


As you wrote, buffering...

Sorry, No other suggestions.


It is buffering as you wrote - the only thing I'd like to add is that while it's annoying that it stops or starts, this information is very useful to your user. You may want to update him with a Toast (or a Crouton!) or indicate some sort of buffering status so that they don't blame your app (they will anyway usually!) or so that they know that it's likely their connection to blame - connecting to WIFI in this case is an action that would help.


I'm was seeing the same problem, but it only occurred when using a particular Bluetooth headset and the screen on my phone was off. The app that it occurred in was Just Playlists, a music player that I developed and support.

It only occurred when streaming via Wi-Fi and not via the cell network. I was able to get around the problem by going under Android's advanced Wi-Fi settings and disabling the "Wi-Fi optimization" option, which claims to "minimize battery usage when Wi-Fi is on." I had already used the advanced options to keep Wi-Fi always on.

The headset brand and model are Phiaton PS 210 BTNC. They support Bluetooth 3.0, which makes me suspect this is part of the issue. I've had this problem both under Android 4.1.x and 4.2.2. Here is a log excerpt from when the problem occurs and then recovers:

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've yet to see what the impact on battery usage is after disabling the Wi-Fi optimization.

链接地址: http://www.djcxy.com/p/10536.html

上一篇: 用于Maven的摩卡插件

下一篇: MediaPlayer停止并重新启动