Skip to content
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

Fix background playback stopping on Android 14 #1412

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

michd
Copy link
Contributor

@michd michd commented Jun 23, 2024

RemotePlayerService service was not being properly started as a foreground service for media playback, causing playback stoppage after every track (or sooner for some folks), on android 14.

Different vendors may be more or less aggressive with killing of non-foreground service etc, so people may have gotten different results from the same root issue.

Changes

  • Changes the manifest entry for RemotePlayerService to include the foregroundServiceType="mediaPlayback" attribute (see "Foreground service types are required")
  • Declares the foreground service behavior as part of the notification (see same req)
  • Uses startForeground instead of notificationManager.notify
  • Uses ContextCompat.startForegroundService to send intents to the service

Some of these changes can also be found in @dumpfheimer's PR Improving Chromecast Integration #1298

Issues


(For a bit of my background: my day job is working on a music streaming android app and we've previously hit similar issues)

The service was not being properly started as a foreground service for
media playback, causing playback stoppage after every track (or sooner
for some folks), on android 14.

Different vendors may be more aggressive with killing of non-foreground
service etc, so people may have gotten different results.
@jellyfin-bot jellyfin-bot added this to the v2.7.0 milestone Jun 23, 2024
Copy link
Member

@Maxr1998 Maxr1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, have a few comments nonetheless. Please also fix the lint failure (should be the missing trailing comma, I think).

@Maxr1998 Maxr1998 merged commit ba2d6be into jellyfin:master Jun 25, 2024
7 checks passed
@Maxr1998
Copy link
Member

Thank you!

@michd michd deleted the background-playback-stops branch June 25, 2024 23:18
@nielsvanvelzen nielsvanvelzen modified the milestones: v2.7.0, v2.6.2 Jul 6, 2024
@nielsvanvelzen nielsvanvelzen added the bug Something isn't working label Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants