I am playing HTTP Live Streaming on the iOS device family, using Apple's AVPlayer library on iOS 5 and 6.
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.
This has been working for a single bitrate, but I am getting problems only 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).
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 this only happens if my variant playlist contains more than one bitrate child playlist.
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).
#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
And I have the variant playlist that selects between the child playlists:
#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
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:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=280000
clips-200.m3u8
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.
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.
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.
One last thing, the mediasegmentvalidator provided by Apple does not give any warnings when I use it to check.
I really appreciate any help that you guys can offer! This is a puzzling problem for me :-(
Things I'd check (Not in any particular order, just the order I've thought of them).
Sorry I don't have one answer but there are a lot of tiny, little things that can trip you up.
If you use #EXT-X-DISCONTINUITY
in variant streams, then you're supposed to have #EXT-X-DISCONTINUITY-SEQUENCE:<number>
in each of the variants.
See: https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-18#section-4.3.3.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With