Skip to content

Commit

Permalink
fix: Fix handling of CC when switching between codecs (#5160)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored and joeyparrish committed Apr 26, 2023
1 parent 9200e43 commit c5cbdf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ shaka.media.MediaSourceEngine = class {
// For HLS CEA-608/708 CLOSED-CAPTIONS, text data is embedded in
// the video stream, so textEngine may not have been initialized.
if (!this.textEngine_) {
this.reinitText('text/vtt', this.sequenceMode_);
this.reinitText(shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE,
this.sequenceMode_);
}
// This doesn't work for native TS support (ex. Edge/Chromecast),
// since no transmuxing is needed for native TS.
Expand All @@ -665,7 +666,8 @@ shaka.media.MediaSourceEngine = class {
data = transmuxedData.data;
} else if (hasClosedCaptions && contentType == ContentType.VIDEO) {
if (!this.textEngine_) {
this.reinitText('text/vtt', this.sequenceMode_);
this.reinitText(shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE,
this.sequenceMode_);
}
if (!this.captionParser_) {
this.captionParser_ = this.getCaptionParser(mimeType);
Expand Down
1 change: 1 addition & 0 deletions lib/text/text_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ shaka.text.TextEngine = class {
// into TextEngine and TextDisplayer.
if (mimeType == shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE ||
mimeType == shaka.util.MimeUtils.CEA708_CLOSED_CAPTION_MIMETYPE) {
this.parser_ = null;
return;
}

Expand Down

0 comments on commit c5cbdf8

Please sign in to comment.