Android app pauses playback whenever you leave the app #851

Closed
opened 2026-04-24 23:40:29 +02:00 by adam · 11 comments
Owner

Originally created by @ryanovas on GitHub (Jan 29, 2024).

Steps to reproduce

  1. Download from play store
  2. Start playback from local file
  3. Minimize app and open another one
  4. Wait. It will stop playing until you open audiobookshelf again

Expected behaviour

  • it should keep playing

Actual behaviour

  • it does not

Environment data

Audiobookshelf Version:

  • [ x ] Android App?
  • iOS App?

Android Issue

Android version: 14

Device model: pixel 8 pro

Stock or customized system: stock

Originally created by @ryanovas on GitHub (Jan 29, 2024). ### Steps to reproduce 1. Download from play store 2. Start playback from local file 3. Minimize app and open another one 4. Wait. It will stop playing until you open audiobookshelf again ### Expected behaviour - it should keep playing ### Actual behaviour - it does not ### Environment data Audiobookshelf Version: - [ x ] Android App? - [ ] iOS App? #### Android Issue Android version: 14 Device model: pixel 8 pro Stock or customized system: stock
adam added the bug label 2026-04-24 23:40:29 +02:00
adam closed this issue 2026-04-24 23:40:29 +02:00
Author
Owner

@nichwall commented on GitHub (Jan 29, 2024):

Is this a new install, did it used to work and stopped working?
Does it ever play in the background?
Is the file downloaded to "Internal App Storage" or another folder?
Have you disabled battery optimizations in the device settings?
Is the player open when you reopen the app, or do you need to go to the book and start it again?

@nichwall commented on GitHub (Jan 29, 2024): Is this a new install, did it used to work and stopped working? Does it ever play in the background? Is the file downloaded to "Internal App Storage" or another folder? Have you disabled battery optimizations in the device settings? Is the player open when you reopen the app, or do you need to go to the book and start it again?
Author
Owner

@ryanovas commented on GitHub (Jan 29, 2024):

It is a new install as of a couple days ago. This is my first time really trying it out.

It will play in the background if I don't leave the app and just turn my phone screen off

It's downloaded to whatever the default folder is, I just clicked "save offline"

Yes battery optimization is disabled

The player remains open, and in my notifications it still shows playing. There is just no sound until I return to the app. The player will still be open and the audio will resume.

@ryanovas commented on GitHub (Jan 29, 2024): It is a new install as of a couple days ago. This is my first time really trying it out. It will play in the background if I don't leave the app and just turn my phone screen off It's downloaded to whatever the default folder is, I just clicked "save offline" Yes battery optimization is disabled The player remains open, and in my notifications it still shows playing. There is just no sound until I return to the app. The player will still be open and the audio will resume.
Author
Owner

@advplyr commented on GitHub (Jan 29, 2024):

Maybe you have another app that is interfering and taking over the audio? This is a new one

@advplyr commented on GitHub (Jan 29, 2024): Maybe you have another app that is interfering and taking over the audio? This is a new one
Author
Owner

@nichwall commented on GitHub (Jan 29, 2024):

Does it stop immediately after switching/leaving the app, or can you hear it for a little bit and then it stops making sound while the notification says it's still playing?

If the notification shows the time is progressing but you're not hearing anything, do you see any sync events in the server logs (to show the app is still reporting it's progress)? You'll need to watch the logs for 30-60 seconds

Does it work with a streamed book?

