Here are my findings on the intent actions fired and extras data sent
by various music players on android.
As might be expected with the fragmentation fest that is Android,
everyone does things differently and there doesnt seem to be any
clearly common approach.
That said, digging out the relevant track info and monitoring state of
the player does seem mostly possibly with these players.
FWIW, I think the
last.fm model is the cleanest in terms of state
transitions and lack of multiple actions being sent for one event.
I also like the inclusion of the additional extras such as: duration,
position, station.
The following players were tested:
- Winamp
- Amazon MP3 player
- HTC Music Player (default/OEM player on HTC phones)
-
last.fm
- Rhapsody
*- I wanted to test the OEM Music Player on Samsung Galaxy S but cant
find any good mention of the action/namespace to use. I found some
references to stuff like
com.samsung.sec.android.app.music.metachanged and countless variations
but none worked. I did find that musicPlayer.service.updateMediaInfo
and musicPlayer.service.updatePlayInfo worked on my Samsung phone but
these didnt include ANY extras in the action. Damn you Samsung!
The following scenarios were tested:
- A) starting the app and playing a track
- B) pausing a playing track
- C) resuming a playing track
- D) letting the current track play to completion and letting the next
track in playlist/station start
- E) playing a playlist thru to completion
*** WINAMP
A) WINAMP - Open & Play track
1) sends action: com.nullsoft.winamp.playstatechanged with extras:
id = 15
track = Pocket Full of Shells
artist = Rage Against The Machine
album = Evil Empire
2) immediately follows with action: com.nullsoft.winamp.metachanged
with extras (same as above):
id = 15
track = Pocket Full of Shells
artist = Rage Against The Machine
album = Evil Empire
B) WINAMP - pause playing track
1) sends action: com.nullsoft.winamp.playstatechanged with extras:
id = 15
track = Pocket Full of Shells
artist = Rage Against The Machine
album = Evil Empire
C) WINAMP - resume playing track
1) sends action: com.nullsoft.winamp.playstatechanged with extras:
id = 15
track = Pocket Full of Shells
artist = Rage Against The Machine
album = Evil Empire
D) WINAMP - play track to completion, let next track in list/station
start
1) sends action: com.nullsoft.winamp.metachanged with extras:
id = 17
track = Root Down
artist = Beastie Boys
album = The Sounds of Science (Disc 1)
E) WINAMP - playing a playlist thru to completion
1) sends action: com.nullsoft.winamp.playbackcomplete with extras:
id = 17
track = Root Down
artist = Beastie Boys
album = The Sounds of Science (Disc 1)
WINAMP - observations
- Pause & Resume are not really observable. You get playstatechange,
but you dont know to what state.
- there is never any variation of what extras are sent for the various
actions from Winamp.
*** AMAZON MP3
A) Amazon MP3 player - Open & play track
1) sends action: com.amazon.mp3.playstatechanged with extras:
track_count_int_key = 2
com.amazon.mp3.playstate = 0
shuffle_enabled_key = false
repeat_state_key = 0
com.amazon.mp3.id = 4
track_position_int_key = 0
2) immediately follows with action: com.amazon.mp3.metachanged with
extras:
com.amazon.mp3.track = Shake Your Rump
com.amazon.mp3.id = 4
com.amazon.mp3.artist = Beastie Boys
com.amazon.mp3.album = Paul's Boutique
3) immediately follows with action: com.amazon.mp3.playstatechanged
with extras:
track_count_int_key = 2
com.amazon.mp3.playstate = 3
shuffle_enabled_key = false
repeat_state_key = 0
com.amazon.mp3.id = 4
track_position_int_key = 0
*- note playstate has changed from the 1st action in this sequence.
B) Amazon MP3 player - pause current track
1) sends action: com.amazon.mp3.playstatechanged with extras:
track_count_int_key = 2
com.amazon.mp3.playstate = 1
shuffle_enabled_key = false
repeat_state_key = 0
com.amazon.mp3.id = 4
track_position_int_key = 0
C) Amazon MP3 player - resume paused track
1) sends action: com.amazon.mp3.playstatechanged with extras
track_count_int_key = 2
com.amazon.mp3.playstate = 3
shuffle_enabled_key = false
repeat_state_key = 0
com.amazon.mp3.id = 4
track_position_int_key = 0
D) Amazon MP3 player - play track to completion, let next track in
list/station start
1) sends action: com.amazon.mp3.metachanged with extras:
com.amazon.mp3.track = Johnny Ryall
com.amazon.mp3.id = 5
com.amazon.mp3.artist = Beastie Boys
com.amazon.mp3.album = Paul's Boutique
2) immediately follows with action: com.amazon.mp3.playstatechanged
with extras:
track_count_int_key = 2
com.amazon.mp3.playstate = 3
shuffle_enabled_key = false
repeat_state_key = 0
com.amazon.mp3.id = 5
track_position_int_key = 1
E) Amazon MP3 player - play thru to end of playlist
1) sends action: com.amazon.mp3.playstatechanged with extras:
track_count_int_key = 2
com.amazon.mp3.playstate = 0
shuffle_enabled_key = false
repeat_state_key = 0
com.amazon.mp3.id = 5
track_position_int_key = 1
2) immediately follows with action: com.amazon.mp3.playstatechanged
with extras:
track_count_int_key = 0
com.amazon.mp3.playstate = 0
shuffle_enabled_key = false
repeat_state_key = 0
com.amazon.mp3.id = -1
track_position_int_key = -1
3) immediately follows with action: com.amazon.mp3.metachanged with
extras:
com.amazon.mp3.track = <null>
com.amazon.mp3.id = -1
com.amazon.mp3.artist = <null>
com.amazon.mp3.album = <null>
Amazon MP3 player - Observations:
- provides discrete playstates to aid in tracking paused (1), playing
(3), stopped (0)
- uses "special" extra key names where everyone else uses "track",
"artist", "album"
*** HTC Music Player
A) HTC - Open & start track
1) sends action: com.htc.music.playstatechanged with extras:
id = 6
track = She Don't Use Jelly (Flaming Lips cover)
artist = Ben Folds Five
albumid = 6
album = Unknown
isplaying = true
B) HTC - pause
1) sends action: com.htc.music.playstatechanged with extras:
id = 6
track = She Don't Use Jelly (Flaming Lips cover)
artist = Ben Folds Five
albumid = 6
album = Unknown
isplaying = false
B) HTC - resume
1) sends action: com.htc.music.playstatechanged with extras:
id = 6
track = She Don't Use Jelly (Flaming Lips cover)
artist = Ben Folds Five
albumid = 6
album = Unknown
isplaying = true
C) HTC - play thru to next track
1) sends action: com.htc.music.metachanged with extras:
id = 9
track = Get Up, Stand Up
artist = Bob Marley
albumid = 8
album = Live!
isplaying = true
D) HTC - play to end of playlist
1) sends action: om.htc.music.playbackcomplete with extras:
id = 9
track = Get Up, Stand Up
artist = Bob Marley
albumid = 8
album = Live!
isplaying = true
2) immediately follows with action: com.htc.music.metachanged with
extras:
id = 6
track = She Don't Use Jelly (Flaming Lips cover)
artist = Ben Folds Five
albumid = 6
album = Unknown
isplaying = false
*- note that the playlist in this scenario had 2 tracks in it and
this 2nd action send seems to signal that it's looped back to the
beginning of the list, but hasnt started playing it
HTC player - Observations:
- provides isPlaying key in each action
- always a single action, except for the play to end of playlist case.
***
last.fm Player
A)
last.fm - open & play station
1) sends action: fm.last.android.metachanged with extras:
track = Killing In The Name
duration = 314000
artist = Rage Against the Machine
trackAuth = 8260c
loved = false
station = fm.last.api.Station@47cac7f0
album = Rage Against The Machine
B)
last.fm - pause current track
1) sends action: fm.last.android.playstatechanged with extras:
track = Killing In The Name
position = 203722
duration = 314000
artist = Rage Against the Machine
trackAuth = 8260c
loved = false
station = fm.last.api.Station@47e71d60
album = Rage Against The Machine
C)
last.fm - resume paused track
1) sends action: fm.last.android.metachanged with extras:
track = Killing In The Name
position = 203722
duration = 314000
artist = Rage Against the Machine
trackAuth = 8260c
loved = false
station = fm.last.api.Station@47e71d60
album = Rage Against The Machine
D)
last.fm - play thru to next track on station
1) sends action: fm.last.android.metachanged with extras:
track = Be Yourself
duration = 279000
artist = Audioslave
trackAuth = 0031c
loved = false
station = fm.last.api.Station@47d24718
album = Out of Exile
E)
last.fm - play to end of playlist
N/A - there is no notion of end with a station
last.fm player Observations:
- duration and position seem to be in ms.
- position is only sent when pausing or resuming
- metachanged is used for new track as well as resuming a paused track
- always a single action sent
*** Rhapsody
A) rhapsody - open & start station
1) sends action: com.rhapsody.playstatechanged with extras:
track = KRS-1 Radio
state = 1
artist = <null>
album = <null>
*- note that "KRS-1 Radio" is the name of the "station" being played
2) immediately follows with action: com.rhapsody.metachanged with
extras:
track = 20 G's
state = 1
artist = KRS-1
album = Official Joints
3) immediately follows with action: com.rhapsody.playstatechanged with
extras:
track = 20 G's
state = 4
artist = KRS-1
album = Official Joints
B) rhapsody - pause current track
Almost N/A there is no pause in Rhapsody, only stop which...
1) sends action: com.rhapsody.playstatechanged with extras:
track = 20 G's
state = 3
artist = KRS-1
album = Official Joints
C) rhapsody - resume
Almost N/A. there is no pause, so after hitting stop, the button
changes to play, which when pressed....
1) sends action: com.rhapsody.playstatechanged with extras:
track = Dead And Gone [Feat. Justin Timberlake]
state = 4
artist = T.I.
album = Paper Trail
*- stop then play basically picks a new song
D) rhapsody - play thru to next track
1) sends action: com.rhapsody.playstatechanged with extras:
track = KRS-1 Radio
state = 1
artist = <null>
album = <null>
2) immediately follows with action: com.rhapsody.metachanged with
extras:
track = The Gangsta, The Killa And The Dope Dealer
state = 1
artist = Westside Connection
album = The N.W.A. Legacy Vol. 1: 1988-1998
E) rhapsody - play to end of playlist
N/A - there is no notion of end with a station
Rhapsody Observations:
- the only player that sends some extras with actual NULLs in some
cases
- sends a playstatechanged action with station info and a state of 1
when there is a delay in selecting next track.
When next track is immediately available, such as stop & start we get
a metachanged alone with no playstatechanged before it.