Website: Live Radio and Song History
Permissions (from SDK Reference PDF):
Permission | Player | Ads |
---|---|---|
INTERNET | Y | Y |
ACCESS_NETWORK_STATE | Y | Y |
WAKE_LOCK | Y | N |
Important Methods:
Retrieving metadata from streams
<Activity> implements MediaPlayer.OnCuePointReceivedListener {
/**
* Used to retrieve metadata from stream
* cue_title = the name of the track
* track_artist_name = name of the artist
*/
@Override
public void onCuePointReceived(MediaPlayer player, Bundle cuePoint) {
...
}
}
Important Files from the SDK Sample:
- StationPlayerActivity.java
- TritonPlayerActivity.java
Used to get album art for tracks playing on the live stream
Steps:
- Get the
cue_title
andtrack_artist_name
from the Triton Station Player - Use
cue_title
andtrack_artist_name
to query MusicBrainz Search API for the 36 characterMBID
(info)- Search for a
recording
with the title and artist - Url encode the parameters with the following syntax
<cue_title> AND artist:"<track_artist_name>"&limit=1&fmt=json
- Retrieve the
id
from the first element in thereleases
array- If no
id
exists, a placeholder image should be displayed
- If no
- Sample query:
cue_title
: Talladegatrack_artist_name
: Eric Church- Search url: http://musicbrainz.org/ws/2/recording/?query=talladega%20AND%20artist:%22eric%20church%22&limit=1&fmt=json
- Resulting id:
886eb853-44be-46ef-a99f-4c61bf3c404a
- Search for a
- Use the
id
to construct an image url based on the the Cover Art Archive API - Load and display the image with Picasso
- If no image exists, Picasso will generate an error and a placeholder image should be displayed