I am trying to create a customised radio player, that updates itself automatically about the title and artwork of the current streaming audio.
Shoutcast does have an API but it is only working with its Dev ID but Shoutcast recently does not provide any Dev ID apparently. So I need another workaround.
There are some PHP solution, but since I do not know the language I could not find out their solution. Could please provide some examples or hints about how to get the current track title, artwork, even possibly the artists name.
Thanks in advance
The following shoutcast pages give you:
Current song: http://yourstream:port/currentsong?sid=#
Last 20 songs: http://yourstream:port/played.html?sid#
Next songs: http://yourstream:port/nextsongs?sid=#
nextsongs?sid=#
must be supported by the player which feeds the stream. sc_trans supports this feature.
A small ajax jQuery example:
// Get current song
function NowPlaying(){
$.ajax({
url: "http://www.mofosounds.com:8000/currentsong?sid=#",
type: "GET",
success: function(result) {
$("#playing").html(result);
}
});
}
// Update every 5 seconds
setInterval(function(){
NowPlaying();
}, 5000);
Note: In order to do Cross domain ajax requests, CORS must be enabled. Read more about CORS in this article