title: How to add Subtitles(.SRT files) to video in Exoplayer android?
body: <p>i am working on a project where i should play .srt files along with video in android. I was working through the samples of Exoplayer but cant able to play .srt files with video. </p>
  
  <p>The code i used is,</p>
  
  <pre><code>MediaSource mediaSource = new HlsMediaSource(Uri.parse("https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8"),
                  mediaDataSourceFactory, mainHandler, null);
  
           Format textFormat = Format.createTextSampleFormat(null, MimeTypes.APPLICATION_SUBRIP,
                  null, Format.NO_VALUE, Format.NO_VALUE, "en", null);
  
          Uri uri = Uri.parse("http://www.storiesinflight.com/js_videosub/jellies.srt");
  
  
          MediaSource subtitleSource = new SingleSampleMediaSource(uri, mediaDataSourceFactory, textFormat, C.TIME_UNSET);
  // Plays the video with the sideloaded subtitle.
          MergingMediaSource mergedSource =
                  new MergingMediaSource(mediaSource, subtitleSource);
  
          player.prepare(mergedSource);
  </code></pre>
  
  <p>Can anyone please suggest me solution for this or any tutorial links for the same. Your help is very much appreciated !</p>