1
votes

I'm working with the custom soundcloud player to build a website around my own tracks.

The point is that i want the website to show for every track a different background image. The player has several events, but they do not provide me the track id or track title of the currently playing track. How can i know what the player is playing?

thanks!

1
Can you give as a link to the player's code and api documentation?Bergi
i am using the sc-player-red version and i do not have yet any own code, because i first need to know if the custom player fits my needs. It seems it does: i found out the following: (document).bind('soundcloud:onPlayerReady', function(event, data) { player = soundcloud.getPlayer('scPlayerEngine'); track = player.api_getCurrentTrack(); console.log(track);codeMaarten L.
sory for my messy reply, but the main thing is: i found out how to do it. Thanks Bergi!Maarten L.
If that's the solution, please make it an answer instead of a comment. Then accept this (your own) answer to close the question.Bergi

1 Answers

0
votes

In the wiki (events section) we can find the onPlayerTrackSwitch.scPlayer event, which fires every time the scPlayer changes track. The event has a track object as an argument which you can use to identify the currently playing track.

$(document).bind('onPlayerTrackSwitch.scPlayer', function(event, track){
  console.log(event.target, 'it jumped to this track:', track);
});