brian
brian

Reputation: 6922

VideoView not supporting video in Android

I am using VideoView to play video.

If the video is not supported by the phone (such as my phone supporting only 480p video, not 720p which is the video I'm trying to play), it shows the dialog

Sorry,This video cannot be played

I want to do something after I click the dialog's "OK" button.

Where can I add the code to do this?

My code as below:

vv = (VideoView)this.findViewById(R.id.screen_video);
Uri uri = Uri.parse(FlePath);
vv.setVideoURI(uri);
vv.start();

Upvotes: 0

Views: 578

Answers (1)

Tofeeq Ahmad
Tofeeq Ahmad

Reputation: 11975

After your code paste this.If you get this error then oncmpletion listner will call.

    vv.setOnCompletionListener(new OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
            //release your MediaPlayer Resource
            //do whatever you want
        }
    });

Hope this help you :)

Upvotes: 1

Related Questions