Skip to content

Commit

Permalink
fix: seekable end cannot be negative
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-barstow committed Nov 14, 2024
1 parent f959134 commit b7a775a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1660,13 +1660,15 @@ export class PlaylistController extends videojs.EventTarget {
}

const liveEdgeDelay = Vhs.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main, media);
const livePoint = end - (liveEdgeDelay || 0);

if (livePoint < start) {
// Make sure our seekable end is not negative
const calculatedEnd = Math.max(0, end - liveEdgeDelay);

if (calculatedEnd < start) {
return null;
}

return createTimeRanges([[start, livePoint]]);
return createTimeRanges([[start, calculatedEnd]]);
}

const expired = this.syncController_.getExpiredTime(media, this.duration());
Expand Down

0 comments on commit b7a775a

Please sign in to comment.