Handling long-running required loading task before playback with a MediaLibraryService
@marcbaechinger is already working on this.
Since Apr 5, 2024.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.