Skip to content

fix(player): offer skip for every marker occurrence - #694

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:fix/693-marker-occurrences
Oct 31, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:fix/693-marker-occurrences

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #693
Related issue: Silo-Server/silo-server#1147
Validation tasks: unblocks #321 C1; #322 C1

When an episode has two credits ranges, the phone, tablet and TV players offer Skip Credits only in the first one. The apps read only the singular intro, recap and credits fields, and the server fills those with the first occurrence of each kind. The full list is in marker_segments, which the apps never read. Episodes from TheIntroDB (for example Game of Thrones S02E03) have this shape, with a mid-credits scene between the two ranges.

Approach

The shared module now reads marker_segments from each file version in v2 watch detail and from markers_updated. A new MarkerTimeline resolves the ranges, ordered and validated, and falls back to the singular fields when a server sends no segments. It follows the web player's resolveMarkerRegions and markerOccurrenceAtTime. Phone, tablet and TV read it for:

  • Skip Recap and Skip Credits: shown in every range, each skipping to the end of its own range. The content between two ranges plays.
  • Skip Intro: the prompt follows the intro that last started. IntroAutoSkipController keys each intro by its own range, so never/ask/always, the countdown and the Always undo work per intro.
  • Up Next: appears at the start of the last credits range, extended back over credits ranges that run into it. Before, it appeared at the first range and could advance before the mid-credits scene. Episodes with one credits range behave as before.

Downloaded playback gets the same ranges when watch detail is reachable. Downloads carry no markers of their own, as before. Preview skip and the scrubber's marker bands are unchanged. The bands still draw only the first range of each kind.

Validation

  • Unit tests: new tests for occurrence resolution (active range, the gap between two credits ranges, fallback to the singular fields, unsorted and invalid input, Up Next start), marker_segments parsing in watch detail and markers_updated, the skip target, and a second intro in the intro controller.
  • testDebugUnitTest across all modules: 6,562 tests, 1 failure. ReflowStyleTest > line height flows from settings fails the same way on unmodified main on the same build host, and this change does not touch the reader.
  • lintDebug for android-shared, androidApp and androidTvApp passes, and both debug APKs build.
  • Runtime on emulators against a local server (Game of Thrones S02E03; credits 2975.5–3167.4 s and 3189–3300 s; recap 20–107 s; intro 108–220 s):
    • Phone, tablet and Pixel Fold (open and folded), Android 16: Skip Credits shows in both ranges. In the first range it lands at 52:47.4, where no control shows during the gap. In the second it ends the episode. On main the second range has no control.
    • Android TV, Android 14, D-pad only: the same results. OK skips while the controls are hidden. Skip Recap and the focused Skip Intro offer show.
    • Phone: Skip Recap and Skip Intro (ask) skip to the end of their ranges.
  • Not exercised at runtime: Always mode, a second intro, Up Next with a next episode (the test library has none after S02E03), downloaded playback, and a markers_updated event. Unit tests cover the logic for each.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-android/pr-694/

Surface and build: before = main at 3627b86 (same code as v1.0.0-beta.27); after = this branch. Phone, tablet and Pixel Fold (open and folded) on Android 16; Android TV 1080p on Android 14.

Risks

Players now prefer marker_segments over the singular fields whenever the server sends them, including an empty list, which means no markers. Older servers that omit the field keep the previous behaviour. On episodes with several credits ranges, Up Next now waits for the last range instead of the first.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code
  • Tool(s): Claude Code, Codex CLI, adb, Android Emulator
  • Model(s): claude-opus-5-5, gpt-6.1-sol
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: independent reviews of the full diff by claude-opus-5-5 and gpt-6.1-sol (correctness, standards and spec), reconciled. Opus found one real bug, fixed here: entering a second intro could pair the new range with the previous intro's key, which cleared the Always undo right after an auto-skip. The controller now keys each intro by its range. A follow-up review found that scrubbing back before an intro cleared its Always undo; occurrenceAt now returns the first intro before any has started. Both fixes were re-reviewed with no findings. Not changed here: Skip Credits stays hidden while Up Next is showing, as with a single range; intro skip does not run during downloaded playback, which is unchanged from main; and the scrubber bands show only the first range. These are follow-ups, not regressions. Two duplication and data-clump notes were judgement calls and were left as is.

