Buffering videos with VideoView

Go To StackoverFlow.com


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


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

    mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

        public void onPrepared(MediaPlayer mp) {
2012-04-04 19:23
by Andrew