Skip to content

fix(playback): reopen a progressive remux at the playhead instead of refetching it from the start - #3649

Merged
Quick104 merged 10 commits into
Silo-Server:mainfrom
blurbery:fix/progressive-remux-range-refetch
Nov 9, 2026
Merged

Quick104 merged 10 commits into
Silo-Server:mainfrom
blurbery:fix/progressive-remux-range-refetch

Conversation

@blurbery

@blurbery blurbery commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #3640
Related issue: N/A
Validation tasks: unblocks #1252 C3 and C5; unblocks #1250 C5

In Chromium browsers, a progressive remux that loses its connection part way through recovers by downloading the whole stream again from the start, and playback stalls while it does. On a long 4K title each stall is longer than the last, which is the endless buffering in #3640. With this change the web player reopens the stream at its current position instead.

A progressive remux is one forward-only response from its seek origin, so the server answers every request 200 from that origin and ignores Range. When Chromium needs bytes it has not downloaded yet (after a dropped connection, or when its demuxer reads ahead of the download), it asks for Range: bytes=N-. It takes the 200 as the whole resource, reads everything up to byte N again, discards it, and only then plays on.

Approach

  • New /api/v2 progressive delivery feature, progressive_range_refusal_v1, sent in deliveries.progressive.features. The server advertises it, and the web video player sends it on Chromium browsers only. The audiobook player doesn't: it has no reopen at the current position, so a refusal would fail its route.
  • When the attempt negotiated it, the plan's server_remux_progressive URL carries remux_range=refuse. The API stream handler and the proxy (local remux, node relay and grant routes; the proxy advertises remux_range_refusal_v1 so the flag is only published through one that honours it) then answer a GET whose range starts past byte 0 with 409, before any capacity is held or ffmpeg starts, and leave the session alone. bytes=0-, bytes=0-1, no Range and HEAD stream as before.
  • Chromium reports the 409 as MEDIA_ERR_NETWORK, and the player's existing reconnect replans the same route at the current position, which mints a new URL with seek=. Both reconnect and seek reanchor replans keep the flag. A transport that settled paused on its first frame also counts for the reconnect, and the reconnect resumes playing when the viewer was playing. Chromium pauses the element before it reports the error, so the player tracks the viewer's intent from play and pause events instead of reading video.paused.
  • Not 416, which is what the issue suggests: Chromium treats a 416 as end of file, so the episode would end at the playhead, be marked watched and auto-advance.
  • Opt-in only, because ExoPlayer on Android resumes a dropped connection with Range: bytes=N- and skips the bytes it already has, so a refusal there would turn a slow recovery into an error. Safari and the iOS builds of other browsers use WebKit's loader and keep the plain stream too. silo-android, silo-apple and jellycompat are unchanged and need no follow-up.
  • The playback API and protocol docs, the OpenAPI contract, the web API types and the playback fixtures are updated for the new feature and query parameter.

Validation

  • New handler test for the refusal: resumed and suffix ranges get 409 without starting the remux or ending the session, and everything else, including requests without the opt-in, streams from the origin. The refused rows fail without the fix.
  • New web test row pinning which browsers opt in (Chrome and Edge yes; Safari, Chrome on iOS and Firefox no).
  • go test for internal/api/handlers, internal/proxy and internal/apiv2: pass. go vet on the touched packages: clean.
  • internal/playback locally: 31 hardware-acceleration probe and ffmpeg filter tests fail against this Mac's ffmpeg build; none touch this change. Leaving that package to CI.
  • make verify-apiv2-openapi, verify-playback-fixtures, verify-apiv2-web-types and verify-local-paths: current. make route-inventory can't type-check the cgo packages locally; no routes changed, so CI's check covers it.
  • Web: the client context and playback session test files pass, plus eslint, prettier and tsc.
  • Real local run, described under Evidence.

Evidence

Surface: web player, Chrome 152 (headless), desktop viewport, local Silo with a synthetic 5-minute H.264 MKV with 5.1 AC-3 audio (no real media). Before: a52941174 (main). After: 45226f208. Same database, same file, both starting at 0:00, browser decoding turned off so the planner picks server_remux_progressive with audio_to_aac, as in the issue.

