Question

Is it possible? How easy is it?

I added a reference to TaglibSharp, an ID3 library for C# I've used for a long time in .NET applications, but it isn't detected within the activity/any classes. Taglib is built for (I think) Mono/.NET 3.5, but I'm assuming it needs to be "rebuilt" for Android? (I opened up the library's source and the only options for platform in Visual Studio and Xamarin are variations of Mono and .NET)

If working with Taglib isn't a possibility because it wouldn't end up working on the Android platform, is there another way? I've searched pretty extensively for Xamarin ID3 support and all I've found is this.

Can someone point me in the right direction?

Was it helpful?

Solution

You should be able to use the Android.Media.MediaMetadataRetriever class to read all the information you need.

Here's an example to how to get the title of a file,

MediaMetadataRetriever reader = new MediaMetadataRetriever();

reader.setDataSource("some file path");

String title = reader.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);

MediaMetadataRetriever.extractMetadata() options,

  • MetadataKeyAlbum: The metadata key to retrieve the information about the album title of the data source.

  • MetadataKeyAlbumartist: The metadata key to retrieve the information about the performers or artist associated with the data source.

  • MetadataKeyArtist: The metadata key to retrieve the information about the artist of the data source.

  • MetadataKeyAuthor: The metadata key to retrieve the information about the author of the data source.

  • MetadataKeyBitrate: This key retrieves the average bitrate (in bits/sec), if available.

  • MetadataKeyCdTrackNumber: The metadata key to retrieve the numberic string describing the order of the audio data source on its original recording.

  • MetadataKeyCompilation: The metadata key to retrieve the music album compilation status.

  • MetadataKeyComposer: The metadata key to retrieve the information about the composer of the data source.

  • MetadataKeyDate: The metadata key to retrieve the date when the data source was created or modified.

  • MetadataKeyDiscNumber: The metadata key to retrieve the numeric string that describes which part of a set the audio data source comes from.

  • MetadataKeyDuration: The metadata key to retrieve the playback duration of the data source.

  • MetadataKeyGenre: The metadata key to retrieve the content type or genre of the data source.

  • MetadataKeyHasAudio: If this key exists the media contains audio content.

  • MetadataKeyHasVideo: If this key exists the media contains video content.

  • MetadataKeyMimetype: The metadata key to retrieve the mime type of the data source.

  • MetadataKeyNumTracks: The metadata key to retrieve the number of tracks, such as audio, video, text, in the data source, such as a mp4 or 3gpp file.

  • MetadataKeyTitle: The metadata key to retrieve the data source title.

  • MetadataKeyVideoHeight: If the media contains video, this key retrieves its height.

  • MetadataKeyVideoWidth: If the media contains video, this key retrieves its width.

  • MetadataKeyWriter: The metadata key to retrieve the information of the writer (such as lyricist) of the data source.

  • MetadataKeyYear: The metadata key to retrieve the year when the data source was created or modified.

Source.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top