Note

Support skip for every marker occurrence via MarkerTimeline

  • Adds a new MarkerTimeline model in MarkerTimeline.kt that holds every marker occurrence. It resolves from a new markerSegments list when non-null, and falls back to the legacy singular marker fields when null.
  • markerSkipTarget now checks the active recap occurrence first, then the active credits occurrence, so each occurrence offers its own end as the skip target. Mobile and TV player overlays use the timeline for manual skips.
  • Intro auto-skip now observes the intro occurrence at the current position, and the Up Next credits threshold comes from the timeline's last credits occurrence. IntroAutoSkipController keys controller state per intro range under a session-and-file playback key, so a later intro gets its own offer and undo.
  • FileVersion and PlaybackMarkersUpdate decode a new marker_segments wire field; malformed entries are dropped and an absent field stays null.
  • Behavioral Change: an explicitly empty markerSegments list means no markers, even if singular marker fields are set. An intro range that ended still anchors the prompt until a later intro starts; check MarkerTimeline.occurrenceAt and upNextCreditsStart for these semantics.

Macroscope summarized b00b192.

The phone, tablet and TV players read only the singular intro, recap and
credits fields, which the server fills with the first occurrence of each
kind. An episode with two credits ranges showed Skip Credits only in the
first one.

Read marker_segments from v2 watch detail and markers_updated, resolve
them into a MarkerTimeline (falling back to the singular fields when a
server sends none), and drive the recap/credits skip pill, the intro
prompt and the credits-based Up Next from it. Each skip ends at its own
range, so a scene between two credits ranges still plays, and Up Next
waits for the last credits range. The intro prompt keys each intro by
its own range.

Closes Silo-Server#693
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Oct 26, 2026
@silo-kody

silo-kody Bot commented Oct 26, 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 commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Walkthrough

The change adds marker occurrence data to playback models and state, resolves occurrences into a timeline, and updates Android phone, tablet, and TV players to use individual marker ranges for skip controls, intro auto-skip, and Up Next timing.

Changes: Marker occurrences in playback

Layer / File(s) Summary
Marker segment contract and timeline
shared/src/commonMain/.../CatalogModels.kt, shared/src/commonMain/.../PlaybackMarkersUpdate.kt, shared/src/commonMain/.../MarkerTimeline.kt, shared/src/commonTest/...
File versions and playback marker updates now represent marker occurrences. MarkerTimeline resolves and filters ranges, selects active occurrences, and calculates the Up Next credits start. Tests cover decoding, fallback behavior, invalid ranges, and occurrence selection.
Carry marker segments through playback
android-shared/src/androidMain/.../VideoPlaybackStartResult.kt, android-shared/src/androidMain/.../VideoPlaybackSessionCoordinator.kt, android-shared/src/androidMain/.../VideoPlayerUiState.kt, androidApp/src/androidMain/.../MobileVideoPlaybackStarter.kt, androidApp/src/androidMain/.../PlayerViewModel.kt, androidTvApp/src/androidMain/.../TvVideoPlaybackStarter.kt, androidTvApp/src/androidMain/.../TvPlayerViewModel.kt
Playback starters and ready states now carry marker segments. Player state receives them from playback start, marker reconciliation, realtime updates, replans, and offline playback.
Use occurrences in player behavior
android-shared/src/androidMain/.../MarkerSkipTarget.kt, android-shared/src/androidUnitTest/.../MarkerSkipTargetTest.kt, androidApp/src/androidMain/.../PlayerOverlay.kt, androidApp/src/androidMain/.../PlayerViewModel.kt, androidTvApp/src/androidMain/.../TvPlayerScreen.kt, androidTvApp/src/androidMain/.../TvPlayerViewModel.kt, shared/src/commonMain/.../IntroAutoSkipController.kt, shared/src/commonTest/.../IntroAutoSkipControllerTest.kt, androidTvApp/src/androidUnitTest/.../TvWatchPartyPlayerTest.kt
Players use the resolved timeline for marker skip targets, intro occurrences, and credits-based Up Next detection. Tests cover separate credits ranges and later intro ranges.

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant FileVersion
  participant MobileVideoPlaybackStarter
  participant VideoPlaybackStartResult
  participant VideoPlaybackSessionCoordinator
  participant PlayerViewModel
  participant PlayerOverlay
  FileVersion->>MobileVideoPlaybackStarter: selected version markerSegments
  MobileVideoPlaybackStarter->>VideoPlaybackStartResult: create Ready with markerSegments
  VideoPlaybackStartResult->>VideoPlaybackSessionCoordinator: Ready result
  VideoPlaybackSessionCoordinator->>PlayerViewModel: Ready state with markerSegments
  PlayerViewModel->>PlayerOverlay: markerTimeline-derived skip target
Loading

Possibly related issues

  • Silo-Server/silo-android#321: This validation task checks skip-control timing for marker fixtures. The PR changes Android phone and tablet marker range handling, but does not complete the validation.
  • Silo-Server/silo-android#322: This validation task checks skip-control timing on Android TV. The PR changes TV marker range handling, but does not complete the validation.

Suggested labels: api-v2, impact: playback, evidence-required

Suggested reviewers: quick104

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: enabling skip controls for every marker occurrence.
Description check Passed The description directly explains the marker occurrence problem, implementation, behavior changes, validation, and risks covered by the changeset.
Linked Issues check Passed Issue #693 requires Skip Credits in every separate credits range on phone, tablet, and TV. The PR decodes marker_segments, resolves valid occurrences with MarkerTimeline, and uses the active credi…
Out of Scope Changes check Passed The changes stay within the marker-occurrence scope. Shared parsing, timeline resolution, player wiring, intro and recap occurrence handling, Up Next timing, download propagation, and related tests su…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Linked Issues check

Explanation

Issue #693 requires Skip Credits in every separate credits range on phone, tablet, and TV. The PR decodes marker_segments, resolves valid occurrences with MarkerTimeline, and uses the active credits range for the skip target. Tests cover separate credits ranges and the playable gap. The reported emulator checks cover phone, tablet, and TV behavior.

Full details: Out of Scope Changes check

Explanation

The changes stay within the marker-occurrence scope. Shared parsing, timeline resolution, player wiring, intro and recap occurrence handling, Up Next timing, download propagation, and related tests support consistent use of marker_segments. No unrelated product area is evident.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@silo-triage silo-triage Bot added bug Something isn't working priority: P2 Limited scope, workaround exists, or polish labels Oct 26, 2026
@macroscopeapp

This comment has been minimized.

Comment on lines +48 to +53
if (latest == null || range.end > latest.end) latest = range
if (position < range.end) active = range
}
// Equal-end occurrences keep one identity before and after a skip.
active?.let { playing -> return occurrences.first { it.end == playing.end } }
return latest ?: occurrences.firstOrNull()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Bug medium

Occurrence identity changes across an automatic skip for overlapping intros [30, 100) and [50, 80): occurrenceAt returns the second range at position 60 but the first at the resulting seek position 80. Both player observers pass this change to IntroAutoSkipController.handle, which clears the second intro's undo and immediately seeks again to 100 in ALWAYS mode instead of preserving undo for the occurrence just skipped.

Prompt for LLM

File shared/src/commonMain/kotlin/org/siloserver/silo/domain/player/MarkerTimeline.kt:

Line 48 to 53:

Occurrence identity changes across an automatic skip for overlapping intros [30, 100) and [50, 80): occurrenceAt returns the second range at position 60 but the first at the resulting seek position 80. Both player observers pass this change to IntroAutoSkipController.handle, which clears the second intro's undo and immediately seeks again to 100 in ALWAYS mode instead of preserving undo for the occurrence just skipped.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Checked against the code. Not changing this. Nested intros of the same kind would have to come from one provider for one file. TheIntroDB and local detection don't produce them, and the server keeps a single provider's ranges per kind. Even if they did occur, the sequence described ends in a sensible state: ALWAYS skips [50, 80) and lands at 80, which is inside the enclosing [30, 100), so it skips that too and lands at 100. handle then pins a new Skipped state to [30, 100), so the viewer gets a Watch Intro undo that returns to 30, the start of the intro they actually skipped. Only the inner range's undo goes away, and it is covered by the outer one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed—I withdraw this suggestion. The occurrence identity changes in the hypothetical nested case, but that alone does not establish a bug: the second skip exits the enclosing intro, and the resulting outer-range undo covers the inner range as well.

