Skip to content

Commit

Permalink
chore: update run-fast-quality-switch and fix bad timeline changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dzianis-dashkevich committed Nov 13, 2024
1 parent 231b4bb commit 140eec3
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,19 @@ export class PlaylistController extends videojs.EventTarget {
this.timelineChangeController_.on('fixBadTimelineChange', () => {
// pause, reset-everything and load for all segment-loaders
this.logger_('Fix bad timeline change. Restarting al segment loaders...');
this.setCurrentTime(this.tech_.currentTime());
this.mainSegmentLoader_.pause();
this.mainSegmentLoader_.resetEverything();
if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
this.audioSegmentLoader_.pause();
this.audioSegmentLoader_.resetEverything();
}
if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
this.subtitleSegmentLoader_.pause();
this.subtitleSegmentLoader_.resetEverything();
}

// start segment loader loading in case they are paused
this.load();
});

this.mainSegmentLoader_.on('earlyabort', (event) => {
Expand Down Expand Up @@ -1130,24 +1142,19 @@ export class PlaylistController extends videojs.EventTarget {

runFastQualitySwitch_() {
this.waitingForFastQualityPlaylistReceived_ = false;
// Delete all buffered data to allow an immediate quality switch.
this.mainSegmentLoader_.pause();
this.mainSegmentLoader_.resetEverything(() => {
this.mainSegmentLoader_.load();
});

this.mainSegmentLoader_.resetEverything();
if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
this.audioSegmentLoader_.pause();
this.audioSegmentLoader_.resetEverything(() => {
this.audioSegmentLoader_.load();
});
this.audioSegmentLoader_.resetEverything();
}
if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
this.subtitleSegmentLoader_.pause();
this.subtitleSegmentLoader_.resetEverything(() => {
this.subtitleSegmentLoader_.load();
});
this.subtitleSegmentLoader_.resetEverything();
}

// start segment loader loading in case they are paused
this.load();
}

/**
Expand Down

0 comments on commit 140eec3

Please sign in to comment.