下面的代码是从CoffeeScript编译的,希望它仍然可读
(function() {
$(function() {
var PLAYLIST_ID, SOUNDCLOUD_ID, tracks, tracks_ready, tracks_total;
SOUNDCLOUD_ID = '6d5064768cc29c71e1f66691f435589a';
PLAYLIST_ID = '1768866';
SC.initialize({
client_id: SOUNDCLOUD_ID
});
tracks = [];
tracks_total = 0;
tracks_ready = function() {
return tracks[0].play();
};
return SC.get('/playlists/' + PLAYLIST_ID, function(pl) {
var track;
track = pl.tracks[0];
return SC.stream('/tracks/' + track.id, function(sound) {
tracks.push(sound);
return tracks_ready();
});
});
});
}).call(this);
代码在jquery之后执行,并且包含“//connect.soundcloud.com/sdk.js”。
它给出了Uncaught TypeError:无法使用以下跟踪设置undefined的属性'id':
window.SC.SC.Helper.merge.stream - window.SC.SC.Helper.merge.whenStreamingReady - some SM2 stuff
答案 0 :(得分:2)
哦,SC.stream中似乎有一个错误。快速解决方法是传递可选的选项对象: SC.stream('/ tracks /'+ track.id,{},功能(声音)......) 确保尽快找到解决办法。