Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show the progress bar before playing the video

i want to show the progress dialog before playing video. i tried below link example for playing video.

http://davanum.wordpress.com/2009/12/04/android-%E2%80%93-videomusic-player-sample-take-2/

it works but it takes more time to take for playing video so i want to show a progress dialog before start the video. so please tel me how to show the progress dialog before playing the video.

Thank you.

Best Regards.

like image 749
Ramakrishna Avatar asked Feb 07 '11 13:02

Ramakrishna


People also ask

What is progress bar in video?

The video progress bar makes it easy to check where you left off the last time you watched a video.


1 Answers

First, declare the progress dialog

private static ProgressDialog progressDialog;

Then, in onCreate, before calling runOnUiThread, start the dialog

progressDialog = ProgressDialog.show(this, "", "Loading...", true);

In playVideo, set a OnPreparedListener that will dismiss the dialog when the video is ready to play

mVideoView.setOnPreparedListener(new OnPreparedListener() {

    public void onPrepared(MediaPlayer arg0) {
        progressDialog.dismiss();
        mVideoView.start();
    }
});
like image 61
Cameron Avatar answered Nov 01 '22 13:11

Cameron