A test proxy in front of the dev server throttles stream responses to about 2× the clip's bitrate and cuts the first stream response once after 30 MB. That stands in for the dropped connection. It does not reproduce the auto-advance trigger or the endless loop from the issue, only the refetch and the recovery.

Stream requests seen by the proxy (tokens redacted):

Before (main)
#1 GET /api/v2/stream/<session>?st=<redacted>&token=<redacted>  Range: bytes=0-         -> 200, cut after 30.0 MB
#2 GET /api/v2/stream/<session>?st=<redacted>&token=<redacted>  Range: bytes=29992431-  -> 200, 79.0 MB sent (re-read from byte 0)
   video frozen at 0:38 for about 19 s under "Reconnecting…", then plays on

After (this branch)
#1 GET /api/v2/stream/<session>?st=<redacted>&remux_range=refuse&token=<redacted>  Range: bytes=0-         -> 200, cut after 30.0 MB
#2 GET /api/v2/stream/<session>?st=<redacted>&remux_range=refuse&token=<redacted>  Range: bytes=29992431-  -> 409
   video.error.code = 2 at 0:36; reconnect replans (server_remux_progressive)
#3 GET /api/v2/stream/<session>?st=<redacted>&seek=35.998864&remux_range=refuse&token=<redacted>  Range: bytes=0-  -> 200

Recordings and frames of both runs:

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3649/

The captures are from 45226f208, before the review fixes. Those fixes change what follows the reopen: playback resumes instead of waiting paused. VideoPlayer.test.tsx covers that with the event order Chromium uses (error with paused already true, then pause), and the test fails before the fix.

Mobile web is unaffected: nothing in the layout changes, and the only visible difference is which existing player state shows.

Risks

  • Fixed in review: the reconnect used to reopen paused because Chromium had already paused the element when the error arrived. That is also why any network error on main comes back paused.
  • Why the second episode in [bug] Web: progressive remux in Chromium gets stuck re-fetching the stream from its origin (endless buffering) #3640 went into this state when the first didn't is still unknown. I've asked the reporter for edge://media-internals data. If the trigger repeats on every fresh load, the player now stops with "connection lost" after its 12 reconnect attempts instead of stuttering forever.
  • A refusal that arrives before the transport has shown a frame goes down the plan-failure path instead of the reconnect, so the route is replaced rather than reopened. Unlikely, since the first request always starts at byte 0.
  • An older proxy would ignore the parameter, so proxies now advertise remux_range_refusal_v1 and a proxy-served URL only carries remux_range=refuse when its proxy does. Behind an older proxy the stream behaves as it does today.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (desktop app)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted. AI-assisted with Claude Opus. I directed the task and designed the work.
  • Adversarial review: maintainer review of 6d692b9 with a cross-provider check (Codex gpt-6.1-sol). The review's five findings are fixed in 23e21eddd5 and 4dbb92a168.

Note

Add progressive remux range refusal (remux_range=refuse) so players reopen at the playhead

  • Adds the progressive_range_refusal_v1 playback feature and the remux_range=refuse query parameter. Chromium browsers with position-based reopening enabled advertise the feature, and the server appends the parameter to progressive remux URLs served by API egress or a proxy advertising the remux_range_refusal_v1 transport capability.
  • Requests that opt in and send a byte range needing a resume (nonzero start or nonempty suffix) get HTTP 409 instead of a refetch from the start. Guards live in stream.go, mediagrant.go, and the proxy relay/local remux paths in server.go; range classification is RefusesRemuxRange in remux_range.go.
  • Player side: VideoPlayer.reportConnectionLost now handles network errors after a transport has shown a frame (even when paused) and reports tracked viewer play intent, so error-induced pauses do not lose play state. See VideoPlayer.tsx.
  • Updates protocol docs, OpenAPI schema, route metadata, and test fixtures with the new feature.
  • Behavioral Change: opted-in requests that previously streamed a range past the origin now return 409; /api/v1 requests and requests without the opt-in are unchanged. Proxy-served URLs omit the parameter when the proxy does not advertise the capability.

Macroscope summarized 4dbb92a.

…emux

