-
Notifications
You must be signed in to change notification settings - Fork 718
Description
Version
Media3 1.5.0
More version details
I've also encountered the issue when using version 1.4.1.
Devices that reproduce the issue
- OnePlus 6 running Android 11
- Nothing Phone 2a running Android 14
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
I went through the route of using MetadataRetriever to get the metadata for audio files based on https://developer.android.com/media/media3/exoplayer/retrieving-metadata#wo-playback.
- Basically: MetadataRetriever → TrackGroupArray → TrackGroup → Format → Metadata → MediaMetadata.
A basic summary of what I did is (assume everything is defined):
val mediaItem = MediaItem.fromUri(uri)
val trackGroupArray = MetadataRetriever.retrieveMetadata(context, mediaItem).get()
val format = trackGroupArray[0].getFormat(0)
val metadata = format.metadata
val mediaMetadata = MediaMetadata.Builder().populateFromMetadata(metadata).build()Then I return the fields available such as artist, title, trackNumber, etc..
Expected result
Accessing the title, artist, discNumber, and trackNumber fields on the MediaMetadata object should return the respective values.
Actual result
The title & artist fields both return the expected strings while discNumber & trackNumber returns null. This only happens when following the process for .flac files.
I do know that the vorbis comments for the discNumber & trackNumber fields are present as running metadata.toString() returns:
entries=[
VC: TITLE=One Step Closer,
VC: TOTALDISCS=1,
VC: TOTALTRACKS=12,
VC: ARTIST=Linkin Park,
VC: DISCNUMBER=1,
VC: ALBUM=Hybrid Theory,
VC: GENRE=Alternative,
VC: GENRE=Metal,
VC: GENRE=Nu Metal,
VC: COMMENT=CD, Warner Records 093624893226,
VC: ALBUMARTIST=Linkin Park,
VC: DATE=2000,
VC: TRACKNUMBER=02,
Picture: mimeType=image/jpeg, description=
]
I'm currently working around this problem by using MediaMetadataRetriever for .flac files instead since it correctly returns the disc & track numbers.
Media
I'll send the file to the specified email, but I think it affects all .flac files.
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.