Skip to content

Commit

Permalink
fix: Looser tolerance for ending trick play at edge of seek range. (#…
Browse files Browse the repository at this point in the history
…6422)

Fixes #6421
  • Loading branch information
david-hm-morgan authored and avelad committed Apr 10, 2024
1 parent 2fd1b03 commit 4edf77e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3544,12 +3544,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
const currentTime = this.video_.currentTime;
const seekRange = this.seekRange();
const safeSeekOffset = this.config_.streaming.safeSeekOffset;

// Cancel trick play if we hit the beginning or end of the seekable
// (Sub-second accuracy not required here)
if (rate > 0) {
if (currentTime >= seekRange.end) {
if (Math.floor(currentTime) >= Math.floor(seekRange.end)) {
this.cancelTrickPlay();
}
} else {
if (currentTime <= (seekRange.start + safeSeekOffset)) {
if (Math.floor(currentTime) <=
Math.floor(seekRange.start + safeSeekOffset)) {
this.cancelTrickPlay();
}
}
Expand Down

0 comments on commit 4edf77e

Please sign in to comment.