10000 fix(CEA): Remove closed captions only on video update (#9125) · shaka-project/shaka-player@98fc330 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98fc330

Browse files
authored
fix(CEA): Remove closed captions only on video update (#9125)
This change will prevent removing every stored caption on seeking. Issue is a regression introduced in #9068
1 parent fca4df7 commit 98fc330

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/media/media_source_engine.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ shaka.media.MediaSourceEngine = class {
13831383
// Get actual TextEngine buffer start, as it's not the same as video
13841384
// buffer and TextEngine does not support multiple buffered ranges.
13851385
const textStart = this.textEngine_.bufferStart() || 0;
1386-
this.textEngine_.remove(textStart, endTime);
1386+
this.textEngine_.remove(textStart, endTime, /* removeCC= */ true);
13871387
}
13881388
if (contentType == ContentType.TEXT) {
13891389
await this.textEngine_.remove(startTime, endTime);
@@ -1418,7 +1418,7 @@ shaka.media.MediaSourceEngine = class {
14181418
// if we have CEA captions, we should clear those too.
14191419
if (contentType === ContentType.VIDEO && this.captionParser_ &&
14201420
this.textEngine_) {
1421-
await this.textEngine_.remove(0, Infinity);
1421+
await this.textEngine_.remove(0, Infinity, /* removeCC= */ true);
14221422
}
14231423
// Note that not all platforms allow clearing to Infinity.
14241424
await this.enqueueOperation_(

lib/text/text_engine.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,18 @@ shaka.text.TextEngine = class {
242242
/**
243243
* @param {number} startTime relative to the start of the presentation
244244
* @param {number} endTime relative to the start of the presentation
245+
* @param {boolean=} removeClosedCaptions
245246
* @return {!Promise}
246247
*/
247-
async remove(startTime, endTime) {
248+
async remove(startTime, endTime, removeClosedCaptions = false) {
248249
// Start the operation asynchronously to avoid blocking the caller.
249250
await Promise.resolve();
250251
if (startTime >= endTime) {
251252
return;
252253
}
253-
this.removeClosedCaptions_(startTime, endTime);
254+
if (removeClosedCaptions) {
255+
this.removeClosedCaptions_(startTime, endTime);
256+
}
254257
if (this.displayer_ && this.displayer_.remove(startTime, endTime)) {
255258
if (this.bufferStart_ == null) {
256259
goog.asserts.assert(

0 commit comments

Comments
 (0)
0