Add playbackRate to MediaProgress extraData for per-book playback speed #1173

This commit is contained in:
Eyad 2026-03-04 22:04:59 +00:00
parent 47ea6b5092
commit 419aa4f2cc

View file

@ -169,6 +169,7 @@ class MediaProgress extends Model {
hideFromContinueListening: !!this.hideFromContinueListening, hideFromContinueListening: !!this.hideFromContinueListening,
ebookLocation: this.ebookLocation, ebookLocation: this.ebookLocation,
ebookProgress: this.ebookProgress, ebookProgress: this.ebookProgress,
playbackRate: this.extraData?.playbackRate || null,
lastUpdate: this.updatedAt.valueOf(), lastUpdate: this.updatedAt.valueOf(),
startedAt: this.createdAt.valueOf(), startedAt: this.createdAt.valueOf(),
finishedAt: this.finishedAt?.valueOf() || null finishedAt: this.finishedAt?.valueOf() || null
@ -209,6 +210,12 @@ class MediaProgress extends Model {
this.changed('extraData', true) this.changed('extraData', true)
} }
if (progressPayload.playbackRate !== undefined) {
this.extraData.playbackRate = progressPayload.playbackRate
this.changed('extraData', true)
delete progressPayload.playbackRate
}
this.set(progressPayload) this.set(progressPayload)
// Reset hideFromContinueListening if the progress has changed // Reset hideFromContinueListening if the progress has changed