Skip to content

Previous Chapter restarts the chapter you're in, unless you're at its start - #115

Merged
StaticHumStudio merged 4 commits into
masterfrom
fix/220i-chapter-back
Nov 5, 2026
Merged

StaticHumStudio merged 4 commits into
masterfrom
fix/220i-chapter-back

Conversation

@StaticHumStudio

Copy link
Copy Markdown
Owner

Jeff found it in the 2.2.0 test build. The player screen's Previous Chapter button always jumped to the start of the chapter before. Now:

  • More than 3 s into a chapter, Previous restarts that chapter.
  • Inside those 3 s it goes back one chapter.
  • It stays enabled in chapter 1 (it used to be greyed out there), where it restarts the chapter.

The rule lives in one place (previousChapterTarget), and the notification, media keys and Android Auto now call the same PlaybackManager.skipToPreviousChapter() as the button. Books without chapters keep the plain player Previous.

It reads the live player position, not the 500 ms poll (which freezes on pause), and keeps the retained position when the player is empty after a failed load of another book.

Checks

  • 2,033 JVM tests, 0 failures. A canary that put the old rule back failed 3 of the new tests.
  • Codex (Sol 6.1, high): two P2s, both fixed (f0d1797, 8618880), final pass clean.
  • Emulator, mock Audiobookshelf, 10 x 60 s chapter book: master reproduces the bug, branch 8618880 passes 7 of 7 (in app button, MediaSession dispatch previous, paused, paused 3.3 s into a chapter). No crashes or ANRs.

Known, not from this change: after a seek while paused, the system media session keeps the old position until playback resumes.

🤖 Generated with Claude Code

https://claude.ai/code/session_014XfNSe18pmZggK4TswCohg

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T14:16:22.577944Z 7870e27 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

StaticHumStudio and others added 4 commits November 5, 2026 08:46
… start

The player screen's Previous Chapter button always jumped to the chapter
before. It now restarts the current chapter when you are more than 3 seconds
in, and only goes back one inside that window. It also stays enabled in
chapter 1 so you can restart it.

The rule lives in one place (previousChapterTarget) and the MediaSession
(Android Auto, notification, lock screen) uses it too, so the two cannot
drift apart again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014XfNSe18pmZggK4TswCohg
Codex review: the button read the 500 ms position poll, which freezes on
pause, so right at the 3 second line it could pick the wrong chapter. It
now reads the player directly and works out the chapter from that.

The notification, media keys and Android Auto now call the same
PlaybackManager method as the button (books without chapters keep the
plain player Previous).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014XfNSe18pmZggK4TswCohg
Codex review: after a failed load of another book the player has no media
items and reads 0, which would send the shown book to chapter 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014XfNSe18pmZggK4TswCohg
After rebasing onto #114: a book parked at its end has the player at 0:00,
so Previous reads the shown end position there instead of the player.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014XfNSe18pmZggK4TswCohg
@StaticHumStudio
StaticHumStudio merged commit 66bd11e into master Nov 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant