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 and joeyparrish committed Jan 30, 2023
1 parent b5e2066 commit 8a9156f
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 @@ -945,6 +945,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 @@ -954,6 +956,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 8a9156f

Please sign in to comment.