M4: Player core — now-playing panel, session recovery, resume where you left off #15

Merged
Mett-mit-Zwiebel merged 2 commits from feat/m4-player into main 2026-10-29 00:15:56 +01:00
Mett-mit-Zwiebel commented 2026-10-29 00:11:24 +01:00 (Migrated from github.com)

Completes M4: Player core. Closes Mett-mit-Zwiebel/cushion#4.

Most of M4 shipped with the first version (player bar, Now Absorbing view, chapters, ±30 s, session flow, live progress, newest-wins conflicts). This PR fills the gaps and hardens the session handling.

What's new

  • Right panel with tabs:
    • Chapters.
    • Bookmarks: made in any app; click one to jump to it; the list refreshes when the tab opens.
    • Up next: the rest of the series for a book; for an episode, the newer episodes oldest first, or older unplayed ones when you're on the newest. Items play from the list.
  • Sync after seeking: one sync two seconds after the last seek, not one per click.
  • Session recovery: if the server has dropped the session (it restarted, or this device opened another), a 404 on sync opens a fresh session and reports there. Closing an already-dropped session is no longer an error.
  • Live item_updated: metadata or cover edits on the server refresh the player (title, author, chapters, cover) and reload the open book or podcast page.
  • Resume where you left off: on start, the last book or episode waits paused in the player bar. Play, seek and skip work on it before any server session is opened.
  • Volume is remembered across restarts.

Fix

  • Two effects depended on the player state object, which is replaced on every position update (about four times a second). The accent colour re-analysed the cover each time while playing, and the new panel would have refetched bookmarks just as often. Both now depend only on the item or cover.

Testing

  • 77 Rust tests:
    • New unit tests for the up-next ordering.
    • 4 new live tests against a real server: a dropped session returns 404 and a fresh one works; bookmarks come back sorted; up next for a book is the rest of its series; editing an item emits item_updated with the new metadata.
  • Manual run of the app on Xvfb:
    • The panel tabs worked, including a bookmark created through the API.
    • After a restart, the last book was waiting paused at Part 2 0:27. Skipping +30 s before playing moved it to 0:57, and playback started there.
    • Renaming the book on the server updated the player bar live.
    • Two quick −30 s skips reached the server three seconds later (151 s → 106 s).

Generated by Claude Code

Completes **M4: Player core**. Closes Mett-mit-Zwiebel/cushion#4. Most of M4 shipped with the first version (player bar, Now Absorbing view, chapters, ±30 s, session flow, live progress, newest-wins conflicts). This PR fills the gaps and hardens the session handling. ## What's new - **Right panel** with tabs: - **Chapters.** - **Bookmarks:** made in any app; click one to jump to it; the list refreshes when the tab opens. - **Up next:** the rest of the series for a book; for an episode, the newer episodes oldest first, or older unplayed ones when you're on the newest. Items play from the list. - **Sync after seeking:** one sync two seconds after the last seek, not one per click. - **Session recovery:** if the server has dropped the session (it restarted, or this device opened another), a 404 on sync opens a fresh session and reports there. Closing an already-dropped session is no longer an error. - **Live `item_updated`:** metadata or cover edits on the server refresh the player (title, author, chapters, cover) and reload the open book or podcast page. - **Resume where you left off:** on start, the last book or episode waits paused in the player bar. Play, seek and skip work on it before any server session is opened. - **Volume** is remembered across restarts. ## Fix - Two effects depended on the player state object, which is replaced on every position update (about four times a second). The accent colour re-analysed the cover each time while playing, and the new panel would have refetched bookmarks just as often. Both now depend only on the item or cover. ## Testing - **77 Rust tests:** - New unit tests for the up-next ordering. - 4 new live tests against a real server: a dropped session returns 404 and a fresh one works; bookmarks come back sorted; up next for a book is the rest of its series; editing an item emits `item_updated` with the new metadata. - **Manual run of the app on Xvfb:** - The panel tabs worked, including a bookmark created through the API. - After a restart, the last book was waiting paused at Part 2 0:27. Skipping +30 s before playing moved it to 0:57, and playback started there. - Renaming the book on the server updated the player bar live. - Two quick −30 s skips reached the server three seconds later (151 s → 106 s). --- _Generated by [Claude Code](https://claude.ai/code/session_019KvpR4Tt9MGgJ3yC3DVqPq)_
Sign in to join this conversation.
No description provided.