Skip to content

Commit 974f5dc

Browse files
authored
fix(HLS): IMSC1 subtitles not working in a HLS stream (#4942)
Fixes #4350 The current code initially parses the subtitle track as text/vtt (mimetype) since it has no codec. Subsequently, the stpp.ttml.im1t codec is assigned but the mimetype of text/vtt is not changed to application/mp4. This PR changes this so that once the codec is assigned, the mimetype is recalculated.
1 parent ff80ae6 commit 974f5dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/hls/hls_parser.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,8 @@ shaka.hls.HlsParser = class {
11951195
}
11961196
});
11971197

1198+
const type = shaka.util.ManifestParserUtils.ContentType.TEXT;
1199+
11981200
// Set the codecs for text streams.
11991201
for (const tag of subtitleTags) {
12001202
const groupId = tag.getRequiredAttrValue('GROUP-ID');
@@ -1204,6 +1206,9 @@ shaka.hls.HlsParser = class {
12041206
if (textStreamInfos) {
12051207
for (const textStreamInfo of textStreamInfos) {
12061208
textStreamInfo.stream.codecs = codecs;
1209+
textStreamInfo.stream.mimeType =
1210+
this.guessMimeTypeBeforeLoading_(type, codecs) ||
1211+
this.guessMimeTypeFallback_(type);
12071212
}
12081213
}
12091214
}

0 commit comments

Comments
 (0)