fix(player): Keep the scrub bar through renewals #19

Merged
namillis merged 1 commit from fix/scrub-renewal-focus into main 2026-10-19 04:27:02 +00:00
Owner

What's wrong

Time-shift is what plays after you pause live TV and resume: the channel runs behind live, from what the provider has recorded. The player asks the provider for a window, the stretch it had recorded at that moment. So time-shift renews the window on its own: 30 seconds before playback reaches the window's end, and again if the stream runs dry.

The scrub bar is the progress bar under the programme title. Down focuses it, and then Left and Right seek. The player treated every renewal like a stream the user had asked for, so each renewal released the bar. The next Left opened the Channels panel and the next Right opened Options, instead of seeking. A seek still waiting to run was thrown away. Scrubbing to the end of the window triggers a renewal straight away, so it happened most there.

What changed

A flag on the archive state, ArchiveState.renewal, marks a renewal, and a renewal leaves the scrub bar alone:

  • The bar stays focused through a renewal, so Left and Right keep seeking.
  • A seek still waiting to run carries over. The renewal opens the new stream at that seek's target, so the stream opens once instead of opening and then reopening for the seek.
  • While the new stream is opening, Left and Right presses count from the start of the new window, and the seek they choose runs once that stream is open.
  • Only one renewal runs at a time. Before, the end-of-window check could request a second renewal while the first was still opening.

A new catch-up, Start over, or resuming from a pause still releases the bar, as before. Catch-up plays a programme that already aired, from the provider's archive. Start over, in the Guide, plays the current programme from its beginning. The rules live in feature/player/TimeShiftRenewal.kt, so they're unit-tested without a player.

Not a goal: scrubbing back past where a renewal started. The new window starts at the carried-over seek's target, or at the playback position when no seek is waiting, so anything earlier is outside it. That was already true before this change.

