Headset Back/Previous should seek backward instead of restarting the audiobook #6

Open
opened 2026-09-18 07:12:00 +02:00 by alexander · 0 comments
Owner

Problem

Pressing the Back/Previous button on a connected Bluetooth headset while an audiobook is playing can jump playback back to the beginning of the audiobook instead of performing a relative backward seek.

For audiobook playback, the headset's previous/back action should behave as seek backward, using the seek interval configured by the user in BookWave settings.

Observed behavior

During playback at approximately 109662699ms, an accidental headset Back/Previous press caused playback to jump to approximately the beginning of the audiobook:

05:18:29 I Playback The server accepted a position trigger=Interval position=109662699ms
05:18:46 D Playback The player changed state state=buffering
05:18:47 D Playback The player changed state state=ready
05:18:59 I Playback The server accepted a position trigger=Interval position=12402ms
05:19:04 I Playback The server accepted a position trigger=ChapterChanged position=17050ms

The subsequent events show playback being moved/restored near the previous listening position:

05:19:08 I Playback The server accepted a position trigger=ChapterChanged position=108665297ms
05:19:08 I Playback The server accepted a position trigger=SeekCompleted position=108665322ms
05:19:11 I Playback The server accepted a position trigger=SeekCompleted position=109129658ms

This is a jump from roughly 30 hours into the audiobook to about 12–17 seconds.

Expected behavior

When an audiobook is loaded and a headset/system controller sends the applicable previous/back media action:

  • seek backward by the user's configured seek-back amount;
  • use the existing seek duration from BookWave settings rather than a hard-coded value;
  • clamp the resulting position to 0 when near the beginning;
  • allow the relative seek to cross chapter boundaries naturally;
  • do not restart the audiobook;
  • do not interpret the action as previous chapter/track when audiobook playback expects seek-back semantics.

The corresponding forward action should continue to use the configured forward-seek behavior where applicable.

Investigation notes

Primary ownership: Android System & Auto Agent

Inspect MediaSession/system-controller handling for Bluetooth/headset transport commands, particularly how Previous, SeekBack, and related controller callbacks are translated into BookWave playback commands.

The Android/system adapter should reuse existing playback/domain seek policy and configured seek durations rather than becoming another source of playback policy.

Also verify shared behavior across:

  • Bluetooth/headset controls;
  • lock-screen controls;
  • media notification controls;
  • Android Auto.

Only change surfaces that share the incorrect command mapping.

Acceptance criteria

  1. With an audiobook playing at a non-zero position, pressing the headset Back/Previous control seeks backward by the configured BookWave seek-back interval.
  2. Changing the seek-back interval in Settings changes the amount used by the headset action.
  3. The action does not restart the current audiobook.
  4. Seeking near the beginning clamps cleanly to 0.
  5. Seeking backward across a chapter boundary remains a relative seek rather than a chapter-selection action.
  6. Normal playback progress/session synchronization remains correct after the seek.
  7. Add regression coverage for the MediaSession/controller-command mapping where practical.
  8. Perform device-level verification with a Bluetooth headset, since unit tests alone cannot prove Android media-button behavior.
## Problem Pressing the Back/Previous button on a connected Bluetooth headset while an audiobook is playing can jump playback back to the beginning of the audiobook instead of performing a relative backward seek. For audiobook playback, the headset's previous/back action should behave as **seek backward**, using the seek interval configured by the user in BookWave settings. ## Observed behavior During playback at approximately `109662699ms`, an accidental headset Back/Previous press caused playback to jump to approximately the beginning of the audiobook: ```text 05:18:29 I Playback The server accepted a position trigger=Interval position=109662699ms 05:18:46 D Playback The player changed state state=buffering 05:18:47 D Playback The player changed state state=ready 05:18:59 I Playback The server accepted a position trigger=Interval position=12402ms 05:19:04 I Playback The server accepted a position trigger=ChapterChanged position=17050ms ``` The subsequent events show playback being moved/restored near the previous listening position: ```text 05:19:08 I Playback The server accepted a position trigger=ChapterChanged position=108665297ms 05:19:08 I Playback The server accepted a position trigger=SeekCompleted position=108665322ms 05:19:11 I Playback The server accepted a position trigger=SeekCompleted position=109129658ms ``` This is a jump from roughly 30 hours into the audiobook to about 12–17 seconds. ## Expected behavior When an audiobook is loaded and a headset/system controller sends the applicable previous/back media action: - seek backward by the user's configured seek-back amount; - use the existing seek duration from BookWave settings rather than a hard-coded value; - clamp the resulting position to 0 when near the beginning; - allow the relative seek to cross chapter boundaries naturally; - do not restart the audiobook; - do not interpret the action as previous chapter/track when audiobook playback expects seek-back semantics. The corresponding forward action should continue to use the configured forward-seek behavior where applicable. ## Investigation notes Primary ownership: **Android System & Auto Agent** Inspect MediaSession/system-controller handling for Bluetooth/headset transport commands, particularly how Previous, SeekBack, and related controller callbacks are translated into BookWave playback commands. The Android/system adapter should reuse existing playback/domain seek policy and configured seek durations rather than becoming another source of playback policy. Also verify shared behavior across: - Bluetooth/headset controls; - lock-screen controls; - media notification controls; - Android Auto. Only change surfaces that share the incorrect command mapping. ## Acceptance criteria 1. With an audiobook playing at a non-zero position, pressing the headset Back/Previous control seeks backward by the configured BookWave seek-back interval. 2. Changing the seek-back interval in Settings changes the amount used by the headset action. 3. The action does not restart the current audiobook. 4. Seeking near the beginning clamps cleanly to 0. 5. Seeking backward across a chapter boundary remains a relative seek rather than a chapter-selection action. 6. Normal playback progress/session synchronization remains correct after the seek. 7. Add regression coverage for the MediaSession/controller-command mapping where practical. 8. Perform device-level verification with a Bluetooth headset, since unit tests alone cannot prove Android media-button behavior.
Sign in to join this conversation.
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
alexander/Audiobookshelf-Manager-Claude#6
No description provided.