0

I have developed an Android music player app that can stream MP3s via HTTP progressive download (via WiFi, using Apache). This is how I set up the MediaPlayer to stream the MP3:

mediaplayer.setDataSource(192.168.../song.mp3)

Everything works fine until the connection to the server is lost. From the log outputs of my registered onBufferingUpdateListener, it seems that when the connection to the server is lost (say, I turn off WiFi on my phone), MediaPlayer attempts to fill up the remaining song in its buffer. However this retrying stops after a few seconds.

In other words, if a connection to the server is not resumed within a few seconds of it being lost, MediaPlayer will not resume buffering. (i.e. onBufferingUpdate() stops getting called after a few seconds of retrying). Also, I receive no errors/info messages in my onInfoListener or onErrorListener.

The question is: How do I force MediaPlayer to resume buffering the rest of the song(preferably without interrupting playback) when a connection to the server is available again regardless of the time interval between successive connections?

What alternatives do I have to stream MP3s via HTTP progressive download?

Kedar Paranjape
  • 1,822
  • 2
  • 22
  • 33
  • For that i suggest that check connection response code in a particular time after the lost the connection if you get the connection back at that time request to server with last buffered bytes.. – Karan Mavadhiya Mar 18 '14 at 04:45
  • Reference : http://stackoverflow.com/questions/11713696/android-mediaplayer-streaming-stops-on-network-change?rq=1 – Karan Mavadhiya Mar 18 '14 at 04:47

0 Answers0