简体   繁体   中英

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();

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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM