Skip to content

[feature] Don't record an early ended as finishing the title in the web player #3587

Open

Description

@blurbery

Problem

When the web player's <video> element fires ended, handleEnded in web/src/player/components/WatchPage.tsx reports positionSeconds: session.durationSeconds, whatever position the element actually stopped at. VideoPlayer.tsx's onVideoEnded then runs the post-roll and next-episode flow. So any stream that ends early but cleanly is saved as watched to the end, and the next episode starts.

#3512 was one way to get there: a progressive remux whose source stopped being readable ended its response cleanly at minute 20 of 45. The server half of that is fixed separately, so a source read error now breaks the response and reaches the player as MEDIA_ERR_NETWORK. Other clean early ends can still happen, for example a remux whose FFmpeg exits 0 for a reason the server doesn't recognise, or a file that is shorter on disk than its catalogued runtime because it was truncated after the scan.

Who it affects

Web UI viewers on any delivery where the media element can reach ended before the real end of the title.

Current workaround

Mark the episode unwatched by hand and go back to it.

Proposed behavior

An ended well short of the known runtime is not recorded as finishing the title: the saved position is where playback actually stopped, the title isn't marked watched, and the player doesn't auto-advance. It could instead go to the existing connection-lost handling, or show an error.

This needs care with the threshold. source.duration_seconds can differ a little from the real stream length, so a legitimate end must not be treated as an outage. Passing the element's position through VideoPlayer.tsx's onEnded overlaps the area open PR #2498 changes, so it's best done after that lands.

Alternatives considered

Leaving it to the server. The server can only break responses it knows are short, so the client still needs its own check.

AI harness

Claude Code (desktop app)

AI tool(s)

Claude Code

AI model(s)

claude-opus-5-5

AI involvement

AI-assisted

Independent or adversarial review

n/a

Confirmations

  • I searched open and closed issues, including ones closed as not planned, and this is not already requested
  • This is not one of Silo's non-goals

Activity

  1. added
    bug
    impact: playback
    priority: P2
    on Nov 5, 2026
  2. Rhainland commented on Nov 15, 2026

    @Rhainland
    Contributor

    Reproduced on origin/main at c11b0a9 in the web player. I used a TV library of three 180 s episodes, then replaced episode 2 with a 60 s file after the scan, so Silo still expected 180 s. The video fired ended at 60 s, "Up next" appeared, and episode 3 started on its own 10 s later.

    The saved progress is already right. The last progress report sent position 60, and the server stored 60/180, not completed, not played, with no completed history row. The server applies the watched threshold to the real position. The durationSeconds that handleEnded reports only reaches the client-side cache for multi-part files. What is wrong is the post-roll and next-episode flow running after a stream that ended early.

    Two choices need a maintainer before a fix:

    1. What counts as near the end. The server's watched threshold (playback.watched_threshold, default 90%) is an admin setting that no viewer-facing API exposes. Reusing it in the web client means a new /api/v2 field with a capability check, and matching work in the Apple and Android apps. The cheaper option is the web player's existing 30 s post-roll window (POST_ROLL_SECONDS_BEFORE_END). The two disagree: ending 60 s short of a 45-minute episode is watched under 90% but early under 30 s.
    2. What an early end does. Reconnecting fits a remux that stopped early, but on a truncated file it would replan, reach the same end, and could loop. An error with a retry button avoids that.

    With those settled, the change is small: onVideoEnded and handleEnded report the element's real position and skip the finish flow on an early end.

    AI disclosure: reproduced by Claude Code (claude-opus-5-5) at the maintainer's direction.

  3. Quick104 commented on Nov 25, 2026

    @Quick104
    Contributor

    A data point from agent runtime testing for validation task #199 on build 2970 · a16a24720: playing a truncated film (#5339) and seeking past where its data ends closed the web player, and the film was marked watched, unlike the repro above where the server kept the real position. Which position the player reported wasn't captured; Chrome most likely took the length from the file header.

    Evidence: https://evidence.siloserver.org/r/silo-server/v1-validation-199/

    Posted with Claude Code (claude-sonnet-5-5 testing, claude-opus-5-5 verification) and GitHub CLI at the maintainer's direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimpact: playbackpriority: P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions