Android Auto - Media3 and additional metadata indicators
@marcbaechinger is already working on this.
Since Feb 11, 2025.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Hi there!
I have a short question about setting metadata so that we can show additional metadata indicators in Android Auto.
The documentation around this topic seems to be outdated and still uses legacy code.
Example:
Let's say I want to add an indicator to show the completion status for a single MediaItem.
Previously, we would have set it like:
val extras = Bundle()
extras.putInt(
MediaConstants.DESCRIPTION_EXTRAS_KEY_COMPLETION_STATUS,
MediaConstants.DESCRIPTION_EXTRAS_VALUE_COMPLETION_STATUS_PARTIALLY_PLAYED)
val description =
MediaDescriptionCompat.Builder()
.setMediaId(/*...*/)
.setTitle(resources.getString(/*...*/))
.setExtras(extras)
.build()
return MediaBrowserCompat.MediaItem(description, /* flags */)
Nowadays, we don't have a MediaDescription field on the MediaItem anymore, which leaves us wondering where and how to set the flag. I tried setting the extras on the MediaMetadata attached to the MediaItem, but without success.
val extras = bundleOf(
MediaConstants.EXTRAS_KEY_COMPLETION_STATUS to MediaConstants.EXTRAS_VALUE_COMPLETION_STATUS_PARTIALLY_PLAYED
)
val metadata = MediaMetadata.Builder()
.setIsBrowsable(false)
.setIsPlayable(true)
.setTitle(title)
.setExtras(extras)
.build()
val mediaItem = MediaItem.Builder()
.setMediaId(id)
.setMediaMetadata(metadata)
.setMimeType(MimeTypes.AUDIO_MPEG)
.setUri(audioUrl)
.build()
I am aware that we have MediaConstants that contain the necessary constants, but I haven't been able to figure out how or where to set them. So my question is: How can I achieve a simple completion status for a playable MediaItem?
Sorry in advance if I have misread the documentation, and keep up the awesome work at Media3!
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.