Is the following code is right and sufficient for restarting the MediaPlayer in Android, when getting sudden stops of the HTTP MP3 live stream due to connection to the server lost or Internet connection lost/switching to other type of it? I will to restart player automatically when the connection to the server is lost. Will this listener handle such types of connection lost?
public void setOnErrorListener (MediaPlayer.OnErrorListener listener)
{
if (this.mplayer!=null)
{
showError ();
this.mplayer.reset();
this.mplayer = MediaPlayer.create(getApplicationContext(), Uri.parse(currenturl));
this.mplayer.start();
};
}