Skip to content

Commit

Permalink
Fix test failing with #3063
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Walch committed Oct 8, 2020
1 parent c579fea commit a6943fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller/subtitle-stream-controller.js
Expand Up @@ -264,7 +264,7 @@ export class SubtitleStreamController extends BaseStreamController {

onMediaSeeking () {
if (this.fragCurrent) {
const currentTime = this.media ? this.media.currentTime : null;
const currentTime = this.media ? this.media.currentTime : 0;
const tolerance = this.config.maxFragLookUpTolerance;
const fragStartOffset = this.fragCurrent.start - tolerance;
const fragEndOffset = this.fragCurrent.start + this.fragCurrent.duration + tolerance;
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/controller/subtitle-stream-controller.js
Expand Up @@ -130,7 +130,8 @@ describe('SubtitleStreamController', function () {
});

describe('onMediaSeeking', function () {
it('nulls fragPrevious', function () {
it('nulls fragPrevious when seeking away from fragCurrent', function () {
subtitleStreamController.fragCurrent = { start: 1000, duration: 10 };
subtitleStreamController.fragPrevious = {};
subtitleStreamController.onMediaSeeking();
expect(subtitleStreamController.fragPrevious).to.not.exist;
Expand Down

0 comments on commit a6943fc

Please sign in to comment.