@nichwall commented on GitHub (Jan 29, 2024): Does it stop immediately after switching/leaving the app, or can you hear it for a little bit and then it stops making sound while the notification says it's still playing? If the notification shows the time is progressing but you're not hearing anything, do you see any sync events in the server logs (to show the app is still reporting it's progress)? You'll need to watch the logs for 30-60 seconds Does it work with a streamed book?
Author
Owner

@ryanovas commented on GitHub (Jan 29, 2024):

Wow you guys are so quick with new issues! That's awesome.

I don't believe any other apps are taking audio focus. In my case I was on a long bus ride and every time I went to text or check the map it would stop playing.

It will play for like 3 or 4 seconds after switching to a different app, then the audio stops. The notification does show the process continuing yes. I just got into the habit of pausing when looking at other apps.

I will check server logs and test with streaming books shortly and report back.

@ryanovas commented on GitHub (Jan 29, 2024): Wow you guys are so quick with new issues! That's awesome. I don't believe any other apps are taking audio focus. In my case I was on a long bus ride and every time I went to text or check the map it would stop playing. It will play for like 3 or 4 seconds after switching to a different app, then the audio stops. The notification does show the process continuing yes. I just got into the habit of pausing when looking at other apps. I will check server logs and test with streaming books shortly and report back.
Author
Owner

@ryanovas commented on GitHub (Jan 29, 2024):

Ok guys reporting back after putting on my QA hat as best I could, and I can no longer reproduce the bug. I tried all the exact same things I was doing on the bus, I tried local and remote files, and I tried with and without my pixel buds and now it seems fine 🤷

Sorry for the trouble, I guess it was just a fluke? I'll post back if it happens again and try to bring more details next time.

@ryanovas commented on GitHub (Jan 29, 2024): Ok guys reporting back after putting on my QA hat as best I could, and I can no longer reproduce the bug. I tried all the exact same things I was doing on the bus, I tried local and remote files, and I tried with and without my pixel buds and now it seems fine 🤷 Sorry for the trouble, I guess it was just a fluke? I'll post back if it happens again and try to bring more details next time.
Author
Owner

@nichwall commented on GitHub (Jan 29, 2024):

It could possibly be related to losing cell service along the bus route and the app still thinking it is connected (related app crashes have been reported) but since the player is still open when you open the app back up it isn't crashing.

Either way, good it's working now :)

@nichwall commented on GitHub (Jan 29, 2024): It could possibly be related to losing cell service along the bus route and the app still thinking it is connected (related app crashes have been reported) but since the player is still open when you open the app back up it isn't crashing. Either way, good it's working now :)
Author
Owner

@designBr commented on GitHub (Mar 30, 2024):

I realize I'm late to the game, but I'm experiencing this exact issue. Should i open a new issue to get heard?

Here are the details:

  • I've been running audio bookshelf for 6 months
  • my wife, on an iPhone, hasn't had any issues, she uses it frequently
  • i just started using it yesterday, on Android
  • I'm running 0.9.73-beta for the Android phone app
  • I'm running the latest container, currently on the v2.8.1 release
  • when i listen and stay in the app, with the screen on or off, the audio will continue to play, no problems
  • when i play a book and switch to another app the audio book will stop playback within a few minutes of switching apps
  • I've timed this, it's typically between 30 seconds and 3 minutes before playback stops.
  • i tried this with a few different apps. I tried switching to Chrome first (several times) and that definitely triggered it. Then to test in another app that i suspected wasn't going to be interrupting audio playback with it's own audio, while also allowing me to track the behavior, i switched to the stopwatch after restarting playback, and timed how long playback continued while doing nothing else on the phone (just sat and watched the stopwatch)
  • the weird thing is that it doesn't seem to just pause, it seems to stop altogether? When i have a book paused (or playing) i see the player in the Android notification tray that you pull down from the top of the screen. BUT, after the playback stops because I've switched to another app, the player in the tray disappears and i have to go back into the app (which is still open in the background) in order to restart playback.
  • When i go into the app to restart playback, it's back on the dashboard with no evidence that the book was playing
  • this feels important: I'm listening to downloaded books currently and away from my network (on vacation) and my server is not exposed to the outside world. When i go back to the app after playback has stopped from being in another app, i typically see a spinner at the top of the audiobookshelf app saying "attempting server connection" (which isn't going to work since my server isn't reachable) when, so I'm wondering if this has something to do with it, seems like the most relevant symptom
