Home:ALL Converter>Closed Captions/Subtitles not working for AVPlayer but are in Safari: HLS

Closed Captions/Subtitles not working for AVPlayer but are in Safari: HLS

Ask Time:2015-06-16T05:26:47         Author:Stephen Radford

Json Formatter

I'm building an app that uses Apple's HLS implementation. The m3u8 file we're using looks like this:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="REDACTED"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1,CODECS="avc1.64001f",RESOLUTION=1280x720,SUBTITLES="subs",CLOSED-CAPTIONS=NONE
/url/to/fragments.m38u

As you can see, it has one subtitle and one media stream. This works perfectly in Safari and the "English" title shows up in the list as expected.

When implementing AVPlayer in our app this just doesn't work. The video streams and the subtitles button appears but the "English" option isn't there.

Apple's example m3u8 file does work but I can't see why this would work in Safari and not in AVPlayer.

Any help is much appreciated.

Cheers, Steve

Author:Stephen Radford,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30855229/closed-captions-subtitles-not-working-for-avplayer-but-are-in-safari-hls
yy