androidx / androidx/media

[Feature Request] Per-MediaItem default start position in playlists

Open
#3,289 1 comment 3 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Jul 1, 2026.

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

Description

[REQUIRED] Use case description

In a catch-up TV / continuous replay app, the player transitions to the next program when the current one ends. The next program often needs to start at a non-zero position (accurate start offset without pad-in for the overlapped tv shows).

We want to use PreloadConfiguration + player.addMediaItem() to preload the next item and get instant transitions. This works when starting at position 0, but there is no way to set a per-item start position that would be respected during auto-transitions. Timeline.Window.defaultPositionUs is always 0 for queued items.

Proposed solution

Add a defaultStartPositionMs to MediaItem that sets Timeline.Window.defaultPositionUs for that item:

val nextItem = MediaItem.Builder()
    .setUri(nextShowUri)
    .setDefaultStartPositionMs(bookmarkMs)
    .build()

player.addMediaItem(nextItem) // preloads from bookmarkMs, plays from bookmarkMs

Unlike ClippingConfiguration.startPositionMs, this would be non-destructive — the user can still seek before that position.

Alternatives considered
  • ClippingConfiguration.setStartPositionMs() — Destructive: prevents seeking before the clip start.
  • seekTo() in onMediaItemTransition — Causes audible/visible stutter; wastes preloaded data from position 0.

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.