Closed Captions not showing on devices

Hi,


we use AVPlayer for playing back HLS streams and we have an issue with Closed Captions.


The Captions are shown correctly when we test the player on simulators (tried with iOS 8.1, 9, 10.1) but nothing is shown when we run it on the device (tried with iOS 9.3, 10.1).


This is a stream that shows the issue: http://demo.cf.castlabs.com/media/HLS/CC-HLS/hls.m3u8


When subtitles are defined as external WebVTT files, everything works fine, as in this stream:

https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8


This is a snippet of our subtitles selection code


- (void)selectSubtitleOption:(NSInteger)index {
    AVMediaSelectionGroup subtitleSelectionGroup = [playerItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
    if (subtitleSelectionGroup) {
        NSUInteger count = subtitleSelectionGroup.options.count;
        if (index < count) {
            AVMediaSelectionOption* option = [subtitleSelectionGroup.options objectAtIndex:index];
            [playerItem selectMediaOption:option inMediaSelectionGroup:subtitleSelectionGroup];
        }
    }
}


We also tried to:

  • set
    closedCaptionDisplayEnabled
    to true
  • enabled Closed Captions+SDH in Settings/General/Accessibility/Subtitles&Captioning of the Devices


Any idea?

Replies

I think it is just that your master playlist is wrong.


You've added an EXT-X-MEDIA for the captions, but you need to add an attribute


CLOSED-CAPTIONS="cc"


to the EXT-X-STREAM-INF tag, so it knows the captions are in that stream.