AVPlayer: escaped characters displayed wrong from WebVTT subtitles (HLS)

quotes are displayed incorrectly in subtitles of AVPlayerViewController when streaming VOD content using HLS.

  • single quote ' (escaped ') is displayed as apos;
  • double quotes " (escaped ") is displayed as quot;

following the vtt specification. The same stream works fine in VLC player, showing quotes correctly in subtitles. subtitle vtt files use

  • Content-Type: text/vtt

WEBVTT X-TIMESTAMP-MAP=LOCAL:490014:06:04.000,MPEGTS:158764568760056

example line:

490014:05:46.000 --> 490014:05:50.440 align:start line:83% position:14%

and the playlist has:

#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="da",NAME="Dansk",AUTOSELECT=YES,CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog,public.accessibility.describes-music-and-sound",URI="subs/dan_5/playlist.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=780000,CODECS="mp4a.40.5,avc1.42c01e",RESOLUTION=256x144,AUDIO="audio-aac",SUBTITLES="subs" <fgffffff><bg000000>lære dig endnu bedre at kende.&quot;</bg000000></fgffffff>

adding 'wvtt' to CODECS list in playlist does not make a difference.

Is this a known bug? Is there a workaround? I guess the AVResourceLoaderDelegate can be used to intercept and parse the subtitle files, but it seems like quite a hack and not really intended to be used for this.

example subtitle file:

WEBVTT X-TIMESTAMP-MAP=LOCAL:490014:06:04.000,MPEGTS:158764568760056

490014:05:46.000 --> 490014:05:50.440 align:start line:83% position:14%

<fgffffff><bg000000>lære dig endnu bedre at kende.&quot;</bg000000></fgffffff>

AVPlayer: escaped characters displayed wrong from WebVTT subtitles (HLS)
 
 
Q