title: Http live streaming: EXT-X-DISCONTINUITY tag makes all segments afterwards only have audio
body: <p>I am playing HTTP Live Streaming on the iOS device family, using Apple's AVPlayer library on iOS 5 and 6.</p>
  
  <p>Since I am playing advertisements mid-roll, between content clips, I am using the #EXT-X-DISCONTINUITY tags, as suggested by the awesome person who helped answer a previous question. </p>
  
  <p>This has been working for a single bitrate, but I am getting problems <strong>only</strong> when using a variant playlist with child playlists for multiple bitrates. I am getting a black screen with audio only after the very first discontinuity tag, and it never recovers even after the ad is over. (I can hear the ad).</p>
  
  <p>This has been tested and reproduced on an iPhone 4, 4S, 5, and iPod Touch 4th gen. The iphone 4 is on iOS 5, the rest are iOS 6. It happens most of the time, but not every single time. But for sure, I want to emphasize that <strong>this only happens if my variant playlist contains more than one bitrate child playlist.</strong></p>
  
  <p>Here is an example of a playlist that I use (this is the 400kbps version, and I have a 
  200 and 800kbps version with corresponding playlists that look exactly like the following, but replace all '400's with '200' and '800'. (Well, the actual playlist is longer but this is an example).</p>
  
  <pre><code>#EXTM3U
  #EXT-X-TARGETDURATION:10
  #EXT-X-MEDIA-SEQUENCE:0
  #EXTINF:10,
  400-clipA-0.ts
  #EXTINF:10,
  400-clipA-1.ts
  #EXTINF:5,
  400-clipA-2.ts
  
  #EXT-X-DISCONTINUITY
  #EXTINF:10,
  400-advert0.ts
  #EXTINF:3,
  400-advert1.ts
  
  #EXT-X-DISCONTINUITY
  #EXTINF:10,
  400-clipB-0.ts
  #EXTINF:10,
  400-clipB-1.ts
  #EXTINF:5,
  400-clipB-2.ts
  
  #EXT-X-ENDLIST
  </code></pre>
  
  <p>And I have the variant playlist that selects between the child playlists:</p>
  
  <pre><code>#EXTM3U
  #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000
  clips-200.m3u8
  #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000
  clips-400.m3u8
  #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=840000
  clips-800.m3u8
  </code></pre>
  
  <p>Note that what happens (~75% of the time) is that when I play this, the video will go to black after the very first discontinuity tag (right before the ad) and never recover again, although I can hear the audio of the ad. For example, if I made my variant playlist with only a single bitrate variant:</p>
  
  <pre><code>#EXTM3U
  #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=280000
  clips-200.m3u8
  </code></pre>
  
  <p>Then I do not get this problem at all! Very strange. Additionally, if I remove all the discontinuity tags and still keep the other bitrates in the variant playlist, then it works fine (usually), but occasionally it will skip an entire .ts file for some reason, probably because it needs those discontinuity tags.</p>
  
  <p>Additionally, this happens more often when I play the files directly on Amazon Cloudfront, compared to from the Amazon S3 bucket where they originally reside.</p>
  
  <p>Some other info that might help: My original files (clips and ads) are all .mov files taken from an iPhone 4, with the same resolution on each. My outputs (the .ts files) were all then generated from these -- for each bitrate class, I have the same encoding settings across the clips and ads. Outputs are all the same resolution and framerate otherwise.</p>
  
  <p>One last thing, the mediasegmentvalidator provided by Apple does not give any warnings when I use it to check.</p>
  
  <p>I really appreciate any help that you guys can offer! This is a puzzling problem for me :-(</p>