Skip to content

Audiobooks: find, identify and play audiobooks with chapters and progress - #176

Merged
mateof merged 2 commits into
developfrom
feat/audiobooks
Dec 5, 2026
Merged

mateof merged 2 commits into
developfrom
feat/audiobooks

Conversation

@mateof

@mateof mateof commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Audiobooks for servers with the audiobooks capability (TelegramFileManager feat/audiobooks, /api/v1/audiobooks). Version 1.14.0.

What's in it

  • API client (services/api/v1/modules/audiobooks.ts): list (paged, sortBy, progress, search, author, series), continue, authors, series, detail, progress GET/PUT/DELETE, finished POST/DELETE, bookmarks POST/PATCH/DELETE. HttpClient gains keepalive. The section only appears with the audiobooks capability (remembered for offline use).
  • Library (/audiobooks, sidebar, tab bar, card on the Channels screen): «Seguir escuchando», grid of square covers with progress bars, Todos / Autores / Series / Terminados, search, infinite scroll. Persisted react-query entries (apiCache) so it renders offline; covers go through a new cover-cache CacheFirst rule of the service worker.
  • Book page (/audiobooks/:id): cover, authors, «Narrado por», series/number, length, description, chapters (tap = play from there), bookmarks (play, edit note, delete), «Continuar»/«Reproducir», «Desde el principio», «Marcar como (no) terminado», «Descargar» (whole book through the existing download queue → cached blobs, plays offline) with its state and removal.
  • Playback: an audiobook mode of AudioPlayerService through a small PlaybackDelegate, not a second player. The queue holds the book's files; AudiobookPlayback maps the player position to the book timeline. Resumes at the newest of device/server progress and speed; chapter as title (also MediaSession); previous/next chapter from buttons, media keys and shortcuts; −15 s / +30 s across files (also seekbackward/seekforward); its own speed 0.5–3× with preservesPitch; shuffle/repeat ignored inside a book; sleep timer «Final del capítulo»; bookmark with optional note; a dedicated expanded player view (lazy chunk). File changes still use the prepared standby element (no silent await, no fake paused). Audiobook files are kept out of resume points and history, and files > 200 MB are not auto-cached while streaming.
  • Progress sync (services/audiobooks/progressSync.ts): every 15 s while playing, on pause, chapter/file change, end of book (finished: true), visibilitychange/pagehide (fetch keepalive). Each change is written to IndexedDB first (Dexie v6, audiobookProgress, dirty flag) and flushed on online/app start; queued changes older than the server's lastPlayedAt are dropped.

Tests

npm test: 189 passing (new: timeline maths, progress queue, the playback mode against the fake media element, library and book pages). npm run lint (0 errors, existing warnings only) and npm run build pass.

Not verified

  • Not tried against a real server or on an Android device (lock screen, background progress, keepalive across origins).
  • The main chunk was already over the 700 kB warning (701.8 kB on main); it is now 724 kB.

…indexes

Audio folders under audiobook folders (by name or by an 'audiobook' folder
rule) and .m4b files become books. Book providers: iTunes, Google Books,
Open Library and Audible (opt-in), with Audnexus chapters. Durations and
embedded chapters (M4B chpl and chapter tracks, ID3 CHAP) are read from
Telegram without downloading the files. Progress on the book timeline,
bookmarks, manual identification. API under /api/v1/audiobooks.
Audiobooks pages (continue listening, all books, authors, series, review),
book page with chapters, bookmarks and manual identification, settings
section (sources, language, Audible store, scan) and the audiobook folder
rule. The global player gets a book mode: resume, chapter navigation,
-15/+30 s, speed, sleep at the end of the chapter, bookmarks, chapter on
the lock screen, and progress saved on the server.
@mateof
mateof merged commit 8b1ae90 into develop Dec 5, 2026
2 checks passed
@mateof
mateof deleted the feat/audiobooks branch December 5, 2026 08:35
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