Skip to content

fix(playback): do not mark watched on premature EOF - #206

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-33f0
Closed

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-33f0

Conversation

@cursor

@cursor cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

A mid-episode network drop can permanently wipe watch progress.

Aether/FFmpeg reports end-of-stream when the upstream HTTP connection resets, even if the file is nowhere near finished. handleEndOfFile already classified that as premature (it cancelled autoplay and showed "Connection lost"), but then still:

  1. Snapped currentTime to duration
  2. Latched hasReachedEndOfFile
  3. Opened the Next Up postroll as if the video had actually ended (videoEnded: true, which hides Keep Watching)

PlayerNextUpCompletionPolicy treats hasReachedEndOfFile as a natural finish, so the next progress report, Play Next, or player dismiss sent position = duration to the server. Continue Watching then treated the episode as completed and the real resume point was gone.

Trigger: watch an episode well before the credits (for example 10 minutes into a 45-minute file). Drop the network so the demuxer hits EOS. Dismiss the player or tap Play Next. Reloading the item starts from the beginning (or skips it as watched) instead of 10:00.

The offline path already refused to mark completed on premature EOF; the online / completion-policy path did not.

Root cause

Premature EOF reused the natural-end latch (hasReachedEndOfFile + currentTime = duration). Completion finalization had no way to tell a connection-reset EOS from a real finish.

Fix

  • Keep the pause latch so a reset EOS does not keep draining, but record endedPrematurely.
  • Do not snap currentTime to duration on premature EOF.
  • Completion policy preserves the observed resume point when endedPrematurely is set.
  • Show Keep Watching (videoEnded: false) and resume from the drop point instead of duration - 10.
  • Flush the real resume point immediately so a kill before the 10s reporter cannot lose it.

Validation

  • Added tests that a premature EOF with hasReachedEndOfFile == true does not finalize at duration, including when the Next Up UI is already dismissed.
  • Existing natural-end and in-window Next Up finalization tests still expect duration.
  • Could not run xcodebuild from this Linux environment; tests should run in CI on the PR.
Open in Web View Automation 

A mid-episode HTTP reset still reports end-of-stream. The player already
detected that as premature (skip autoplay, show Connection lost) but then
snapped currentTime to duration and latched hasReachedEndOfFile, so the
completion policy treated the item as finished. Dismissing, Play Next, or
the next progress tick overwrote the real resume point with "watched".

Co-authored-by: Quick <[email protected]>

Quick104 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Silo's pull request guidance changed today (#658). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Evidence: none, no user-visible change. This PR was opened before the rule existed, so it hasn't had a chance to meet it yet.

Missing here: Before-and-after evidence that an item stopped by an early end of stream keeps its resume position instead of showing as watched, such as detail page screenshots.

The rules are in Show visible changes, and the PR template shows the Evidence section layout. This PR is already a draft, so I've left it that way. Please fill in the Evidence section before marking it ready for review.


Generated by Claude Code

@Quick104 Quick104 closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants