Use the onfinish method
SC.stream("/tracks/###",
{onfinish: function(){ alert('track finished');}},
function(sound){sound.play();
});
Here is another thread around the same issue.
Frage
I currently allow users to log in through Soundcloud and I created a list of track ID's of their music.
With this data, I created an array of all the track ID and randomized it. How can I go about playing these songs? This works for individual tracks:
SC.stream("/tracks/###", function(sound){
sound.play();
});
But how can I get a notice for when the song ends so I can begin a new track?
update:
I could record the duration of the song and setTimeout the stopping and playing of a new track but maybe there is a more Soundcloud way to do this.
Thanks
Lösung
Use the onfinish method
SC.stream("/tracks/###",
{onfinish: function(){ alert('track finished');}},
function(sound){sound.play();
});
Here is another thread around the same issue.