Question: i am working on an application where i need to play video from a remote server as live stream.

which is done by me successfully.
i managed every thing in my app.

but when video is loading i need to show a progress dialog over VideoView.

i tried using OnPreparedListener as "[how to show the progress bar before playing the video](https://stackoverflow.com/questions/4921941/how-to-show-the-progress-bar-before-playing-the-video)"

```
@Override
public void onPrepared(MediaPlayer mp) {
    progressbar.setVisibility(View.GONE);
    mp.start();

}

```

but video play after 5-7 Sec of progressbar gone.
i searched a lot on Google but not found any solution for it.

Could anyone help me.

Thanks in Advance.

Answer: 
have a look this one solved my problem hope help you also..

<http://www.quicktips.in/how-to-show-progressbar-while-loading-a-video-in-android-videoview/>

```
 progressbar.setVisibility(View.VISIBLE);

 videoView.setOnPreparedListener(new OnPreparedListener() {

            @Override
            public void onPrepared(MediaPlayer mp) {

                mp.start();

                mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() {

                    @Override
                    public void onVideoSizeChanged(MediaPlayer mp, int arg1, int arg2) {
                        // TODO Auto-generated method stub
                        Log.e(TAG, "Changed");
                        progressbar.setVisibility(View.GONE);
                        mp.start();
                    }
                });

            }
        });

```

:)
Unforgettably there is no OnStart Listener expose by Android. After Prepared State, the MediaPlayer goes into Started State once playback started.

But in Prepared State only you should have sufficient buffer to play. Can you use setOnBufferingUpdateListener (MediaPlayer.OnBufferingUpdateListener listener) and print percentage of buffer. So that way you can see, if in Prepared State you have enough buffer or not.