的SoundCloud:试图播放的歌曲时,无法设置的未定义的属性“身份证”(Soundcloud:

2019-09-16 21:18发布

下面的代码是从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”被包括之后执行。

它给遗漏的类型错误:无法设置的未定义的属性“身份证”与下面的跟踪:

window.SC.SC.Helper.merge.stream - window.SC.SC.Helper.merge.whenStreamingReady - some SM2 stuff

Answer 1:

哦,好像是在SC.stream的错误。 快速的解决方法是通过可选的选项对象:SC.stream(“/音轨/” + track.id,{},函数(音)....)将确保尽快得到修复在那里。



文章来源: Soundcloud: Cannot set property 'id' of undefined when trying to play the song