advplyr / audiobookshelf-app

Mobile application for Audiobookshelf
https://audiobookshelf.org
GNU General Public License v3.0
1.18k stars 162 forks source link

[Bug]: Listening session isn't tracking correctly #1290

Open LordNyrox opened 3 weeks ago

LordNyrox commented 3 weeks ago

What was the Problem?

Screenshot_20240817_175603_Samsung Internet As you can see in the screenshot, listening sessions aren't being tracked correctly. I have checked past sessions, and it seems to have started about two weeks ago.

Steps to Reproduce the Issue

  1. Listen to an audiobook
  2. Let your phone go to sleep automatically
  3. Listen for 20 min or so
  4. And check if tracking is correct

What was Expected?

Listening session time tracking to be precise.

Phone Model

S21 FE

Phone OS

Android 14

Audiobookshelf App Version

Android App - 0.9.76

Installation Source

Google Play Store

Additional Notes

No response

advplyr commented 3 weeks ago

Is the book downloaded on the device? Can you confirm this happens when the screen is off and when you keep it on the listening time is correct?

LordNyrox commented 3 weeks ago

No, it's on my PC, but I believe the issue is related to the screen timeout. As you can see in the first screenshot, it only tracked about 1 minute, even though I listened for 13 minutes. I had the screen timeout set to 1 minute, so it makes sense. The same thing happened with the 2-minute timeout setting on my phone—it only tracked for 1 minute and 47 seconds. Screenshot_20240818_002914_Samsung Internet In the second screenshot, I set the screen timeout to 10 minutes and listened for 3 minutes, and it tracked the correct time. It only seems to not track or be inaccurate when the screen timeout is shorter. Screenshot_20240818_003208_Samsung Internet

LordNyrox commented 3 weeks ago

I also tried version 0.9.72-beta, and the same issue occurred. I set the screen timeout to 30 seconds this time, listened for about 3 minutes, but it only tracked 28 seconds, as seen in the screenshot. Screenshot_20240818_010517_Samsung Internet

advplyr commented 3 weeks ago

Can you check the app settings on your device to see what is set for allowing background activities? This will be different per device and per android version. For pixel 6 on Android 14 the settings to look for are in battery usage and mobile data usage.

image

image

It used to be under battery optimization settings for the app. Let me know what you find for your device

LordNyrox commented 3 weeks ago

Screenshot_20240818_162745_Settings It was set to Optimised, but I changed it to Unrestricted, and the issue persists. As you can see in the screenshot below, it still isn't tracking correctly. Screenshot_20240818_165942_Samsung Internet

LordNyrox commented 3 weeks ago

Even with the screen on, the tracking seems to be off. I've been listening for 10 minutes, but it tracked it as 17 minutes. Screenshot_20240818_173919_Samsung Internet

LordNyrox commented 3 weeks ago

I have no coding experience, so I don't know if it's even possible or if this makes sense, but in the next update, the app should subtract the Start Time from the Last Time to fix the issue. The problem seems to only be with "Time Listened," and the Last/Start Time is always tracked accurately.