Buffering videos with VideoView

Go To StackoverFlow.com

1

I have an Activity that takes a url and plays the video with a VideoView. This works fine.

However, there is a buffer time before the video starts playing. Because of this, the VideoView is black. There is no spinner indicating a buffer loading.

Is there a parameter of the VideoView that will show a spinner? If not, is there some message that gets broadcast when the video starts playing? That way I can show my own spinner and hide it when the message is received.

2012-04-04 19:04
by Andrew


0

I've found the answer. Add a ProgressBar over the top of the VideoView and do the following:

    mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            mSpinner.setVisibility(View.GONE);
        }
    });
2012-04-04 19:23
by Andrew
Ads