I found a workaround for this problem:
First you create an OnBufferingUpdateListener
:
MediaPlayer.OnBufferingUpdateListener bufferingListener = new MediaPlayer.OnBufferingUpdateListener() {
public void onBufferingUpdate(MediaPlayer mp, int percent) {
//code to increase your secondary seekbar
}
};
Then in your seekbar event onProgressChanged
do the following:
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
int secondaryPosition = seekBar.getSecondaryProgress();
if (progress > secondaryPosition)
seekBar.setProgress(secondaryPosition);
}
With this you guarantee the user can't drag the progress bar to an unbuffered position (and also you see what's buffered).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…