androidx / androidx/media

Handling long-running required loading task before playback with a MediaLibraryService

Open
#1,246 9 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Apr 5, 2024.

needs triage question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

I've been attempting a full architecture of my music app's background playback service to use media3's MediaLibraryService. However, my app requires an extremely time-intensive loading task that must be completed before any playback can start, which leads to a large amount of issues with attempting to integrate the current architecture which is seemingly designed for only streaming use-cases and doesn't have any utilities to accommodate this type of process.

My ideas:

  • I would try to couple the loading logic with the new service, but this requires low-level notification control I am unsure is feasible with the API given by MediaLibraryService. MediaNotification.Provider I assume is just called whenever the MediaSession itself changes, and is otherwise basically impossible to trigger or control in any other circumstance.
  • I could try to spin off some long-running task with WorkManager, but I have no idea how feasible that even could be since it would mean attempting to start a foreground service from another foreground service. Additionally, I would still need to have a placeholder foreground notification within the MediaLibraryService, which is both ugly and still requires low-level notification control.

Would either of those work at all? Is there any part of the library that would allow me to handle this easier?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.