Why does MediaMetadataRetriever return null for some keys but not when i query MediaStore

Viewed 223

When i use the MediaMetaDataRetriever to get information about a media file it returns null for METADATA_KEY_TITLE, METADATA_KEY_ARTIST and METADATA_KEY_ALBUM.

Only METADATA_KEY_DURATION returns a value.

When i use the exact same audio file but instead of using MediaMetaDataRetriever i query the MediaStore for this information with these columns.

MediaStore.Audio.Media.TITLE
MediaStore.Audio.Media.ARTIST

Both return a value but when i looked up these MediaStore Columns in the docs it says:

Indexed value of MediaMetadataRetriever#METADATA_KEY_TITLE extracted from this media item.
Indexed value of MediaMetadataRetriever#METADATA_KEY_ARTIST or ExifInterface#TAG_ARTIST extracted from this media item.

So why is it that MediaStore does return a value when MediaMetadataRetriever does not return a value, even when it's supposed to do so because as it says in the docs, MediaStore columns return an Indexed value of MediaMetadataRetriever.

Edit

I checked the media file with mp3tag on my pc and noticed that there are no values set for the title and artist fields so that's why it returns null with MediaMetaDataRetriever.

But how is it then possible that the column MediaStore.Audio.Media.TITLE does return a value for this media file and MediaMetaDataRetriever doesn't?

As i already stated above, MediaStore.Audio.Media.TITLE returns an

Indexed value of MediaMetadataRetriever#METADATA_KEY_TITLE extracted from this media item.

0 Answers
Related