androidx / androidx/media

Handling Start Positions for MediaItems in Playlists (Android Auto & Resuming Playback)

Open
#2,248 3 comments 2 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Mar 20, 2025.

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

Description

In Media3, we can start playback of a MediaItem at a specific position like this:

player.setMediaItems(listOf(mediaItem), /* startIndex= */ 0, /* startPositionMs= */ 30_000L)

However, in some cases—such as:

  • Starting playback from Android Auto with a predefined position (currently not possible),
  • Resuming playback of a specific item in a playlist from its last known position,

We currently observe the playing MediaItem and call seekTo() if progress exists.

Is there a built-in way to handle this more cleanly, without manually observing and seeking? Or is this the correct approach? Especially in Android Auto, the seek action is a bit noticeable, which makes me wonder if there’s a smoother way to handle this.

Would appreciate any guidance on best practices!

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.