javascript - How to repeat a song by Soundcloud API -
i making custom music player based on soundcloud api. want have repeat button when pressed, current song repeated. soundcloud not provide repeat method far know, has position()
methods corrent position of song. not make method working. have suggestion repeating current stream song ?
my code far:
function playit(){ var sound = sc.stream("/tracks/293", function(sound){ sound.play(); }); } function repeat(){ var sound = sc.stream("/tracks/293", function(sound){ console.log(sound.position); }); }
demo: http://jsfiddle.net/danials/zcn7g/23/
any idea? in advance
var repeatsong = function() { this.play({onfinish: repeat}); }; var sound = sc.stream("/tracks/293", function(sound){ sound.play({onfinish: repeatsong}); });
Comments
Post a Comment