Local play progress gets overwritten from server after the app closes #54

Closed
opened 2026-04-24 23:04:43 +02:00 by adam · 12 comments
Owner

Originally created by @tvories on GitHub (Jan 3, 2022).

My local play progress seems to be overwritten every so often with the server sync. In addition (this may be a separate issue), the currently playing book changes to the last played book on the web version. I have two books I've started playing, one on the web, one on the phone. Whenever the phone app closes (from idle?) and I re-open it, I get the web player book as the "now playing" instead of the book I was last listening to on the phone app.

My last local progress is also overwritten from whatever was last synced to the server.

Steps to reproduce

  1. Download a file locally and play local.
  2. Pause the book after making progress.
  3. Let the app timeout or force close it.
  4. Re-open the app and the last sync time from the server will overwrite progress.

Expected behaviour

  • Either the server should be synced with local data (with local having the preference) or the app knows that local sync should take preference if it's further than server sync.

Actual behaviour

  • The next time the app comes up it syncs with the server and the local progres is overridden.

Environment data

Audiobookshelf Version: v1.6.49 (docker)

  • Android App?
  • iOS App?

Android Issue

Android version: 0.9.35-beta

Device model: Pixel 3aXL

Stock or customized system: Stock

iOS Issue

iOS Version:

iPhone model:

Originally created by @tvories on GitHub (Jan 3, 2022). My local play progress seems to be overwritten every so often with the server sync. In addition (this may be a separate issue), the currently playing book changes to the last played book on the web version. I have two books I've started playing, one on the web, one on the phone. Whenever the phone app closes (from idle?) and I re-open it, I get the web player book as the "now playing" instead of the book I was last listening to on the phone app. My last local progress is also overwritten from whatever was last synced to the server. ### Steps to reproduce 1. Download a file locally and play local. 2. Pause the book after making progress. 3. Let the app timeout or force close it. 4. Re-open the app and the last sync time from the server will overwrite progress. ### Expected behaviour - Either the server should be synced with local data (with local having the preference) or the app knows that local sync should take preference if it's further than server sync. ### Actual behaviour - The next time the app comes up it syncs with the server and the local progres is overridden. ### Environment data Audiobookshelf Version: v1.6.49 (docker) - [X] Android App? - [ ] iOS App? #### Android Issue Android version: 0.9.35-beta Device model: Pixel 3aXL Stock or customized system: Stock #### iOS Issue iOS Version: iPhone model:
adam added the bug label 2026-04-24 23:04:43 +02:00
adam closed this issue 2026-04-24 23:04:44 +02:00
Author
Owner

@advplyr commented on GitHub (Jan 6, 2022):

I found a bug with local audiobook progress that I will push a fix for in the next release. Downloaded audiobooks are not syncing with the server in the current version.

Your issue though is partially by design I think.
Streams are managed per account, not per device. There is going to be an issue with opening 2 different streams using the same account. Only 1 stream will be transcoded and stored at a time. This needs to be updated but I'm not sure what is the ideal behavior.

My idea was that if you start streaming a book in the web app, then open up the mobile app, it should open the web app stream wherever you left off. And vice verse with mobile to the web app.

@advplyr commented on GitHub (Jan 6, 2022): I found a bug with local audiobook progress that I will push a fix for in the next release. Downloaded audiobooks are not syncing with the server in the current version. Your issue though is partially by design I think. Streams are managed per account, not per device. There is going to be an issue with opening 2 different streams using the same account. Only 1 stream will be transcoded and stored at a time. This needs to be updated but I'm not sure what is the ideal behavior. My idea was that if you start streaming a book in the web app, then open up the mobile app, it should open the web app stream wherever you left off. And vice verse with mobile to the web app.
Author
Owner

@tvories commented on GitHub (Jan 7, 2022):

I tested the new version of the server you released (v1.6.53) and I'm still having this issue. Local playback sync is not working properly.

I understand what you're saying about the per-user streams. To clarify, I played a book once from my web browser as a test, and no matter how many times I played another book on my phone, it always kept that book from the web UI as my "last" played. That does seem to have gone away since I finished my last book. I'm playing only a single book now, and I'm not having a problem with it picking the old book I played once on the web UI.

I am still having issues with my local file not syncing properly, though.

@tvories commented on GitHub (Jan 7, 2022): I tested the new version of the server you released (v1.6.53) and I'm still having this issue. Local playback sync is not working properly. I understand what you're saying about the per-user streams. To clarify, I played a book *once* from my web browser as a test, and no matter how many times I played another book on my phone, it always kept that book from the web UI as my "last" played. That does seem to have gone away since I finished my last book. I'm playing only a single book now, and I'm not having a problem with it picking the old book I played once on the web UI. I am still having issues with my local file not syncing properly, though.
Author
Owner

@advplyr commented on GitHub (Jan 8, 2022):

The way the local file sync is supposed to work is that if you are listening to a downloaded audiobook while connected to your server it should be syncing progress every 5 seconds.
If you have listened offline, then when you connect a request is sent to your server with all your local audiobook progress and the server updates each audiobook progress if the last update time is greater.

When listening to the local audiobook are the updates getting sent to your server at all? Just seeking around the audiobook you can watch the progress bar on the cover in the web app.
There are no logs during this process, except if you have debug logs on you will see when the database is updated every 5 seconds. "[DB] Update entity user: 1"

