1

I'm streaming audio files from server. I'm handling the situation when internet connection is lost and the player gets to the end of the buffered part (there is some part of the song which is not buffered). I've implemented OnErrorListener, OnInfoListener and OnCompletionListener. This is the onInfo method

@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
    if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START && !Utils.isInternetConected()) {
           //handle situation
    }
    return true;
}

On newer devices this is called just before reaching the end of the buffered part.But on older devices neither onError nor onInfo is called reaching end of the buffered part. only onComplete() is called. On older devices I understand 2.3.3 - 2.3.7(I'v tested it on 3 devices).The MEDIA_INFO_BUFFERING_START is introduced in API level 9 , my devices are API 9 or 10. Can someone tell me why onInfo or onError is not called on older devices and onCompletion is automatically called ? Thanks in advance

user2610355
  • 101
  • 5
  • Did you add a break point inside the method and see if it's really not getting called? – Nitin Sethi Oct 02 '13 at 14:32
  • The description to MEDIA_INFO_BUFFERING_START is: `MediaPlayer is temporarily pausing playback internally in order to buffer more data.`. So I think that `what == MediaPlayer.MEDIA_INFO_BUFFERING_START && !Utils.isInternetConected()` will be false, because it woun't start buffering if there is no Inet connection. – MalaKa Oct 02 '13 at 14:37
  • there is a Log in the onInfo and nothing is logged, Nitin – user2610355 Oct 02 '13 at 14:49
  • MalaKa , its pausing the audio and try to buffer more when reaching just before the end of buffered part. On newer devices it works perfectlly – user2610355 Oct 02 '13 at 14:53

0 Answers0