androidx / androidx/media

How to play in the background when the phone enters low power mode

Open
#842 5 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Nov 27, 2023.

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

Description

Hello, I'm implementing a novel player. Now I have implemented a MediaLibraryService, and then implemented a DataProvider. The DataProvider provides playback metadata for the Player. Due to business requirements, only one MediaItem can be loaded into the Player at a time. After listening to the STATE_ENDED of the player, it starts to obtain the data of the next chapter through the DataProvider request interface, and then resets it to the player.
The problem now is that after starting playback, the user locks the screen and the phone enters low power mode. After the playback ends, STATE_ENDED will cause the foreground service of MediaLibraryService to be suspended. As a result, the DataProvider cannot connect to the Internet to request the loading of the next chapter's data. What should I do to solve the problem?

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.