Skip to content

Commit

Permalink
fix: Correct playhead when seek beyond seekRange (#6304)
Browse files Browse the repository at this point in the history
Fixes #5202

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
  • Loading branch information
CeilingFANC and avelad committed Apr 12, 2024
1 parent 7b717e5 commit a6d27a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/media/playhead.js
Expand Up @@ -382,10 +382,10 @@ shaka.media.MediaSourcePlayhead = class {
seekStart = seekEnd - this.minSeekRange_;
}

if (currentTime < seekStart) {
// The seek range has moved past the playhead. Move ahead to catch up.
if (currentTime < seekStart || currentTime > seekEnd) {
// playhead is outside of the seekrange. Move playhead to catch up.
const targetTime = this.reposition_(currentTime);
shaka.log.info('Jumping forward ' + (targetTime - currentTime) +
shaka.log.info('Jumping by ' + (targetTime - currentTime) +
' seconds to catch up with the seek range.');
this.mediaElement_.currentTime = targetTime;
}
Expand Down
2 changes: 1 addition & 1 deletion test/media/playhead_unit.js
Expand Up @@ -683,7 +683,7 @@ describe('Playhead', () => {

// It should allow a small buffer around the seek range.
seekCount = 0;
currentTime = 1030.062441;
currentTime = 1030;
jasmine.clock().tick(500);
currentTime = 1027.9233;
jasmine.clock().tick(500);
Expand Down

0 comments on commit a6d27a9

Please sign in to comment.