如何为特定曲目调用soundcloud sdk
How to call soundcloud sdk for a specific track
注释代码失败。未注释的代码有效。 soundcloud 对象 SC 获得一首特定曲目的正确代码是什么?
/*
SC.stream( '/tracks/259637476', function( sm_object ){
var track = {
id: 259637476,
title: 'Time is your most valuable and scarcest resource',
artist: 'Ceiteach',
url: sm_object.url
};
$rootScope.$apply(function () {
$rootScope.songs.push(track);
});
}) ;
*/
SC.get("/groups/55517/tracks", {
limit: 5
}, function(tracks) {
for (var i = 0; i < tracks.length; i ++) {
SC.stream( '/tracks/' + tracks[i].id, function( sm_object ){
var track = {
id: tracks[i].id,
title: tracks[i].title,
artist: tracks[i].genre,
url: sm_object.url
};
$rootScope.$apply(function () {
$rootScope.songs.push(track);
});
});
}
});
注释掉的代码确实有效。我发现我有错误的曲目 ID :-( (-:
SC.stream('/tracks/270887767', function(sm_object) {
var track = {
id: 270887767,
title: 'Time is your most valuable and scarcest resource',
artist: 'Ceiteach',
url: sm_object.url
};
$rootScope.songs.push(track);
});
注释代码失败。未注释的代码有效。 soundcloud 对象 SC 获得一首特定曲目的正确代码是什么?
/*
SC.stream( '/tracks/259637476', function( sm_object ){
var track = {
id: 259637476,
title: 'Time is your most valuable and scarcest resource',
artist: 'Ceiteach',
url: sm_object.url
};
$rootScope.$apply(function () {
$rootScope.songs.push(track);
});
}) ;
*/
SC.get("/groups/55517/tracks", {
limit: 5
}, function(tracks) {
for (var i = 0; i < tracks.length; i ++) {
SC.stream( '/tracks/' + tracks[i].id, function( sm_object ){
var track = {
id: tracks[i].id,
title: tracks[i].title,
artist: tracks[i].genre,
url: sm_object.url
};
$rootScope.$apply(function () {
$rootScope.songs.push(track);
});
});
}
});
注释掉的代码确实有效。我发现我有错误的曲目 ID :-( (-:
SC.stream('/tracks/270887767', function(sm_object) {
var track = {
id: 270887767,
title: 'Time is your most valuable and scarcest resource',
artist: 'Ceiteach',
url: sm_object.url
};
$rootScope.songs.push(track);
});