Skip to content

Fix skip last calculation at increased playback speeds#5230

Open
sztomek wants to merge 7 commits into
mainfrom
fix/remaining-time-at-increased-speed
Open

Fix skip last calculation at increased playback speeds#5230
sztomek wants to merge 7 commits into
mainfrom
fix/remaining-time-at-increased-speed

Conversation

@sztomek
Copy link
Copy Markdown
Contributor

@sztomek sztomek commented Apr 16, 2026

Description

Skip Last was not accounting for playback speed: the trigger compared media-time remaining against the configured skipLastSecs, so a user playing at 2x with Skip Last set to 2:00 only saved ~1:00 of listening time before the episode auto-skipped. This was reported via Zendesk #11111728 and confirmed by the reporter's own investigation at 2x speed.
This branch extracts two pure helpers (effectiveSkipLastMs and shouldSkipLast) on PlaybackManager's companion object and multiplies the threshold by the current playbackSpeed, so the setting now represents listening time regardless of speed. Sub-1x speeds are clamped to 1x so slow-playback users never get a shorter skip window than they configured, and the log line now includes playbackSpeed to make future support tickets easier to diagnose.
At 1.0x the behaviour is identical to before, so users who don't change speed see no change. New unit tests lock in the 1x baseline, verify the 2x trigger at the correct listening-time threshold, cover the sub-1x guard, and guard the null/zero edge cases.

Fixes PCDROID-542 https://linear.app/a8c/issue/PCDROID-542/skip-last-fires-too-early-at-higher-playback-speeds-skipping-less

Testing Instructions

  1. Install the debug build on a device 2. Subscribe to any podcast with episodes longer than ~10 minutes
  2. Open the podcast settings and set Skip Last to 2:00.
  3. Open the global playback effects and set Playback speed to 2.0x. 5. Play an episode and seek to near the end; confirm the auto-skip fires when the player's displayed remaining time reads ~2:00 (previously it fired at ~1:00). A "Skipped last 2 minutes" toast should appear.
  4. Change the playback speed to 1.0x and repeat — Skip Last should fire at ~2:00 remaining (unchanged behaviour).
  5. Change the playback speed to 0.8x and repeat — Skip Last should still fire at ~2:00 remaining, never earlier (sub-1x guard).
  6. Set Skip Last to 0 (off) and confirm the episode plays to its natural end with no auto-skip, at any playback speed.

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

@sztomek sztomek added this to the 8.11 milestone Apr 16, 2026
@sztomek sztomek requested a review from a team as a code owner April 16, 2026 18:45
@sztomek sztomek requested review from Copilot and geekygecko and removed request for a team April 16, 2026 18:45
@sztomek sztomek added [Type] Bug Not functioning as intended. [Area] Playback Episode playback issue labels Apr 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Skip Last triggering too early at higher playback speeds by making the skip threshold represent listening time rather than media time, and adds unit tests to lock in the corrected behavior.

Changes:

  • Added pure helper functions (effectiveSkipLastMs, shouldSkipLast) to compute Skip Last thresholds using playback speed (clamping sub-1x to 1x).
  • Updated the Skip Last trigger logic to use the helper and included playback speed in the diagnostic log line.
  • Added unit tests covering 1x baseline, >1x scaling, sub-1x clamping, and edge cases (null/zero config, invalid duration/position).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/PlaybackManager.kt Introduces helper-based Skip Last thresholding that scales with playback speed and updates the runtime skip check/logging.
modules/services/repositories/src/test/java/au/com/shiftyjelly/pocketcasts/repositories/playback/PlaybackManagerSkipLastTest.kt Adds unit tests verifying speed-scaled Skip Last behavior and key edge cases.

Copilot AI review requested due to automatic review settings April 23, 2026 09:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

@wpmobilebot wpmobilebot modified the milestones: 8.11, 8.12 Apr 27, 2026
@wpmobilebot
Copy link
Copy Markdown
Collaborator

Version 8.11 has now entered code-freeze, so the milestone of this PR has been updated to 8.12.

@geekygecko
Copy link
Copy Markdown
Member

@sztomek would you mind looking at the comments above?

sztomek added 2 commits May 8, 2026 10:18
…-increased-speed

# Conflicts:
#	CHANGELOG.md
- Guard effectiveSkipLastMs against NaN playback speed
- Capture playbackStateRelay once in updateCurrentPosition
- Clamp remainingMs to avoid negative time-saved stats
- Fix misleading test comment about prior behaviour
@sztomek
Copy link
Copy Markdown
Contributor Author

sztomek commented May 8, 2026

@geekygecko addressed the comments

@wpmobilebot wpmobilebot modified the milestones: 8.12, 8.13 May 11, 2026
@wpmobilebot
Copy link
Copy Markdown
Collaborator

Version 8.12 has now entered code-freeze, so the milestone of this PR has been updated to 8.13.

@sztomek
Copy link
Copy Markdown
Contributor Author

sztomek commented May 12, 2026

@geekygecko no pressure, but did you have a chance to review the code?

@geekygecko
Copy link
Copy Markdown
Member

Thanks for addressing the comments, I will take a look today.

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

Labels

[Area] Playback Episode playback issue [Type] Bug Not functioning as intended.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants