Skip to content

Commit

Permalink
fix(HLS): IMSC1 subtitles not working in a HLS stream (#4942)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
avelad authored Jan 30, 2023
1 parent ff80ae6 commit 974f5dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,8 @@ shaka.hls.HlsParser = class {
}
});

const type = shaka.util.ManifestParserUtils.ContentType.TEXT;

// Set the codecs for text streams.
for (const tag of subtitleTags) {
const groupId = tag.getRequiredAttrValue('GROUP-ID');
Expand All @@ -1204,6 +1206,9 @@ shaka.hls.HlsParser = class {
if (textStreamInfos) {
for (const textStreamInfo of textStreamInfos) {
textStreamInfo.stream.codecs = codecs;
textStreamInfo.stream.mimeType =
this.guessMimeTypeBeforeLoading_(type, codecs) ||
this.guessMimeTypeFallback_(type);
}
}
}
Expand Down

0 comments on commit 974f5dc

Please sign in to comment.