title: How can I change video audio and subtitle track in Exo player in android
body: <p>Hy sir this code only for audio selection but can we select video, audio and subtitles also?</p>
  <p><a href="https://imbt.ga/iNBFLV8rSQ" rel="nofollow noreferrer">https://imbt.ga/iNBFLV8rSQ</a></p>
  <pre class="lang-java prettyprint-override"><code>public void setAudioTrack(int track) {
      System.out.println(&quot;setAudioTrack: &quot;  + track);
      MappingTrackSelector.MappedTrackInfo mappedTrackInfo = Assertions.checkNotNull(trackSelector.getCurrentMappedTrackInfo());
      DefaultTrackSelector.Parameters parameters = trackSelector.getParameters();
      DefaultTrackSelector.ParametersBuilder builder = parameters.buildUpon();
      for (int rendererIndex = 0; rendererIndex &lt; mappedTrackInfo.getRendererCount(); rendererIndex++) {
          int trackType = mappedTrackInfo.getRendererType(rendererIndex);
          if (trackType == C.TRACK_TYPE_AUDIO) {
              builder.clearSelectionOverrides(rendererIndex).setRendererDisabled(rendererIndex, false);
              int groupIndex = track -1;
              int [] tracks = {0}; 
              DefaultTrackSelector.SelectionOverride override = new DefaultTrackSelector.SelectionOverride(groupIndex,tracks);
              builder.setSelectionOverride(rendererIndex, mappedTrackInfo.getTrackGroups(rendererIndex), override);
          }
      }
      trackSelector.setParameters(builder);
      curentAudioTrack = track;
  }
  </code></pre>