2016-08-22 51 views
0

評論代碼失敗。未註釋的代碼有效。 Soundcloud對象SC獲得一個特定音軌的正確代碼是什麼?如何爲特定曲目調用soundcloud sdk

/* 
    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); 
      }); 
     }); 
    }   
}); 

回答

0

註釋掉的代碼實際上工作。我發現我有錯誤的曲目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); 


}); 
相關問題