问题描述:

Streaming a private track from a private playlist used to work fine using it's parent playlist's secret token. It now generates a 404. This started happening Dec. 7, 2016. I'm using SoundCloud's js sdk v3.1.2

To clarify, I'm using the track's stream_url returned from the playlists/ endpoint. In this case the playlist's secret_token is s-6AMBa, as well as each track's secret_token in that playlist. Code below is how I'm streaming one track from that private playlist.

SC.initialize({

client_id: [clientid],

redirect_uri: [redirect_uri]

});

SC.stream('/tracks/296005694', 's-6AMBa').then(function(data) {

data.play();

}).catch(function(error) {

alert('Error! ' + error.message);

});

The error:

https://api.soundcloud.com/tracks/296005694?secret_token=s-6AMBa&format=json&client_id=[clientid]

Failed to load resource: the server responded with a status of 404 (Not Found)

That link in the error produces a 404, but this slight adjustment (adding /stream after the track id), resolves correctly.

https://api.soundcloud.com/tracks/296005694/stream?secret_token=s-6AMBa&format=json&client_id=[clientid]`

Like I mentioned, this system has been working for years for me and only recently started generating 404s. Is anyone else having this problem? Did anything recently change in regards to playlist secret tokens?

网友答案:

As mentioned in the docs if you want to return the stream of the audio through an endpoint of a playlist then the appropriate URI for it is

[soundcloud url="https://api.soundcloud.com/playlists/282919801/stream?secret_token=s-EqJoD&client_id=[clientid]"]

and to access the endpoint of the single track then the appropriate URI for it is

[soundcloud url="https://api.soundcloud.com/tracks/276344823/stream?secret_token=s-EqJod&client_id=[clientid]"]
相关阅读:
Top