title: AVPlayer HLS .m3u8 - could not select audio, subtitle track
body: <p>I have an issue:
  I have m3u8 file format such as:</p>
  
  <pre><code>#EXTM3U
  #EXT-X-STREAM-INF:BANDWIDTH=490000,RESOLUTION=640x360
  http://XXX.XXX.XX.XXX:31213/MEDIA/76336503.....583609776254/161/4161/
  #EXT-X-STREAM-INF:BANDWIDTH=1500000,RESOLUTION=720x576
  http://XXX.XXX.XX.XXX:31213/MEDIA/76336503.....583609776254/161/3161/
  #EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720
  http://XXX.XXX.XX.XXX:31213/MEDIA/76336503.....583609776254/161/2161/
  </code></pre>
  
  <p>Each EXT-X-STREAM-INF tag link to file like:</p>
  
  <pre><code>#EXTM3U
  #EXT-X-TARGETDURATION:5
  #EXT-X-VERSION:3
  #EXT-X-MEDIA-SEQUENCE:35156
  #EXT-X-START:TIME-OFFSET=-25,PRECISE=YES
  #EXT-X-KEY:METHOD=AES-128,URI="http://XXX.XXX.XX.XXX:02444/xxXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/191/2191/aeskey_191_
  #EXTINF:5,
  http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/3020314583628416652818934133893/191/2191/seg_XXXXX.ts
  #EXTINF:5,
  http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/6545456465456456465454564/191/2191/seg_191_XXXXX.ts
  #EXTINF:5,
  http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/6545456465456456465454564/191/2191/seg_191_XXXXX.ts
  #EXTINF:5,
  http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/6545456465456456465454564/191/2191/seg_191_XXXXX.ts
  #EXTINF:5,
  http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/6545456465456456465454564/191/2191/seg_191_XXXXX.ts
  </code></pre>
  
  <p>Audio and subtitles are embeded in TS file. Since audio/subtitle tracks are not explicitly described in #EXT tag in the above *.m3u8 file, 'mediaSelectionGroupForMediaCharacteristic' returns empty options collection.</p>
  
  <p>In opposite, m3u8 file:</p>
  
  <p><a href="https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8" rel="noreferrer">https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8</a></p>
  
  <p>provided by Apple as an HLS playlist example, has audio/subtitle tracks described in #EXT tags:</p>
  
  <pre><code>#EXTM3U
  
  #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="bipbop_audio",LANGUAGE="eng",NAME="BipBop Audio 1",AUTOSELECT=YES,DEFAULT=YES
  #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="bipbop_audio",LANGUAGE="eng",NAME="BipBop Audio 2",AUTOSELECT=NO,DEFAULT=NO,URI="alternate_audio_aac_sinewave/prog_index.m3u8"
  
  
  #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound",URI="subtitles/eng/prog_index.m3u8"
  #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English (Forced)",DEFAULT=NO,AUTOSELECT=NO,FORCED=YES,LANGUAGE="en",URI="subtitles/eng_forced/prog_index.m3u8"
  </code></pre>
  
  <p>This time 'mediaSelectionGroupForMediaCharacteristic' returns a collection which includes two audio options, which I can select successfully.</p>
  
  <p><strong>THE QUESTION</strong>: Is there a way for AVPlayer to select audio/subtitle track, if they are not described in #EXT tag inside *.m3u8 file, but embedded within *.ts files? Thanks ahead, any suggestions are appreciated!</p>