Soheil
Soheil

Reputation: 1706

android- how to play video in VideoView?

I want to play video in a VideoView. which one is correct?

        video.setOnPreparedListener(new OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            video.start();
        }
    });

or simply:

video.start();

Upvotes: 0

Views: 106

Answers (1)

ρяσѕρєя K
ρяσѕρєя K

Reputation: 132972

Both method is right to play video but setOnPreparedListener is useful when you want to show ProgressBar when media is loading for play from SDCARD,webserver or streaming urls.

and if video.start(); called without setOnPreparedListener some delay occur during loading file then only black screen appear to user until video start.

Upvotes: 2

Related Questions