title: ExoPlayer force quality dash
body: <p>I'm trying to get a video player where I can select the quality of the video. Like Youtube: It selects 'auto' by default but with a switch you can select: 360p, 720p etc.</p>
  
  <p>The 'auto' parts works now using this code:
  ```</p>
  
  <pre><code>        TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
          trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
          player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, new DefaultLoadControl());
  </code></pre>
  
  <p>Later on I create a new DashMediaSource.</p>
  
  <pre><code> return new DashMediaSource(uri, buildDataSourceFactory(true),
            new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, null);
  </code></pre>
  
  <p>So the video is playing now but how do I force a the quality now? So for example when I select 360p I want the player to select that representation.</p>
  
  <p><code>&lt;AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"&gt;
              &lt;Representation bandwidth="954483" codecs="avc1.4d401f" frameRate="525007/17491" height="360" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="640"&gt;
                  &lt;BaseURL&gt;video360.fmp4&lt;/BaseURL&gt;
                  &lt;SegmentBase indexRange="914-1425" indexRangeExact="true"&gt;
                      &lt;Initialization range="0-913"/&gt;
                  &lt;/SegmentBase&gt;
              &lt;/Representation&gt;
              &lt;Representation bandwidth="2351904" codecs="avc1.4d401f" frameRate="525007/17491" height="720" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="1280"&gt;
                  &lt;BaseURL&gt;video720.fmp4&lt;/BaseURL&gt;
                  &lt;SegmentBase indexRange="914-1425" indexRangeExact="true"&gt;
                      &lt;Initialization range="0-913"/&gt;
                  &lt;/SegmentBase&gt;
              &lt;/Representation&gt;
          &lt;/AdaptationSet&gt;
  </code></p>
  
  <p>I've found the <a href="https://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/trackselection/FixedTrackSelection.html" rel="nofollow noreferrer">FixedTrackSelection</a> and <a href="https://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/source/dash/manifest/AdaptationSet.html" rel="nofollow noreferrer">AdaptationSet</a> but I don't come to a solution</p>
  
  <p>Does someone know how I can achieve this?</p>