Skip to content

Commit

Permalink
fix duplicate same cues bcos of extra space issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ladera committed Mar 23, 2020
1 parent 1412b60 commit 6ebc6f5
Show file tree
Hide file tree
Showing 10 changed files with 699 additions and 405 deletions.
2 changes: 1 addition & 1 deletion dist/hls-demo.js.map

Large diffs are not rendered by default.

545 changes: 346 additions & 199 deletions dist/hls.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hls.js.map

Large diffs are not rendered by default.

542 changes: 344 additions & 198 deletions dist/hls.light.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hls.light.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hls.light.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hls.light.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hls.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hls.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/utils/webvtt-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ const WebVTTParser = {
cue.startTime += cueOffset - localTime;
cue.endTime += cueOffset - localTime;

const text = cue.text.trim();
// Create a unique hash id for a cue based on start/end times and text.
// This helps timeline-controller to avoid showing repeated captions.
cue.id = hash(cue.startTime.toString()) + hash(cue.endTime.toString()) + hash(cue.text);
cue.id = hash(cue.startTime.toString()) + hash(cue.endTime.toString()) + hash(text);

// Fix encoding of special characters. TODO: Test with all sorts of weird characters.
cue.text = decodeURIComponent(encodeURIComponent(cue.text));
Expand Down

0 comments on commit 6ebc6f5

Please sign in to comment.