@advplyr commented on GitHub (Jan 8, 2022): The way the local file sync is supposed to work is that if you are listening to a downloaded audiobook while connected to your server it should be syncing progress every 5 seconds. If you have listened offline, then when you connect a request is sent to your server with all your local audiobook progress and the server updates each audiobook progress if the last update time is greater. When listening to the local audiobook are the updates getting sent to your server at all? Just seeking around the audiobook you can watch the progress bar on the cover in the web app. There are no logs during this process, except if you have debug logs on you will see when the database is updated every 5 seconds. "[DB] Update entity user: 1"
Author
Owner

@tvories commented on GitHub (Jan 18, 2022):

I'm still suffering from this every once in a while. I have enabled debug logging on my server to hopefully capture it when it happens.

@tvories commented on GitHub (Jan 18, 2022): I'm still suffering from this every once in a while. I have enabled debug logging on my server to hopefully capture it when it happens.
Author
Owner

@tvories commented on GitHub (Jan 26, 2022):

I haven't been able to re-create it on demand, but it seems to be this issues occurs when I am on my local network accessing my reverse proxy vs when I disconnect from my local wifi and hit it from the external IP. I wonder if the local session is having issues.

Is there a known list of reverse proxy configuration?

@tvories commented on GitHub (Jan 26, 2022): I haven't been able to re-create it on demand, but it seems to be this issues occurs when I am on my local network accessing my reverse proxy vs when I disconnect from my local wifi and hit it from the external IP. I wonder if the local session is having issues. Is there a known list of reverse proxy configuration?
Author
Owner

@ChiefMedicalOfficer commented on GitHub (Jan 26, 2022):

Completely anecdotal but since the push was fixed for my issue linked above I haven't had a problem with current location at all (nothing that causes any playback problems anway). Neither has my friend. We've both listened to around 8 books in that period.

I also move between local network and mobile while playing and haven't noticed this happening.

I use Nginx-Proxy-Manager for reverse proxy if that helps.

@ChiefMedicalOfficer commented on GitHub (Jan 26, 2022): Completely anecdotal but since the push was fixed for my issue linked above I haven't had a problem with current location at all (nothing that causes any playback problems anway). Neither has my friend. We've both listened to around 8 books in that period. I also move between local network and mobile while playing and haven't noticed this happening. I use Nginx-Proxy-Manager for reverse proxy if that helps.
Author
Owner

@tvories commented on GitHub (Jan 26, 2022):

I am on the latest server (1.6.60) and app (0.9.38-beta) and I've still been dealing with this. In fact, I had one book that I finished and then started a new book. Each time I would pause the app from my headset (without waking the phone) and then resume it after having woken the phone, it would re-start the book I had recently finished.

I don't know if it's an issue of the reverse proxy or of the server overwriting my local progress.

@tvories commented on GitHub (Jan 26, 2022): I am on the latest server (`1.6.60`) and app (`0.9.38-beta`) and I've still been dealing with this. In fact, I had one book that I finished and then started a new book. Each time I would pause the app from my headset (without waking the phone) and then resume it after having woken the phone, it would re-start the book I had recently finished. I don't know if it's an issue of the reverse proxy or of the server overwriting my local progress.
Author
Owner

@advplyr commented on GitHub (Jan 27, 2022):

I think I know what is happening and have an update in the works. Basically syncing local audiobook progress to the server when the phone is asleep is not yet implemented.

It has to do with webview closing when the phone is asleep and the original logic relying entirely on webview to send progress syncs. So I am moving progress syncs to be handled natively. This is done for streaming audiobooks already but not yet for local.

@advplyr commented on GitHub (Jan 27, 2022): I think I know what is happening and have an update in the works. Basically syncing local audiobook progress to the server when the phone is asleep is not yet implemented. It has to do with webview closing when the phone is asleep and the original logic relying entirely on webview to send progress syncs. So I am moving progress syncs to be handled natively. This is done for streaming audiobooks already but not yet for local.
Author
Owner

@tvories commented on GitHub (Jan 27, 2022):

That would make sense, and while I can't always duplicate the issue, that would go along with what I've observed when it happens.

@tvories commented on GitHub (Jan 27, 2022): That would make sense, and while I can't always duplicate the issue, that would go along with what I've observed when it happens.
Author
Owner

@advplyr commented on GitHub (Jan 28, 2022):

v0.9.39-beta is live on the play store. This also requires a server update to v1.6.61.

When you are playing downloaded audiobooks while logged into your server the progress will sync every 5s whether the phone is awake or not.

@advplyr commented on GitHub (Jan 28, 2022): `v0.9.39-beta` is live on the play store. This also requires a server update to `v1.6.61`. When you are playing downloaded audiobooks while logged into your server the progress will sync every 5s whether the phone is awake or not.
Author
Owner

@tvories commented on GitHub (Jan 28, 2022):

Testing it out! Thanks for the update

@tvories commented on GitHub (Jan 28, 2022): Testing it out! Thanks for the update
Author
Owner

@tvories commented on GitHub (Feb 2, 2022):

So far this is looking good. I have noticed that my latest book didn't show up under "Continue Reading" a few times, but it did keep the correct position! I'll close the issue for now and reply back if I see any further issues. Thanks for the fix!

@tvories commented on GitHub (Feb 2, 2022): So far this is looking good. I have noticed that my latest book didn't show up under "Continue Reading" a few times, but it did keep the correct position! I'll close the issue for now and reply back if I see any further issues. Thanks for the fix!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#54