@designBr commented on GitHub (Mar 30, 2024): I realize I'm late to the game, but I'm experiencing this exact issue. Should i open a new issue to get heard? Here are the details: - I've been running audio bookshelf for 6 months - my wife, on an iPhone, hasn't had any issues, she uses it frequently - i just started using it yesterday, on Android - I'm running 0.9.73-beta for the Android phone app - I'm running the latest container, currently on the v2.8.1 release - when i listen and stay in the app, with the screen on or off, the audio will continue to play, no problems - when i play a book and switch to another app the audio book will stop playback within a few minutes of switching apps - I've timed this, it's typically between 30 seconds and 3 minutes before playback stops. - i tried this with a few different apps. I tried switching to Chrome first (several times) and that definitely triggered it. Then to test in another app that i suspected wasn't going to be interrupting audio playback with it's own audio, while also allowing me to track the behavior, i switched to the stopwatch after restarting playback, and timed how long playback continued while doing nothing else on the phone (just sat and watched the stopwatch) - the weird thing is that it doesn't seem to just pause, it seems to stop altogether? When i have a book paused (or playing) i see the player in the Android notification tray that you pull down from the top of the screen. BUT, after the playback stops because I've switched to another app, the player in the tray disappears and i have to go back into the app (which is still open in the background) in order to restart playback. - When i go into the app to restart playback, it's back on the dashboard with no evidence that the book was playing - this feels important: I'm listening to downloaded books currently and away from my network (on vacation) and my server is not exposed to the outside world. When i go back to the app after playback has stopped from being in another app, i typically see a spinner at the top of the audiobookshelf app saying "attempting server connection" (which isn't going to work since my server isn't reachable) when, so I'm wondering if this has something to do with it, seems like the most relevant symptom
Author
Owner

@nichwall commented on GitHub (Mar 30, 2024):

It could be the system is killing the background app.

Did you have this problem before the vacation? Have you tried listening in offline mode?

@nichwall commented on GitHub (Mar 30, 2024): It could be the system is killing the background app. Did you have this problem before the vacation? Have you tried listening in offline mode?
Author
Owner

@advplyr commented on GitHub (Mar 30, 2024):

@designBr It seems like what you are experiencing is your device is killing the audio when it is in the background. This is device dependent because it is how the phone manages background processes. What android device are you using and what android OS version?

Two things you should try:

  1. Next time you open the app, open up the side drawer and press "Disconnect" at the bottom. This will put the app in offline mode so that it doesn't attempt to connect and sync with the server anymore until you reconnect with the server.
  2. Go into android app settings and make sure that the app has unrestricted battery usage. This is a common reason background processes get killed (for ref https://dontkillmyapp.com/).
@advplyr commented on GitHub (Mar 30, 2024): @designBr It seems like what you are experiencing is your device is killing the audio when it is in the background. This is device dependent because it is how the phone manages background processes. What android device are you using and what android OS version? Two things you should try: 1. Next time you open the app, open up the side drawer and press "Disconnect" at the bottom. This will put the app in offline mode so that it doesn't attempt to connect and sync with the server anymore until you reconnect with the server. 2. Go into android app settings and make sure that the app has unrestricted battery usage. This is a common reason background processes get killed (for ref https://dontkillmyapp.com/).
Author
Owner

@designBr commented on GitHub (Mar 30, 2024):

Ok, thanks @nichwall and @advplyr .

It appears to be the server connection and choosing "disconnect", I'm in business now. That said there was still some weirdness that I'll describe below, just for full disclosure purposes.

When i left my house two days ago i was connected to the server (but hadn't listened to any books yet), but i downloaded the books to bring with. My app is configured to use the LAN ip address:port number to connect, and that has worked fine when at home.

When i got your feedback above i tired both the battery limits and the connection, it's def the connection. Anyway - when i clicked the side menu, there was no disconnect option. It wasn't until i selected another connection that i had created (that used a domain name pointing at my home public ip, for which my firewall port is not currently forwarded/open for) that i was able to see and select the disconnect option. Once i did that it seems to be playing without issue.

Wanted to describe that all in case the lack of a "disconnect" button in this situation is a bug in itself 🤷

Anyway, thanks for your help, I'm all set now! Loving this app.

@designBr commented on GitHub (Mar 30, 2024): Ok, thanks @nichwall and @advplyr . It appears to be the server connection and choosing "disconnect", I'm in business now. That said there was still some weirdness that I'll describe below, just for full disclosure purposes. When i left my house two days ago i was connected to the server (but hadn't listened to any books yet), but i downloaded the books to bring with. My app is configured to use the LAN ip address:port number to connect, and that has worked fine when at home. When i got your feedback above i tired both the battery limits and the connection, it's def the connection. Anyway - when i clicked the side menu, there was no disconnect option. It wasn't until i selected another connection that i had created (that used a domain name pointing at my home public ip, for which my firewall port is not currently forwarded/open for) that i was able to see and select the disconnect option. Once i did that it seems to be playing without issue. Wanted to describe that all in case the lack of a "disconnect" button in this situation is a bug in itself 🤷 Anyway, thanks for your help, I'm all set now! Loving this app.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#851