Skip to content

Commit

Permalink
Only restart interval if we have a current track
Browse files Browse the repository at this point in the history
… otherwise it is done inside the onSubtitleTrackSwitch and/or onSubtitleTrackLoaded event.
video-dev#3053
  • Loading branch information
netTrekfd committed Sep 29, 2020
1 parent dc3ebff commit bc1512d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/controller/subtitle-stream-controller.js
Expand Up @@ -42,10 +42,14 @@ export class SubtitleStreamController extends BaseStreamController {

startLoad () {
this.stopLoad();
this.setInterval(TICK_INTERVAL);

this.state = State.IDLE;
this.tick();

// Check if we already have a track with necessary details to load fragments
const currentTrack = this.tracks[this.currentTrackId];
if (currentTrack && currentTrack.details) {
this.setInterval(TICK_INTERVAL);
this.tick();
}
}

onSubtitleFragProcessed (data) {
Expand Down

0 comments on commit bc1512d

Please sign in to comment.