문제

i followed the playlist example from the Spotify Apps API, but besides the example-playlist, no callbacks are fired.

working: "spotify:user:spotify:playlist:3Yrvm5lBgnhzTYTXx2l55x"
not working: "spotify:user:1123874884:playlist:7xgiawpXZUVRFI1ohNfnP2"

the first is from the example , the second is my sample playlist. I load them both like this:

var playlist = models.Playlist.fromURI("spotify:user:shihjiapei:playlist:6YZtFxUCxmCgp3KDWTQhXW");
console.log("before event registration");
playlist.observe(models.EVENT.LOAD, function() {
    console.log("Playlist loaded!");
    console.log(playlist);
});
playlist.observe(models.EVENT.LOAD_ERROR, function() {
    console.log("Playlist error: not public!");
    console.log(playlist);
});

The first one says: Playlist loaded! The second does not say anything...

I checked my playlist as public in the spotify-client. So what other secret switch do I need to flick??

Any experience, best pratice appreciated.

EDIT: WTF, it works like that..

var playlist_url = 'http://open.spotify.com/user/1123874884/playlist/7xgiawpXZUVRFI1ohNfnP2';
tempPlaylist = models.Playlist.fromURI(playlist_url, function(resultPlaylist) {
    console.log("Playlist loaded!");
    console.log(resultPlaylist);
});

But why does it work the other way with some playlists? ahhrg!

도움이 되었습니까?

해결책

I think this might be because your second example is a local playlist, which is technically already loaded (in your local Spotify client). The first example is one that you probably haven't subscribed to and so it isn't stored locally for you, therefore it needs to get downloaded.

Putting in the HTTP uri instead of the Spotify one is a similar situation where the playlist information has to be downloaded first, so the callback would be called.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top