I have a Media player service that plays a internet stream, but I'm having problems on how to display in my xml the buffering percentage, at the moment I'm just displaying a message since all the ways I have try it gave me a static long number. Here is the code from my player service:
@Override
public void onBufferingUpdate(MediaPlayer mp, int percent) {
setBufferPosition(percent * getMusicDuration() / 100);
myMain.EstadoRadio.setText(" Reproductor \n Buffering... ");
}
as you can tell EstadoRadio is a text view in my xml that is working from myMain activity where I want to display the buffering % of the stream. Thanks for your help.
EDIT: I have seen inmost cases where 'percent' from the onBufferingUpdate(MediaPlayer mp, int percent) is used, something like this:
myMain.EstadoRadio.setText(" Reproductor \n" + percent + "%");
but in my case percent is always -2147483648, I don't know why, or why it doesn't change or update, here is a little from my log cat:
05-17 13:34:37.005: V/MediaPlayer(25382): message received msg=3, ext1=-2147483648, ext2=0
05-17 13:34:37.005: V/MediaPlayer(25382): buffering -2147483648
05-17 13:34:37.005: V/MediaPlayer(25382): callback application
05-17 13:34:37.005: V/MediaPlayer(25382): getDuration
05-17 13:34:37.015: V/MediaPlayer(25382): back from callback
05-17 13:34:38.016: V/MediaPlayer(25382): message received msg=3, ext1=-2147483648, ext2=0
05-17 13:34:38.016: V/MediaPlayer(25382): buffering -2147483648
05-17 13:34:38.016: V/MediaPlayer(25382): callback application
05-17 13:34:38.016: V/MediaPlayer(25382): getDuration
05-17 13:34:38.016: V/MediaPlayer(25382): back from callback