Skip to content

fix: Fix end-of-stream detection for VOD #8813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4164,7 +4164,14 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
this.bufferObserver_,
'Need a buffering observer to update');

const bufferedToEnd = this.isEnded() || this.playhead_.isBufferedToEnd();
// This means that MediaSource has buffered the final segment in all
// SourceBuffers and is no longer accepting additional segments.
const mseEnded = this.mediaSourceEngine_ ?
this.mediaSourceEngine_.ended() : false;

const bufferedToEnd = this.isEnded() || mseEnded ||
this.playhead_.isBufferedToEnd();

const bufferLead = shaka.media.TimeRangesUtils.bufferedAheadOf(
this.video_.buffered,
this.video_.currentTime);
Expand Down Expand Up @@ -9347,6 +9354,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
if (!this.video_ || this.video_.ended) {
return true;
}

return this.fullyLoaded_ && !this.isLive() &&
this.video_.currentTime >= this.seekRange().end;
}
Expand Down