title: ExoPlayer get available audio tracks and switch between them
body: <p>I have an android application which streams videos with ExoPlayer. I want to add language support to the streams. What languages the stream will have, must be taken from the stream's metadata.</p>
  <p>In ExoPlayer library I found the way to get list of the tracks from the stream by following:</p>
  <pre><code>player.getCurrentTrackGroups().get(i).getFormat(i) //player is SimpleExoPlayer class
  </code></pre>
  <p>but this give me kind of raw information, here is videos, audios, and other tracks that need to be labeled. printed formats looks like following:</p>
  <blockquote>
  <p>Format(1/100, null, video/avc, -1, null, [1920, 1080, -1.0], [-1, -1]) <br>
  Format(1/8292, null, application/cea-608, -1, null, [-1, -1, -1.0], [-1, -1])<br>
  Format(1/200, null, audio/mpeg-L2, -1, , [-1, -1, -1.0], [2, 48000])<br>
  Format(1/201, null, audio/mpeg-L2, -1, , [-1, -1, -1.0], [2, 48000])</p>
  </blockquote>
  <p>I wonder if there is an easier way to get only audio tracks and their required information for switching between them for later.</p>
  <p>My next problem is I don't know how to switch between the audio tracks. I searched and there is an answer accepted that this is done by the following code:</p>
  <pre><code>player.selectTrack(FullPlayer.TYPE_AUDIO, ExoPlayer.TRACK_DEFAULT);
  
  </code></pre>
  <p>this code is taken from <a href="https://stackoverflow.com/a/27404447/11475673">this</a> answer.
  Problem is, that my <b> SimpleExoPlayer </b> class has not this function. I have exoplayer 2.8.2 and neither <b> SimpleExoPlayer </b> nor <b>ExoPlayer</b> class got that function. So i'm stuck there. <br>
  Another found answer was from DefaultTrackSelector class which has following face:</p>
  <pre><code> trackSelector.setParameters( trackSelector.getParameters().buildUpon().setPreferredAudioLanguage(&quot;eng&quot;));
  </code></pre>
  <p>this looks like simple and good way, But not all streams are labeled like that. many tracks has no string for language name. Only thing that they have different is ID string. And passing the id string does not work.</p>