SC.stream返回No Properties

时间:2015-09-21 21:53:17

标签: javascript soundcloud soundmanager2

我用:

SC.stream("/tracks/293", function(sound){
  sound.play();
});

有时我收到错误Uncaught Error: AudioManager: You need to pass a valid src,因为API返回No Properties(空对象)。

是否可以检查哪些API返回并跳过此曲目。

1 个答案:

答案 0 :(得分:-1)

我猜你忘了初始化SDK。 我只收到没有SDK init的错误。

这应该有效:

// initialize client with app credentials
SC.initialize({
  client_id: 'YOUR_CLIENT_ID',
});

SC.stream("/tracks/293", function(sound){
  sound.play();
});

https://developers.soundcloud.com/docs/api/guide#authentication