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
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
Share Improve this question edited Apr 9, 2018 at 20:34 DannyBoy asked Apr 5, 2017 at 14:42 DannyBoyDannyBoy 4441 gold badge6 silver badges23 bronze badges2 Answers
Reset to default 12The 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.: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
without CORS
songName.php
$songName = file_get_contents('http://yourip:port/currentsong?sid=#');
echo $songName;
change function
// Get current song
function NowPlaying(){
$.ajax({
url: "songName.php",
type: "GET",
success: function(result) {
$("#playing").html(result);
}
});
}