Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change resolution of exoplayer manually?

I'm working on a project that use Exoplayer2 for HLS video streaming. Adaptive streaming is working well in my exoplayer, but i want to implement a feature that user can change the resolution (144p,240p,480p..)of the video manually from UI. I got the resolution of the playing video from TrackGroup API. But don't know how to set the resolution value into the playing video manually. Thanks

like image 861
Sarath Sasi Avatar asked May 19 '17 05:05

Sarath Sasi


People also ask

How do I change the bitrate on ExoPlayer?

ExoPlayer provides a way of setting a max bitrate using DefaultTrackSelector#Parameters . You can use setMaxVideoBitrate or setMaxVideoSize to limit the max bitrate. In this way, it works in many cases.

How do I get ExoPlayer thumbnails on Android?

Add ImageView and Exoplayer in Framelayout. Show Image (That is knows as thumbnails) in imageView and on tap of ImageView Hide it and show ExoPlayer and play it.


1 Answers

You can do this using the track selector functionality in Exoplayer2 - it essentially limits the tracks that the adaptive bit rate selection functionality in the player can select from.

It can only select from the available tracks in the stream index file, the manifest file. Hence, your choice of resolutions/bit rates is limited to whatever bitrate, resolution etc the stream provider has made available - i.e. the user can't just choose an arbitrary bit rate or resolution that they would like, if it is not one of the available ones in the manifest file (the video track index file).

To have just one track you simply only allow that one.

This functionality is included in the demo - here is an example screen shot from one of their blogs about this:

enter image description here

More details specifically on track selection here (it is also linked from the Exoplyar GitHub page): https://medium.com/google-exoplayer/exoplayer-2-x-track-selection-2b62ff712cc9

like image 89
Mick Avatar answered Sep 16 '22 14:09

Mick