mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Discard spans after seeking
Discard any spans that should not be applied because they don't belong to what's in the current CC buffer.
This commit is contained in:
parent
43e6e16168
commit
8b2af12447
1 changed files with 7 additions and 3 deletions
|
|
@ -656,9 +656,13 @@ public final class Eia608Decoder implements SubtitleDecoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Integer startIndex : captionStyles.keySet()) {
|
for (Integer startIndex : captionStyles.keySet()) {
|
||||||
|
// There may be cases, e.g. when seeking where the startIndex becomes greater
|
||||||
|
// than what is actually in the string builder, in that case, just discard the span.
|
||||||
|
if (startIndex < captionStringBuilder.length()) {
|
||||||
CharacterStyle captionStyle = captionStyles.get(startIndex);
|
CharacterStyle captionStyle = captionStyles.get(startIndex);
|
||||||
captionStringBuilder.setSpan(captionStyle, startIndex,
|
captionStringBuilder.setSpan(captionStyle, startIndex,
|
||||||
captionStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
captionStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
captionStyles.remove(startIndex);
|
captionStyles.remove(startIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue