title: How to add Adaptive Track Selector in Exo-player v2.x?
body: <p>I'm setting up Exo Player in my app and I have implemented DASH adaptive streaming in my player, and want to add the functionality to play the track of specific quality selected by the user.   </p>
  
  <p>My Exo player version is <code>2.9.3</code>, I tried implementing by following these <a href="https://stackoverflow.com/questions/45835562/quality-selector-for-exoplayer-2">Stackoverflow Post</a>,<a href="https://medium.com/google-exoplayer/exoplayer-2-x-track-selection-2b62ff712cc9" rel="nofollow noreferrer">Medium Post</a>, but it's bit confusing and some part of the code is deprecated, and saying the truth is that I am a beginner.</p>
  
  <p>Here's my code for initializing the player:-</p>
  
  <pre><code>private void initializePlayer() {
       if (player == null) {
          bandwidthMeter = new DefaultBandwidthMeter();
          TrackSelection.Factory factory = new PlayerTrackSelector(bandwidthMeter);
          trackSelector = new DefaultTrackSelector(factory);
          player = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
          player.addVideoListener(this);
          playerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_ZOOM);
          player.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
          player.addListener(this);
          playerView.setPlayer(player);
      }
      MediaSource mediaSource = buildMediaSource(Uri.parse("http://192.168.43.238:3000/storage/video-dash/9e351142a4eb1664643bf93ba13959e8.mpd"));
      player.prepare(mediaSource, true, false);
      player.setPlayWhenReady(playWhenReady);
      player.seekTo(currentWindow, playbackPosition);
  }
  </code></pre>
  
  <p>And the <code>TrackSelector</code> Class:-</p>
  
  <pre><code>public class PlayerTrackSelector implements TrackSelection.Factory {
      private BandwidthMeter bandwidthMeter;
  
    public PlayerTrackSelector(BandwidthMeter bandwidthMeter) {
      this.bandwidthMeter = bandwidthMeter;
    }
  
  @Override
  public TrackSelection createTrackSelection(TrackGroup group, BandwidthMeter bandwidthMeter, int... tracks) {
  
      return new AdaptiveTrackSelection(group,tracks,bandwidthMeter,
              AdaptiveTrackSelection.DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
              AdaptiveTrackSelection.DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
              AdaptiveTrackSelection.DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
              AdaptiveTrackSelection.DEFAULT_BANDWIDTH_FRACTION,
              AdaptiveTrackSelection.DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE,
              AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS,
              Clock.DEFAULT);
    }
  }
  </code></pre>
  
  <p>I expect to get a list of available quality types and let the user select one of them and play the rest of the content with the selected type, this question is maybe broad but please guide me a little.</p>