How to get Shoutcast current track title in JS

by Digital in Tutoriais on Maio 15, 2019

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=#

A small ajax jQuery example:

So where to from here then?

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);

 

Express Your Reaction
Like
Love
Haha
Wow
Sad
Angry
You have reacted on "How to get Shoutcast current track title in JS" A few seconds ago

Categories: Tutoriais

Tags:

Latest Product

Share Your Valuable Opinions