[PR #5106] Add playbackRate to MediaProgress extraData #4429

Open
opened 2026-04-25 00:19:43 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/5106
Author: @octopotato
Created: 3/5/2026
Status: 🔄 Open

Base: masterHead: feat/per-book-playback-rate-server


📝 Commits (2)

  • 957f48b Add playbackRate to MediaProgress extraData for per-book playback speed #1173
  • b524fd9 Add MediaProgress playbackRate unit tests

📊 Changes

2 files changed (+109 additions, -0 deletions)

View changed files

📝 server/models/MediaProgress.js (+7 -0)
test/server/models/MediaProgress.test.js (+102 -0)

📄 Description

Brief summary

I added playbackRate to mediaProgress.extraData so each book/episode can store its own playback speed server-side. Any client (web, mobile, third-party) can use it.

Which issue is fixed?

  • Partially fixes #1173. Just the server changes here, the web client will need to wait until the React migration is done (see #5104)

In-depth Description

I'm storing playback rate per item in mediaProgress.extraData.playbackRate. The existing PATCH /api/me/progress/:libraryItemId/:episodeId? endpoint accepts playbackRate in the payload, and GET /api/me/progress returns it in the response.

I'm already using this on the iOS side in AudioBooth for per-book narration speed. The web client implementation is in #5104, kept separate since the frontend is being rewritten to React.

How have you tested this?

  • Verified playbackRate persists in the database via PATCH /api/me/progress/:id
  • Verified it's returned in getOldMediaProgress() serialization
  • unit tests

Screenshots

# 1. Check current playbackRate (null, no per-book rate set)
$ curl -s "/api/me/progress/$ITEM" | jq .playbackRate
null

# 2. Set playbackRate to 1.5x
$ curl -X PATCH "/api/me/progress/$ITEM" -d '{"playbackRate": 1.5}'
HTTP 200

# 3. Read it back
$ curl -s "/api/me/progress/$ITEM" | jq .playbackRate
1.5

# 4. Update to 2.0x
$ curl -X PATCH "/api/me/progress/$ITEM" -d '{"playbackRate": 2.0}'
HTTP 200

# 5. Confirm update
$ curl -s "/api/me/progress/$ITEM" | jq .playbackRate
2

# 6. Verify other progress fields are unaffected
$ curl -s "/api/me/progress/$ITEM" | jq "{playbackRate, currentTime, progress, isFinished}"
{
  "playbackRate": 2,
  "currentTime": 107.001282,
  "progress": 0.015263561750603215,
  "isFinished": false
}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/5106 **Author:** [@octopotato](https://github.com/octopotato) **Created:** 3/5/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `feat/per-book-playback-rate-server` --- ### 📝 Commits (2) - [`957f48b`](https://github.com/advplyr/audiobookshelf/commit/957f48bbe744ac378771550a198f1cb71a1fbf3f) Add playbackRate to MediaProgress extraData for per-book playback speed #1173 - [`b524fd9`](https://github.com/advplyr/audiobookshelf/commit/b524fd9257556d921154b140c7b4328e0185b8ec) Add MediaProgress playbackRate unit tests ### 📊 Changes **2 files changed** (+109 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `server/models/MediaProgress.js` (+7 -0) ➕ `test/server/models/MediaProgress.test.js` (+102 -0) </details> ### 📄 Description ## Brief summary I added `playbackRate` to `mediaProgress.extraData` so each book/episode can store its own playback speed server-side. Any client (web, mobile, third-party) can use it. ## Which issue is fixed? - Partially fixes #1173. Just the server changes here, the web client will need to wait until the React migration is done (see #5104) ## In-depth Description I'm storing playback rate per item in `mediaProgress.extraData.playbackRate`. The existing `PATCH /api/me/progress/:libraryItemId/:episodeId?` endpoint accepts `playbackRate` in the payload, and `GET /api/me/progress` returns it in the response. I'm already using this on the iOS side in [AudioBooth](https://github.com/AudioBooth/AudioBooth/pull/167) for per-book narration speed. The web client implementation is in #5104, kept separate since the frontend is being rewritten to React. ## How have you tested this? - Verified `playbackRate` persists in the database via `PATCH /api/me/progress/:id` - Verified it's returned in `getOldMediaProgress()` serialization - unit tests ## Screenshots ```bash # 1. Check current playbackRate (null, no per-book rate set) $ curl -s "/api/me/progress/$ITEM" | jq .playbackRate null # 2. Set playbackRate to 1.5x $ curl -X PATCH "/api/me/progress/$ITEM" -d '{"playbackRate": 1.5}' HTTP 200 # 3. Read it back $ curl -s "/api/me/progress/$ITEM" | jq .playbackRate 1.5 # 4. Update to 2.0x $ curl -X PATCH "/api/me/progress/$ITEM" -d '{"playbackRate": 2.0}' HTTP 200 # 5. Confirm update $ curl -s "/api/me/progress/$ITEM" | jq .playbackRate 2 # 6. Verify other progress fields are unaffected $ curl -s "/api/me/progress/$ITEM" | jq "{playbackRate, currentTime, progress, isFinished}" { "playbackRate": 2, "currentTime": 107.001282, "progress": 0.015263561750603215, "isFinished": false } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:43 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4429