你們能幫我解決嗎? : 我想從我的SoundCloud軌道做個列表和播放任何曲目,當我使用JavaScript點擊它,但它不與我工作:(使用JavaScript進行stream soundcloud跟蹤不起作用
HTML文件
<script src="//connect.soundcloud.com/sdk.js"></script>
<body>
<ol id="track-list"></ol>
</body>
js文件:
function PlayIt(ID){
SC.stream("/tracks"+ID, function(sound){
soundManager.stopAll();
sound.play();
});
}
SC.initialize({
client_id: "YOUR_CLIENT_ID",
redirect_uri: "http://example.com/callback.html",
});
/**
Once that's done you are all set and ready to call the SoundCloud API.
**/
/**
Call to the SoundCloud API.
Retrieves list of tracks, and displays a list with links to the tracks showing 'tracktitle' and 'track duration'
**/
var userId = 39090345; // user_id of Prutsonic
SC.get("/tracks", {
user_id: userId,
limit: 100
}, function (tracks) {
var tmp = '';
for (var i = 0; i < tracks.length; i++) {
var TrackId=tracks[i].id;
tmp = '<a href="#" onclick="PlayIt('+TrackId +')">' + tracks[i].title + ' - ' + tracks[i].duration + '</a>';
$("<li/>").html(tmp).appendTo("#track-list");
}
});
您也可以點擊此處查看: http://jsfiddle.net/26pHX/96/
*這不是我的代碼,但我儘量做到更好