0

I want to get song metadata from a URI without starting to play/buffer that song.

The only way I can see of doing it right now is calling playUri() and then getMetadata() but I don't want to play it immediately.

Is there any other way?

Thanks!

Edit: Is there a way to do this via the SDK with non-local files?

Aaron
  • 21
  • 4

1 Answers1

0

Use MediaMetaDataRetreiver:

MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(context, uri);
String artist 
    = retreiver.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
//etc
retriever.release(); //don't forget to call this when done
Maksim Ostrovidov
  • 10,720
  • 8
  • 42
  • 57