austinried / subtracks

A music streaming app for Subsonic-compatible servers
GNU General Public License v3.0
699 stars 29 forks source link

Music keeps playing after closing app #115

Open kpcenti opened 2 years ago

kpcenti commented 2 years ago

Describe the bug Music continues to play after closing the app.

To Reproduce Steps to reproduce the behavior:

  1. Play music
  2. Open app switcher
  3. Close app
  4. Music continues to play and player controls are still available in Notification Shade.

Expected behavior Music to stop playing when the app is closed.

Smartphone (please complete the following information):

austinried commented 2 years ago

This is intentional, you can stop playback with the stop button on the notification. Android can close the app at any time when it's in the background to save resources, so we have to keep the notification/media player controls around so that playback doesn't stop when this happens.

kpcenti commented 2 years ago

Are apps able to tell when the OS closed the app or when the user closes the app?

austinried commented 2 years ago

Maybe there's a way at the native level but not that I'm aware of, and as far as I can tell most audio player apps work this way.

kpcenti commented 2 years ago

Most of the ones I've personally used like iBroadcast, YouTube Music, Spotify, Apple Music stop playing music when you close the app. This is why I made the post since it seems to be the odd one out with it's closing app behaviour.

austinried commented 2 years ago

Hmm well I don't use any of those except for Spotify but you're right it does seem to, pretty sure it did not used to though. Every other player I have does not stop audio when swiped, and they're mostly smaller apps (tested a few other subsonic apps and it's the same).

I'm not sure what the big players are doing where they can tell the difference between app closes like that but I know for the moment at least the audio library I'm using can't, so Subtracks will have to stick to the stop button.

austinried commented 2 years ago

Actually after a little poking around I think I may have misunderstood the docs I've read on this, I'm going to re-open this for now and do some more research to see if it would work with my current library setup.

andreas1107 commented 9 months ago

Spotify works exactly like this. It does not stop playing when user closes the app on Android. You have to click stop in notifications.

kpcenti commented 9 months ago

Spotify works exactly like this. It does not stop playing when user closes the app on Android. You have to click stop in notifications.

It does not work like that. Spotify stops playing music when the app is closed by the user using the app switcher

andreas1107 commented 9 months ago

Hmm.. my Spotify on Android works like that. I just tested it. shrug

kpcenti commented 9 months ago

I have also on three different phones and they all closed when swiped away