Skip to content

Commit

Permalink
Fix doubling of offset for segment-relative cues
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joeyparrish committed Jan 26, 2017
1 parent 40a92b6 commit 406ca0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/media/vtt_text_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ shaka.media.VttTextParser.parseCue_ =
shaka.util.Error.Code.INVALID_TEXT_CUE);
}

start += offset;
end += offset;

// See issue #480 for discussion on deprecation
if (useRelativeCueTimestamps) {
start += segmentStartTime;
end += segmentStartTime;
} else {
start += offset;
end += offset;
}

// Get the payload.
Expand Down
2 changes: 1 addition & 1 deletion test/media/vtt_text_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ describe('VttTextParser', function() {
'WEBVTT\n\n' +
'0:00:20.000 --> 0:00:40.000 align:center size:56% vertical:lr\n' +
'Test',
undefined,
/* offset */ 7, // ignored when using relative timestamps
20,
true);
});
Expand Down

0 comments on commit 406ca0a

Please sign in to comment.