-1

I am working on Android ExoPlayer as mentioned in this Article- https://betterprogramming.pub/android-exoplayer-play-videos-in-your-app-like-youtube-486853913397 But I am unable to control the video quality (360p, 480p, etc). How to do that? I need the complete code.

Bhaskar Jyoti Dutta
  • 1,118
  • 1
  • 7
  • 19

2 Answers2

1

For ABR streams, ExoPlayer will automatically switch to the best bit rate based on its assessment of current network conditions etc - e.g. if it is playing a high bit rate for a particular piece of content and determines that the network is busy and its buffer is not keeping up, it will switch to a lower bit rate for that content. More info here:

If you mean that you would like to be able to control the bit rate manually, then the track selector functionality will allow you do that.

You can see more info here (linked from the ExoPLayer GitHub): https://medium.com/google-exoplayer/exoplayer-2-x-track-selection-2b62ff712cc9

The default interface looks like:

enter image description here

Mick
  • 19,483
  • 1
  • 40
  • 91
0

You can select the quality version by creating your own ABR algorithm, e.g., yourOwnABR(), then call it in the function updateSelectedTrack() of file AdaptiveTrackSelection.java as follows.

public void updateSelectedTrack(
  long playbackPositionUs,
  long bufferedDurationUs,
  long availableDurationUs,
  List<? extends MediaChunk> queue,
  MediaChunkIterator[] mediaChunkIterators) {
    ...
    int newSelectedIndex = yourOwnABR();
    ...
Adrian Mole
  • 30,672
  • 69
  • 32
  • 52
minhkstn
  • 1
  • 1
  • 3