I’m trying to do a special HTML5 player using soundcloud API. This code example show how I get tracks from a playlist for each track in the playlist i append into an ul list some li with the cover image of the track.
var url = 'http://api.soundcloud.com/playlists/44196539.json?client_id=3b3ca61a7c0afac8a6cfc678a24e23cf';
$.getJSON(url, function(playlist) {
$(playlist.tracks).each(function(i) {
console.log(playlist.tracks[i].title);
$('#liste').append('<li><img value='+playlist.tracks[i].stream_url+' src='+playlist.tracks[i].artwork_url+'></li>');
});
});
After that I get them I’m doing this. In the click event the attribute src of the audio player will receive the value of the stream audio. But the problem when i click it's not responding. And my images exists when I’m showing my source code
$('img').click(function(){
var x = $(this).attr('value');
console.log(x);
$('#player').attr("src",x+"?client_id=3b3ca61a7c0afac8a6cfc678a24e23cf");
});
any ideas to help Thanks a lot.