Skip to content

Commit 406ca0a

Browse files
committed
Fix doubling of offset for segment-relative cues
When using segment-relative timestamps in VTT, the presentation offset has already been factored into the segment time. Therefore, it should not be added again in the VTT parser. Closes #595 Closes #599 Change-Id: I9d062af7a17859f6f3374ecf20369b361f3eac7b
1 parent 40a92b6 commit 406ca0a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/media/vtt_text_parser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ shaka.media.VttTextParser.parseCue_ =
112112
shaka.util.Error.Code.INVALID_TEXT_CUE);
113113
}
114114

115-
start += offset;
116-
end += offset;
117-
118115
// See issue #480 for discussion on deprecation
119116
if (useRelativeCueTimestamps) {
120117
start += segmentStartTime;
121118
end += segmentStartTime;
119+
} else {
120+
start += offset;
121+
end += offset;
122122
}
123123

124124
// Get the payload.

test/media/vtt_text_parser_unit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ describe('VttTextParser', function() {
356356
'WEBVTT\n\n' +
357357
'0:00:20.000 --> 0:00:40.000 align:center size:56% vertical:lr\n' +
358358
'Test',
359-
undefined,
359+
/* offset */ 7, // ignored when using relative timestamps
360360
20,
361361
true);
362362
});

0 commit comments

Comments
 (0)