fix(HLS): Fix subtitle timing (#7625)

Simplifies subtitle management for sequence mode and segments mode 
Runs subtitle tests in segments mode as well (Tizen 3.0)

Fixes: https://github.com/shaka-project/shaka-player/issues/7447
This commit is contained in:
Álvaro Velad Galván
2024-11-19 18:36:49 +01:00
committed by GitHub
parent 67cbe9915d
commit 9e2b15ead4
14 changed files with 84 additions and 27 deletions
+2 -8
View File
@@ -86,13 +86,7 @@ shaka.text.VttTextParser = class {
// Only use 'X-TIMESTAMP-MAP' with HLS. This overrides offset above.
if (blocks[0].includes('X-TIMESTAMP-MAP') &&
this.manifestType_ == shaka.media.ManifestParser.HLS) {
if (this.sequenceMode_) {
// Compute a different, rollover-based offset for sequence mode.
offset = this.computeHlsSequenceModeOffset_(blocks[0], time);
} else {
// Calculate the offset from the segment startTime.
offset = time.segmentStart;
}
offset = this.computeHlsOffset_(blocks[0], time);
}
// Parse VTT regions.
@@ -129,7 +123,7 @@ shaka.text.VttTextParser = class {
* @return {number}
* @private
*/
computeHlsSequenceModeOffset_(headerBlock, time) {
computeHlsOffset_(headerBlock, time) {
// https://bit.ly/2K92l7y
// The 'X-TIMESTAMP-MAP' header is used in HLS to align text with
// the rest of the media.