Given the provider constraints you described and the retained Watch Intro undo, this does not warrant a change in this PR.

@Rhainland

Copy link
Copy Markdown
Contributor Author

This check ran before the Evidence section was filled in. The body now links https://evidence.siloserver.org/r/silo-android/pr-694/, with before/after captures on phone, tablet, Pixel Fold (folded and open) and Android TV.

@Quick104

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: b00b19229 (1af9967 plus a merge of current main).

No defects found. My review of the diff and its callers on phone and TV and a separate adversarial review (gpt-6.1-sol) of 1af9967 both came back clean.

What changed in this review

  • Merged main into the branch to clear three conflicts in PlayerViewModel.kt, TvPlayerViewModel.kt and CatalogModels.kt. Both sides had added a field or property in the same spot (startedContentId/awaitingFirstFrame and trickplayAvailable from main, the marker fields from this PR), so the merge keeps both. It changes nothing in this PR's behavior.

Validation

  • On the merged head, both apps compile and all 65 tests in the six affected test classes pass (MarkerTimelineTest, IntroAutoSkipControllerTest, WatchDetailMarkerV2Test, PlaybackMarkersUpdateTest, MarkerSkipTargetTest, TvWatchPartyPlayerTest).
  • Run against the unfixed code, IntroAutoSkipControllerTest > ask - a later intro under the same key gets its own offer fails as expected (expected Asking(3) but was Hidden). The other new tests use the new MarkerTimeline API, so they don't build without the PR and can't show the fix on their own. The PR's emulator evidence covers the two-credits-range behavior live.
  • The parsing matches what the server sends: marker_segments is {kind, start_seconds, end_seconds} both in the v2 watch-detail versions and in the markers_updated event. When the event carries a null list, the app falls back to the single-range fields.

Validated features: this unblocks C1 on #321 (Android) and #322 (Android TV). Previously validated cases with one credits range behave as before.

Apple/Android parity: Apple shipped the same change in Silo-Server/silo-apple#915.

User manual: no change needed. "Watch movies and series" describes the skip settings in general terms, and those still hold.

Left for maintainers: the follow-ups the PR body names (scrubber bands show only the first range of each kind, and there's no intro skip during downloaded playback). Neither is a regression.

Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)

  • Fit: this fixes a gap in core playback, and the phone and TV players now behave like the web player and the Apple apps. It adds no setting and no new surface.
  • Readiness: the logic is small and well covered. A regression test fails without the fix, and the live before/after captures show the main behavior.

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

@coderabbitai coderabbitai Bot added api-v2 API v2 / Huma program (epic silo-server#135) evidence-required Needs before-and-after evidence before the Evidence check passes impact: playback Can't play, stalls, or wrong media labels Oct 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Additional comments: 1
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt-3160-3160: 1

3160-3160: Minor · Functional Correctness · Quick win

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

Keep Skip Credits available when Up Next opens.

When a next episode is resolved, crossing the last credits start opens Up Next. PlayerOverlay.kt Line 581 then hides Skip Credits until the viewer selects Keep Watching. TV has the same conflict at TvPlayerViewModel.kt Line 3659 and TvPlayerScreen.kt Line 4418. (raw.githubusercontent.com)

Offer Skip Credits on Up Next, or otherwise keep it accessible during the active range.


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: 0b97f57f-cd0f-4c7c-8553-f845159bcd6e
Commits

Reviewing files that changed from the base of the PR and between 1af9967 and b00b192.

Files selected for processing: 5
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/catalog/CatalogModels.kt

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

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

Labels

api-v2 API v2 / Huma program (epic silo-server#135) bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Skip Credits is missing in an episode's second credits range

2 participants