A progressive remux is one forward-only response from its seek origin, so
it answers 200 from that origin to any Range. When Chromium asks for
`Range: bytes=N-` part way through, it takes that 200 as the whole
resource, reads everything up to N again and discards it, and on a long
title each refetch stalls for longer than the last.

A client can now list progressive_range_refusal_v1 in
deliveries.progressive.features on /api/v2. Its progressive remux URLs
then carry remux_range=refuse, and the API stream handler and the proxy
answer a GET whose range starts past byte 0 with 409 before any work
starts. Chromium surfaces that as a network error, and the web player's
reconnect reopens the stream at the current position. A 416 is not used
because Chromium reads it as end of file.

The web player opts in on Chromium browsers only. Other media loaders,
and native players that skip the bytes they already have on a resumed
request, keep the 200.
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 8, 2026
@silo-kody

silo-kody Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-triage silo-triage Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media javascript Pull requests that update javascript code priority: P1 Core-path bug; painful workaround — next after P0 labels Nov 8, 2026
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The web player advertises progressive range refusal for Chromium. The backend negotiates the feature and adds remux_range=refuse to eligible progressive remux URLs. API and proxy paths return HTTP 409 for opted-in GET requests with nonzero-start or suffix ranges. API schemas and playback documentation describe the behavior.

Changes: Progressive remux range refusal