Checks

  • testDebugUnitTest: 534 pass, 8 of them new in TimeShiftRenewalTest.
  • lintDebug: 0 errors, 11 warnings (unchanged).
  • assembleDebug: OK.
  • Emulator, debug build, time-shifting Comedy TV from the pool (the IPTV server that combines several providers' streams for each channel):
    • Scrubbed to the end of a 3:00 window and left the seek waiting. The renewal opened a 1:27 window at that point, the bar stayed focused, and playback carried on. A Right press afterwards showed "OK Jump now", the seek ran, and the bar stayed focused.
    • Renewal with no seek waiting: the bar stayed focused.
    • Renewal in the middle of pressing Left: it fired with a seek to 0:00 waiting and opened a 2:03 window there. The later presses stayed at 0:00 of the new window, the seek ran when they stopped, and the bar stayed focused.
  • Not checked on the emulator: a renewal after the stream runs dry. Both kinds of renewal go through the same function, continueTimeShift.

Screenshots

I'll add these in a comment:

  1. A seek waiting at the end of the window ("OK Jump now").
  2. The renewal loading, with the bar still focused at 0:00 of the new window.
  3. Playing in the new window, with the bar focused.
  4. Renewal while pressing Left: a seek to 0:00 waiting in the new 2:03 window.
  5. That seek done, playing at 0:03 with the bar focused.
## What's wrong Time-shift is what plays after you pause live TV and resume: the channel runs behind live, from what the provider has recorded. The player asks the provider for a window, the stretch it had recorded at that moment. So time-shift renews the window on its own: 30 seconds before playback reaches the window's end, and again if the stream runs dry. The scrub bar is the progress bar under the programme title. Down focuses it, and then Left and Right seek. The player treated every renewal like a stream the user had asked for, so each renewal released the bar. The next Left opened the Channels panel and the next Right opened Options, instead of seeking. A seek still waiting to run was thrown away. Scrubbing to the end of the window triggers a renewal straight away, so it happened most there. ## What changed A flag on the archive state, `ArchiveState.renewal`, marks a renewal, and a renewal leaves the scrub bar alone: - The bar stays focused through a renewal, so Left and Right keep seeking. - A seek still waiting to run carries over. The renewal opens the new stream at that seek's target, so the stream opens once instead of opening and then reopening for the seek. - While the new stream is opening, Left and Right presses count from the start of the new window, and the seek they choose runs once that stream is open. - Only one renewal runs at a time. Before, the end-of-window check could request a second renewal while the first was still opening. A new catch-up, Start over, or resuming from a pause still releases the bar, as before. Catch-up plays a programme that already aired, from the provider's archive. Start over, in the Guide, plays the current programme from its beginning. The rules live in `feature/player/TimeShiftRenewal.kt`, so they're unit-tested without a player. Not a goal: scrubbing back past where a renewal started. The new window starts at the carried-over seek's target, or at the playback position when no seek is waiting, so anything earlier is outside it. That was already true before this change. ## Checks - `testDebugUnitTest`: 534 pass, 8 of them new in `TimeShiftRenewalTest`. - `lintDebug`: 0 errors, 11 warnings (unchanged). - `assembleDebug`: OK. - Emulator, debug build, time-shifting Comedy TV from the pool (the IPTV server that combines several providers' streams for each channel): - Scrubbed to the end of a 3:00 window and left the seek waiting. The renewal opened a 1:27 window at that point, the bar stayed focused, and playback carried on. A Right press afterwards showed "OK Jump now", the seek ran, and the bar stayed focused. - Renewal with no seek waiting: the bar stayed focused. - Renewal in the middle of pressing Left: it fired with a seek to 0:00 waiting and opened a 2:03 window there. The later presses stayed at 0:00 of the new window, the seek ran when they stopped, and the bar stayed focused. - Not checked on the emulator: a renewal after the stream runs dry. Both kinds of renewal go through the same function, `continueTimeShift`. ## Screenshots I'll add these in a comment: 1. A seek waiting at the end of the window ("OK Jump now"). 2. The renewal loading, with the bar still focused at 0:00 of the new window. 3. Playing in the new window, with the bar focused. 4. Renewal while pressing Left: a seek to 0:00 waiting in the new 2:03 window. 5. That seek done, playing at 0:03 with the bar focused.
fix(player): Keep the scrub bar through renewals
All checks were successful
CI / test (pull_request) Successful in 5m38s
b49e2e5bf1
Time-shift renews its recorded window on its own: 30 s before playback
reaches the end of what the provider had recorded, and again if the
stream runs dry. The archive-open effect treated every open as a user
request, so each renewal cancelled any seek being chosen and dropped
the bar's focus. A user scrubbing near the window end lost both
mid-press.

ArchiveState now marks a renewal, and a renewal keeps the bar's focus
and its pending seek. A renewal with a pending target opens the new
stream at that target, so the stream opens once instead of opening and
reopening for the seek. Only one renewal runs at a time. Presses made
while it opens measure from the new window's start, and their seek
waits until the new stream is open. The rules live in TimeShiftRenewal
and are unit-tested.
Author
Owner

Intent: when time-shift renews its recorded window on its own, the scrub bar keeps its focus and any seek the user is still choosing. A pending seek is carried into the renewal, so the new stream opens once, at the seek's target.

Not a goal:

  • Scrubbing back past where a renewal started. The new window begins there, which was already the case.
  • Changing when a renewal happens (30 seconds before the window ends, or when the stream runs dry) or the 60-second snap to live.
  • Changing what a new catch-up, Start over, or resume from a pause does to the bar. Those still reset it.
  • The HTTP 460 refusals, which are in #18.
**Intent:** when time-shift renews its recorded window on its own, the scrub bar keeps its focus and any seek the user is still choosing. A pending seek is carried into the renewal, so the new stream opens once, at the seek's target. **Not a goal:** - Scrubbing back past where a renewal started. The new window begins there, which was already the case. - Changing when a renewal happens (30 seconds before the window ends, or when the stream runs dry) or the 60-second snap to live. - Changing what a new catch-up, Start over, or resume from a pause does to the bar. Those still reset it. - The HTTP 460 refusals, which are in #18.
namillis deleted branch fix/scrub-renewal-focus 2026-10-19 04:27:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
namillis/LiveWireTV!19
No description provided.