Skip to content

MediaMetadata extras do not get populated when only setExtras used in Builder #1176

Closed

Description

@akshdeep-singh

Version

Media3 1.3.0

More version details

No response

Devices that reproduce the issue

Pixel 5 API 34 Emulator

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

This works:

val extras = Bundle().apply { putString("uri", uri) }
val mediaMetadata = MediaMetadata.Builder()
    .setDisplayTitle(title)
    .setExtras(extras)
    .build()
val mediaItem = MediaItem.Builder()
    .setUri(uri)
    .setMediaMetadata(mediaMetadata)
    .build()
override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
   println(mediaItem?.mediaMetadata?.extras?.getString("uri"))
   // NOT null
}

This doesn't work (when only setExtras are used):

val extras = Bundle().apply { putString("uri", uri) }
val mediaMetadata = MediaMetadata.Builder()
    .setExtras(extras)
    .build()
val mediaItem = MediaItem.Builder()
    .setUri(uri)
    .setMediaMetadata(mediaMetadata)
    .build()
override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
   println(mediaItem?.mediaMetadata?.extras?.getString("uri"))
   // null
}

Same issue with playlistMetadata.

Expected result

MediaMetadata extras should not be null.

Actual result

MediaMetadata extras are null.

Media

I am observing this issue for all mp3 files (not tested for other types).

Bug Report

Activity

  1. tonihei commented on Mar 14, 2024

    @tonihei
    Collaborator

    Thanks for reporting! We'll provide a fix for this in the next bugfix release (1.3.1).

  2. self-assigned this
    on Mar 14, 2024
  3. locked and limited conversation to collaborators on Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions