androidx / androidx/media

Recommended way to resume media playback from the app with PlayerView/PlayerControlView

Open
#798 2 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Nov 8, 2023.

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

Description

Devices that reproduce the issue

Tested on Emulator with API 34 (should be the same with lower API)

Reproducible in the demo app?

Yes

Reproduction steps:
  1. Open the demo-session app and play a media item.
  2. Pause playback and put the app in background.
  3. Wait a few minutes until the player controls notification is removed.
  4. Open the app again.
Result:

The PlayerView (PlayerControlView with an audio player app) is blank - play/skip controls are disabled, and playback cannot be resumed from these controls.
Resumption is possible by adding MediaButtonReceiver and implementing Callback.onPlaybackResumption(), but from a user's perspective it's only possible with a BT headset or the resumption notification.

Question:

Is there a recommended way how this should be handled in the app? Is there a way to use playback resumption to resume playback from the app when it is in foreground? The playlist restoration logic we add in Callback.onPlaybackResumption() seems to be the same logic one would use to restore the playlist on their own when the app is restarted, or in this case even onResume()'d.

I found out that calling mediaController.play() does execute media resumption, but I can't really call play() every time the app is resumed, as that would not be expected behaviour.

This issue may be related to #27

Thanks.

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.