From 6937325b85d346fde6eba5c368ed201d152cc11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Wed, 19 Apr 2023 19:14:55 +0200 Subject: [PATCH] fix: Fix handling of CC when switching between codecs (#5160) --- lib/media/media_source_engine.js | 3 ++- lib/text/text_engine.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js index aa03fc5066..307c83cb1f 100644 --- a/lib/media/media_source_engine.js +++ b/lib/media/media_source_engine.js @@ -739,7 +739,8 @@ shaka.media.MediaSourceEngine = class { } 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); diff --git a/lib/text/text_engine.js b/lib/text/text_engine.js index 6d30b0b07f..789d4b1471 100644 --- a/lib/text/text_engine.js +++ b/lib/text/text_engine.js @@ -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; }