Layer / File(s) Summary
Feature negotiation
internal/playback/protocol_v3.go, web/src/player/protocol-v3.ts, web/src/player/utils/browser.ts, web/src/player/client-context-v3.ts, web/src/player/client-context-v3.test.ts, internal/playback/testdata/protocol_v3/*, docs/design/schemas/playback-v3/v3/fixtures/valid/*, internal/proxy/server.go
The web player advertises the feature for Chromium user agents. The backend recognizes and advertises the feature and proxy capability. Playback response fixtures include the server feature.
URL opt-in and range refusal
internal/api/handlers/playback_v3.go, internal/api/handlers/playback_v3_test.go, internal/playback/remux_range.go, internal/api/handlers/stream.go, internal/api/handlers/stream_test.go, internal/proxy/mediagrant.go, internal/proxy/server.go
The backend adds remux_range=refuse to eligible progressive remux URLs. API and proxy remux paths reject opted-in GET requests with nonzero-start or suffix ranges before remux work starts or is relayed. Tests cover capability checks, refusal cases, and requests that continue through the existing flow.
API and playback contract
contracts/api/v2/openapi.json, internal/apiv2/playback_delivery.go, internal/proxy/streaming_protocol.go, web/src/api/v2/schema.ts, docs/architecture/playback-protocol-v3.md, docs/playback-api.md
API schemas and playback documentation describe the remux_range parameter, feature negotiation, proxy capability, and documented 409-versus-200 behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant WebPlayer
  participant PlaybackAPI
  participant StreamHandler
  participant Proxy
  WebPlayer->>PlaybackAPI: Advertise progressive_range_refusal_v1
  PlaybackAPI->>Proxy: Check remux range-refusal capability
  PlaybackAPI->>WebPlayer: Return eligible URL with remux_range=refuse
  WebPlayer->>StreamHandler: GET progressive remux with Range
  StreamHandler->>StreamHandler: Check method, opt-in, and range
  StreamHandler->>WebPlayer: Return 409 for qualifying range
  Proxy->>Proxy: Check opted-in range before remux work
Loading

Possibly related issues

  • Issue 3512: It concerns clean stream termination and watched-state handling. This change covers opted-in range requests and does not change clean-end handling.

Suggested reviewers: quick104, rhainland

Merge Risk: Low · up to 8ba35

Android playback and explicitly opted-in v1 streams can receive new 409 responses. These bounded compatibility and documentation issues should be addressed or accepted before merging.

Architecture risk: Low · up to 8ba35

The change affects 4 systems.

Changed systems: internal, docs, web, contracts

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — internal (service) was modified; 13 changed files map to changed impact.
  • observed — docs (service) was modified; 5 changed files map to changed impact.
  • observed — web (service) was modified; 5 changed files map to changed impact.
  • observed — contracts (api) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in contracts/api/v2/openapi.json: Adds remux_range, limited to refuse, to the progressive server-remux parameters. Its description states that when the attempt negotiated progressive_range_refusal_v1, a GET range starting after byte 0 or a suffix range returns 409 before work starts; without it, the range streams from the origin with 200.
  • observed — Modified behavior in contracts/api/v2/openapi.json: Adds the same remux_range=refuse parameter and negotiated range-refusal description to another progressive server-remux operation.
  • observed — Modified behavior in contracts/api/v2/openapi.json: Adds remux_range=refuse to the progressive remux GET parameters and updates the endpoint description to document 409 for a negotiated GET range starting after byte 0 or a suffix range, before work starts or is relayed; without the parameter, the range streams from the origin.
  • observed — Modified behavior in contracts/api/v2/openapi.json: Adds remux_range=refuse to the progressive remux HEAD parameters and updates the endpoint description with the same negotiated GET range-refusal behavior.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title "fix(playback): reopen a progressive remux at the playhead instead of refetching it from the start" matches the main change. The PR adds an opt-in remux_range=refuse mechanism and a `progr…
Linked Issues check Passed Directly linked issue #3640 is open and active. Its coding requirements are assessed below.

(a) [#3640] Do not answer a ranged progressive-remux GET with 200 from the origin. Implemented. At head, in…
Out of Scope Changes check Passed Every listed change supports the progressive range-refusal feature. Groups:

- Contracts and docs: contracts/api/v2/openapi.json, docs/playback-api.md, docs/architecture/playback-protocol-v3.md. They …
Docstring Coverage Passed Docstring coverage is 90.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Description check Passed The description is specific and on-topic. It names the bug (Chromium progressive-remux refetch from byte 0 after a dropped connection), the fix (opt-in progressive_range_refusal_v1 returning 409 for n…
Full details: Title check

Explanation

The title "fix(playback): reopen a progressive remux at the playhead instead of refetching it from the start" matches the main change. The PR adds an opt-in remux_range=refuse mechanism and a progressive_range_refusal_v1 feature so that the Chromium web player reopens a progressive remux at the current position rather than re-downloading from byte 0. The title is specific and describes the primary behavior. It is somewhat long at 97 characters, but it is not vague or off-topic.

Full details: Linked Issues check

Explanation

Directly linked issue #3640 is open and active. Its coding requirements are assessed below.

(a) [#3640] Do not answer a ranged progressive-remux GET with 200 from the origin. Implemented. At head, internal/playback/remux_range.go defines RefusesRemuxRange. It returns true only for a GET whose URL carries remux_range=refuse and whose Range is bytes= with a start past byte 0 or a nonempty suffix. Any range in a multi-range set can trigger it. bytes=0-, bytes=0-1, no Range, unparseable Range and HEAD keep the 200 path. The stream handler, proxy local remux, node relay and grant paths call this check before capacity is held or ffmpeg starts, and return 409. The issue lists 'another clear refusal' as an alternative to 416. The PR justifies 409 because Chromium treats 416 as end of file.

(b) [#3640] Re-anchor at the current position instead of refetching from the origin. Implemented through the existing reconnect path. Chromium reports the 409 as MEDIA_ERR_NETWORK. The player replans with seek=, and reconnect and seek replans keep the flag. The local Chrome 152 run shows 409 on bytes=29992431-, followed by 200 with seek=35.998864.

(c) [#3640] The issue states an either-or expected behaviour: one continuous response, or re-anchoring after a dropped connection. The re-anchoring alternative is met for a dropped connection. The continuous-response alternative is not established by this PR, and the issue does not require it.

Opt-in is limited to Chromium user agents. web/src/player/utils/browser.ts (isChromiumUserAgent) matches Chrome/ and Chromium/ and excludes CriOS/, EdgiOS/ and OPiOS/. Native clients, Safari and Firefox keep existing behaviour.

Incremental check since the previous reviewed head: the diffs of internal/api/handlers/stream.go and internal/proxy/server.go are empty, and remux_range.go at head matches the described rule. The earlier conclusions for those paths still hold.

Tests: TestHandleStream_RemuxRangeRefusal covers the refusal rules. A web test covers the browser opt-in matrix. A playback_v3 test covers proxy flag publication.

Unresolved uncertainty: the issue does not show Range headers in its server log. The fix applies only when Chromium sends bytes=N- requests. The evidence for that is a synthetic clip, a throttling proxy and headless Chrome 152. It does not use the reporter's 4K Dolby Vision Edge setup. The original auto-advance trigger is unknown. The seek-triggered refetch (issue point 3) falls under the same 409 rule but was not verified separately.

Full details: Out of Scope Changes check

Explanation

Every listed change supports the progressive range-refusal feature. Groups:

  • Contracts and docs: contracts/api/v2/openapi.json, docs/playback-api.md, docs/architecture/playback-protocol-v3.md. They document progressive_range_refusal_v1 and remux_range=refuse.
  • Fixtures: three docs fixtures and three internal/playback/testdata decision responses. Each adds the progressive_range_refusal_v1 server_features entry only. Plans and outcomes are unchanged.
  • Server and API: internal/api/handlers/playback_v3.go (negotiation limited to /api/v2, proxy capability check), internal/api/handlers/stream.go and its test, internal/apiv2/playback_delivery.go (parameter on media-bytes routes), internal/playback/protocol_v3.go and remux_range.go, internal/proxy/mediagrant.go, server.go and streaming_protocol.go. The proxy capability advertisement and its test support the rule that proxies receive the flag only when they honour it.
  • Web: web/src/api/v2/schema.ts, web/src/player/protocol-v3.ts, client-context-v3.ts and its test, utils/browser.ts.

No unrelated edits appear in the file summaries. Native clients and jellycompat are not changed and do not opt in. The incremental diffs for stream.go and server.go since the previous reviewed head are empty.

Limit: this assessment uses the file summaries, the content of remux_range.go at head, and the incremental diffs for two files. It did not read every per-file hunk of the whole pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 90.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 10 functions across 14 files. (2 skipped: 2 unsupported.)

Full details: Description check

Explanation

The description is specific and on-topic. It names the bug (Chromium progressive-remux refetch from byte 0 after a dropped connection), the fix (opt-in progressive_range_refusal_v1 returning 409 for nonzero-start or suffix ranges, with replanning at the playhead), and the touched areas (API handler, proxy, web player, docs, fixtures). It also lists validation, evidence, and risks. The changeset matches these claims, so the description is related to the changes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment thread internal/api/handlers/playback_v3.go Resolved
@coderabbitai coderabbitai Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 8, 2026
…onours it

An older proxy ignores remux_range and streams a mid-stream range from the
origin, so a plan that sent the flag through it promised a 409 the proxy
never sends. Proxies now advertise remux_range_refusal_v1 in their
transport features, and a proxy-served progressive remux URL carries the
flag only when its proxy does. The API egress always refuses, and a remux
relayed from a transcode node is refused at the proxy before it relays.
@silo-triage silo-triage Bot removed the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 8, 2026
@silo-kody

silo-kody Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Additional comments: 1

internal/playback/remux_range.go: 1

27-47: Trivial · Functional Correctness · Low value

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Handle a multi-range header and a zero-start suffix edge.

Only the first range of a multi-range header is checked. A request such as bytes=0-1,5000- is treated as origin-start and streams from the origin. Clients that send one range are unaffected. Evaluate every range spec, or refuse when any spec starts past byte 0. Browsers do not normally send multi-range requests, so the impact is small.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 67b21670-1df0-4d41-a10b-ad206e48253e
Commits

Reviewing files that changed from the base of the PR and between a529411 and 45226f2.

Files selected for processing: 23

  • contracts/api/v2/openapi.json
  • docs/architecture/playback-protocol-v3.md
  • docs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-rendition-decision_response.json
  • docs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-renditions-all-decision_response.json
  • docs/design/schemas/playback-v3/v3/fixtures/valid/learned-limit-decision_response.json
  • docs/playback-api.md
  • internal/api/handlers/playback_v3.go
  • internal/api/handlers/stream.go
  • internal/api/handlers/stream_test.go
  • internal/apiv2/playback_delivery.go
  • internal/playback/protocol_v3.go
  • internal/playback/remux_range.go
  • internal/playback/testdata/protocol_v3/hls-subtitle-rendition-decision_response.json
  • internal/playback/testdata/protocol_v3/hls-subtitle-renditions-all-decision_response.json
  • internal/playback/testdata/protocol_v3/learned-limit-decision_response.json
  • internal/proxy/mediagrant.go
  • internal/proxy/server.go
  • internal/proxy/streaming_protocol.go
  • web/src/api/v2/schema.ts
  • web/src/player/client-context-v3.test.ts
  • web/src/player/client-context-v3.ts
  • web/src/player/protocol-v3.ts
  • web/src/player/utils/browser.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread contracts/api/v2/openapi.json Resolved
Comment thread docs/playback-api.md Resolved
Comment thread internal/api/handlers/playback_v3.go Resolved
…ffix ranges

A range set such as `bytes=0-1,5000-` was judged by its first range only
and streamed from the origin. Every range in the set is now checked, and
the playback API, protocol doc and proxy operation descriptions say that
a suffix range is refused too, as the server already did.
@silo-kody

silo-kody Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Add the marker to the query-parameter contract. · playback-protocol-v3.md:966-967

docs/architecture/playback-protocol-v3.md:966-967
Minor · Data Integrity & Integration · Quick win

Add the marker to the query-parameter contract.

These rows say seek is the only progressive-media parameter, but opted-in URLs can also contain remux_range=refuse. A client validating URLs against this table could reject a valid plan. Add the marker to both media rows. (raw.githubusercontent.com)

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 71850a00-0ea6-4b1e-918d-6cab688b85ff
Commits

Reviewing files that changed from the base of the PR and between a529411 and 486e5f5.

Files selected for processing: 24

  • contracts/api/v2/openapi.json
  • docs/architecture/playback-protocol-v3.md
  • docs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-rendition-decision_response.json
  • docs/design/schemas/playback-v3/v3/fixtures/valid/hls-subtitle-renditions-all-decision_response.json
  • docs/design/schemas/playback-v3/v3/fixtures/valid/learned-limit-decision_response.json
  • docs/playback-api.md
  • internal/api/handlers/playback_v3.go
  • internal/api/handlers/playback_v3_test.go
  • internal/api/handlers/stream.go
  • internal/api/handlers/stream_test.go
  • internal/apiv2/playback_delivery.go
  • internal/playback/protocol_v3.go
  • internal/playback/remux_range.go
  • internal/playback/testdata/protocol_v3/hls-subtitle-rendition-decision_response.json
  • internal/playback/testdata/protocol_v3/hls-subtitle-renditions-all-decision_response.json
  • internal/playback/testdata/protocol_v3/learned-limit-decision_response.json
  • internal/proxy/mediagrant.go
  • internal/proxy/server.go
  • internal/proxy/streaming_protocol.go
  • web/src/api/v2/schema.ts
  • web/src/player/client-context-v3.test.ts
  • web/src/player/client-context-v3.ts
  • web/src/player/protocol-v3.ts
  • web/src/player/utils/browser.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Comment thread docs/playback-api.md Resolved
The media query-parameter table now lists remux_range beside seek, the
feature row and the playback API say an older proxy's URL goes without
the marker and keeps the 200, and the playback API notes that the API
answers the 409 as a v2 problem while a proxy answers in plain text.
@silo-kody

silo-kody Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 4 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime
  • Preserve durable media identity and share identity-evidence precedence
  • Bound decoder throughput trades and share direct-play eligibility

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 66e32758-e238-45ad-bf43-2491b8ad7713
Commits

Reviewing files that changed from the base of the PR and between 486e5f5 and 22e1a79.

Files selected for processing: 2

  • docs/architecture/playback-protocol-v3.md
  • docs/playback-api.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

Comment thread docs/playback-api.md Resolved
The query-parameter table now says a replan request's own opt-in decides
the marker, while a seek reanchor keeps the attempt's stored one, and the
playback API says the web player opts in on Chromium browsers only.
@silo-kody

silo-kody Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 4 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime
  • Preserve durable media identity and share identity-evidence precedence
  • Bound decoder throughput trades and share direct-play eligibility

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

Minor · Exclude Android from the range-refusal opt-in. · browser.ts:5-13

web/src/player/utils/browser.ts:5-13
Minor · Functional Correctness · Quick win

Exclude Android from the range-refusal opt-in.

Android Chrome matches isChromiumUserAgent, so its progressive remux requests can receive 409 instead of the previous stream response. This changes Android playback outside the stated scope.

Suggested fix

-      features: isChromiumUserAgent(userAgent) ? [FEATURE_PROGRESSIVE_RANGE_REFUSAL_V3] : [],
+      features:
+        isChromiumUserAgent(userAgent) && !/\bAndroid\b/i.test(userAgent)
+          ? [FEATURE_PROGRESSIVE_RANGE_REFUSAL_V3]
+          : [],
Minor · Keep range refusal off the v1 stream route. · stream.go:256-261

internal/api/handlers/stream.go:256-261
Minor · Data Integrity & Integration · Quick win

Keep range refusal off the v1 stream route.

For a valid v1 remux session, remux_range=refuse and Range: bytes=1- now return 409 instead of streaming with 200. This adds the v2-only feature to the frozen v1 contract. Gate the refusal by API version while preserving it on v2.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bb1bd6b2-20cf-4e27-9119-f6b3487ddf95
Commits

Reviewing files that changed from the base of the PR and between 22e1a79 and 8ba3582.

Files selected for processing: 2

  • docs/architecture/playback-protocol-v3.md
  • docs/playback-api.md
Files skipped from review as they are similar to previous changes: 1

  • docs/playback-api.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

…route

The stream handler serves both /api/v1 and /api/v2. The v2 media route now
marks its requests as native v2, as the subtitle route already does, and
the refusal applies only under that mark, so a v1 request keeps streaming
from the origin whatever its query says. The protocol doc also names
seek_failure_recovery beside seek_reanchor as keeping the stored opt-in.
@silo-kody

silo-kody Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 6d692b9. The approach holds up: refusing the range is what stops Chromium re-reading the stream from byte 0, the opt-in follows the existing per-delivery feature pattern, and older proxies keep today's stream. I found five things to change, three inline and two below because VideoPlayer.tsx isn't in the diff. I'm fixing all five in a commit on this branch, so there's no need to change anything yourself.

Medium: a 409 on a transport that settled paused goes to route recovery instead of the reconnect. reportConnectionLost (VideoPlayer.tsx:968) hands a network error to the reconnect only when streamPlayedRef is set, and settlePaused doesn't set it. A transport that is showing its first frame but hasn't played yet is in that state: blocked autoplay, a start with autoplay off, a room hold, and the paused replacement this PR's own reconnect leaves behind. If Chromium refetches that paused stream mid-way, it now gets the 409, and the error is reported as decoder_error. The failure replan then excludes the remux plan, so playback moves to a transcode or ends, when the stream should just reopen. Before this PR the same refetch got a 200. A cross-provider check reproduced it in Chrome 157: the stream loaded paused (readyState 3), the connection was cut at 393,216 bytes, Chromium asked for bytes=393216-, got 409, and raised error code 2 before any playing event. Fix: a transport that has shown a frame, played or settled paused, counts for the reconnect.

Medium: the reconnect after a refusal reopens paused even when the viewer was playing. This is the cause of the paused-after-reconnect outcome under Risks. reportConnectionLost passes !video.paused as the resume intent, but Chromium has already paused the element by the time it reports the network error. In a Chrome 156 run, error arrived with paused: true, followed by a pause event with video.error already set. On main this happened only on real network errors. With this PR every refused range takes this path, so each recovery would pause playback until the viewer presses play. Fix: track the viewer's intent from the element's play and pause events, ignoring the pause that comes with a media error, and pass that to the reconnect.

🤖 Claude Code (claude-opus-5-5)

Comment thread web/src/player/client-context-v3.ts Resolved
Comment thread internal/api/handlers/playback_v3.go Resolved
Comment thread docs/playback-api.md Resolved
Quick104 and others added 2 commits November 9, 2026 10:29
The audiobook player shared the Chromium opt-in but has no reopen at the
current position, so a refused range became a failed route. The opt-in is now
a caller parameter that only the video player's session passes.

In the video player, a transport settled paused on its first frame now counts
for the reconnect, and the reconnect resumes playing when the viewer was:
Chromium pauses the element before it reports the network error, so the
element's paused state no longer stands in for the viewer's intent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…usal

Deciding whether a proxy honours remux_range no longer runs a synchronous
capability probe under the session's lifecycle lock; it reuses the snapshot
planning just read. The docs now say the API refuses before the remux starts,
since session reconstruction and preflight still run first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added size/XL 500–999 added + deleted lines (all files); change volume, not priority. and removed size/L 200–499 added + deleted lines (all files); change volume, not priority. labels Nov 9, 2026
@silo-kody

silo-kody Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104

Quick104 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Maintainer review summary

Reviewed head: 4dbb92a168 (my review ran on 6d692b9, and I added 23e21eddd5 and 4dbb92a168 on top).

Fit: 8/10 · Readiness: 8/10 — conditional (assuming CI is green)

Fit: this fixes a real stall in the core web playback path, in the right place. The server refuses a range it can't serve, and the client opts in through the existing per-delivery feature negotiation, so Apple, Android, Firefox, Safari and older proxies keep today's stream. It holds at 8 because it adds new /api/v2 surface (a delivery feature, a query parameter, and a proxy transport feature), which suits a fix that closes a gap in the core experience.

Readiness: the refused-range rows in TestHandleStream_RemuxRangeRefusal fail on the base (200, want 409) and pass on the head. The two VideoPlayer tests and the client-context assertion added in review fail on 6d692b9 and pass on 4dbb92a168. The remaining condition: no one has watched the review fixes live yet. The author's captures are from before them, and the playback resume after a reopen is covered by a unit test and a standalone Chromium check of the event order, not by a run of the app.

Addressed in this review

  • The audiobook player opted in without a way to recover. On Chromium it got the 409 and treated it as a failed route, which could end playback. The opt-in is now a parameter that only the video player passes (23e21eddd5).
  • A transport settled paused on its first frame went to route recovery on a refusal. That covers blocked autoplay, autoplay off, a room hold, and the paused replacement after a reconnect. It now counts for the reconnect (23e21eddd5).
  • The reconnect reopened paused even when the viewer was playing. Chromium pauses the element before it reports the error. The player now tracks the viewer's intent from play and pause events (23e21eddd5). This is also why any network error on main comes back paused.
  • A synchronous proxy capability probe ran under the session's lifecycle lock. It now reuses the snapshot planning just read (4dbb92a168).
  • The docs said the 409 comes "before any work starts". On the API path, session reconstruction and preflight run first, so they now say "before the remux starts" (4dbb92a168).

Left for maintainers

  • On /api/v2, the refusal and the existing playback_route_unbound both come out as the same generic conflict problem. The media-route writer maps errors by status alone. Both currently lead to a new plan, so nothing breaks, but a client can't tell them apart. If that distinction should be part of the contract, it needs a decision before /api/v2 locks.
  • The Chromium check also matches smart-TV browsers (webOS, Tizen) whose <video> may use a vendor pipeline. Nobody has tested how those report a 409.

Validated features

No passed case regresses. The cases this reaches have no recorded results yet: #1252 C3 (seek beyond buffer) and C5 (mid-stream reconnect), and #1250 C5 (playback failure and recovery). They become runnable with this change, so the body now says Validation tasks: unblocks #1252 C3 and C5; unblocks #1250 C5. Re-test them on a Chromium build.

Other checks

  • User manual: unaffected. No setting, label, default or setup step changes, and the manual doesn't describe progressive remux recovery.
  • Apple, Android, jellycompat: no follow-up needed. They never send the feature, and /api/v1 is excluded.
  • Cross-provider review (Codex gpt-6.1-sol) on 6d692b9: it confirmed the findings above and reproduced the paused-state refusal in Chrome. It found nothing further.

🤖 Claude Code (claude-opus-5-5)

@Quick104
Quick104 merged commit ea6e664 into Silo-Server:main Nov 9, 2026
39 of 41 checks passed
Quick104 added a commit that referenced this pull request Nov 14, 2026
Resolves the conflicts in VideoPlayer with #3649's viewerPlayingRef, which
already takes the reconnect's resume intent from the element's play and pause
events. The branch's own playingRef is dropped; the Watch Together command
path now sets viewerPlayingRef from the command instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media javascript Pull requests that update javascript code priority: P1 Core-path bug; painful workaround — next after P0 size/XL 500–999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Web: progressive remux in Chromium gets stuck re-fetching the stream from its origin (endless buffering)

2 participants