-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Use ProgressState for precise EPUB location tracking #7353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Updates the BookPlayer to read and write CFI (Canonical Fragment Identifier) strings via the new ProgressState field for precise EPUB location resumption. Falls back to percentage-based resume for backward compatibility. Changes: - Add getProgressState() method to BookPlayer - Store CFI on page navigation via relocated event - Read ProgressState on book load for precise resume - Add self.getProgressState() to PlaybackManager for consistency - Include ProgressState in playback progress reports
Cloudflare Pages deployment
|
|
|
@bluesam1 this is a great improvement but the server portion might need some changes - there has been an effort to avoid more attributes that only apply to specific library types. This is why it originally used the percentage value. For what it's worth, the percentage is slightly more granular than per-chapter and keeps progress per-page as long as you use the same device. I believe most of the reports in #2582 and #3791 are from changing devices or exiting and reloading without refreshing the page, which will try to load the previous state in some cases. |
Thanks for the feedback. My thinking was that in order for this to be an ebook reader worth using, an almost-exact location is necessary. I had found the page was still off when using the same device, so I'll do some testing to see if I can replicate the issue. |



Summary
To make the 'Books' feature useful, this updates the BookPlayer to read and write CFI (Canonical Fragment Identifier) strings via the new
ProgressStatefield for precise EPUB location resumption. Falls back to percentage-based resume for backward compatibility.Problem
EPUB reading position cannot be accurately synced across devices because the current implementation uses percentage-based position tracking, which breaks when text reflows on different screen sizes.
Solution
getProgressState()method toBookPlayerto expose CFI stringrelocatedeventProgressStatefrom API on book load for precise resumeself.getProgressState()toPlaybackManagerfollowing existing patternsProgressStatein playback progress reportsChanges
BookPlayer:
getProgressState()method returning current CFIprogressStateonrelocatedeventitem.UserData?.ProgressStateon load, fallback to percentage if not presentPlaybackManager:
self.getProgressState()method for consistency with other player state methodsProgressStateingetPlayerState()outputTesting
ProgressStateProgressStatein API callsRelated
Complements backend PR: jellyfin/jellyfin#15633 (Add ProgressState field for precise EPUB location tracking)
Discussion here: /issues/3791