Handling Start Positions for MediaItems in Playlists (Android Auto & Resuming Playback)
Open
@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
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.