Search code examples
androidmedia-playermetadata

Accessing Metadata from currently playing audio. (Builtin or External App)


I am trying to develop an app/widget for which I need display the currently playing information (metadata) of an audio track.

This would be trivial if I was also writing the MediaPlayer myself, as I could simply access the MediaStore and bring up the info, however, I do not wish to compete with the plethora of existing apps on this front. I want to be able to pull this inforrmation from the builtin audio player or other app such as SongBird or PowerAMP.

I should be able to do this with PowerAMP using their [API][1], but have, but I really want a solution that works for the stock android player and others too.

I was hoping to be able to grab the information from the AudioManager, but that seems only to allow me to query the current state (Music is playing et) and I can set my intent to play music, etc... But no access to metadata from someone elses app.

So my thought is this cannot be done easily. My thoughts are that I could maybe access this info from the info bar at the top as the now playing info is printed up there. It might be an ugly hack though...

For a moment I got excited about the RemoteControlClient.MetadataEditor from 4.0, but then I figured out that it was for writing that information to a stream that can be sent to the physical remote, rather than allowing you to create a software remote. Damn!

Does anyone have any ideas?

[1]: http://forum.powerampapp.com/index.php?/topic/1034-updated-for-20-poweramp-api-lib-and-sample-applications/ Power AMP


Solution

  • I should be able to do this with PowerAMP using their [API][1], but have, but I really want a solution that works for the stock android player and others too.

    There is no documented and supported API for the AOSP Music app or the Google Play Music app, AFAIK. They certainly are not in the Android SDK.

    I am not aware of an Android ecosystem standard for media players exposing this information, let alone a roster of apps that support such a standard. You are welcome to work with the developers of such apps and encourage them to create and adopt a standard.

    My thoughts are that I could maybe access this info from the info bar at the top as the now playing info is printed up there.

    It is not possible to spy on other applications' Notifications, for obvious privacy and security reasons.