Video quality in Video View

2k views Asked by At

Here is code of web view to load video using URL

 mediacontroller = new MediaController(this);
    mediacontroller.setAnchorView(vv);
    String uriPath = "https://firebasestorage.googleapis.com/v0/b/fire-b6fff.appspot.com/o/Nissan_-_Ignite_the_Excitement(1).mp4?alt=media&token=2f329bc8-7045-4f4e-a683-64169fc4562c"; //update package name
    uri = Uri.parse(uriPath);

    vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
            if(isContinuously){
                vv.start();
            }
        }
    });

How to set video qualities like 180p,360p like youtube in video view

1

There are 1 answers

0
Mick On

You may find it easier to use ExoPlayer to do this:

It is supported by Google and also used as the basis for many mainstream android video players. Its described like this at the link above (at the time of writing):

ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend, and can be updated through Play Store application updates.

The Exoplayer demo application includes track selection as standard: