Deezer APsI: example of non-streamable song for co

2019-06-06 10:26发布

I would like to test a deezer web application with a track not available for country limitation (e.g. try to stream a track available just in UK using a Deezer Italian account), to see how the system reacts and get ready to handle this kind of error. Anyone knows how can I get an example?

Do you know if differences between country and country (in term of Artists/Songs available) is huge?

Thanks

EDIT after Aurélien answer:

1) Using Aurélien's exampel I've tried to play three songs from Italy using the invisible player example (http://developers.deezer.com/sdk/javascript/example-invisible), first and third songs available in Italy, second not available.

<input type="button" onclick="DZ.player.playTracks([60978718,18232696,60978718], 0, function(response){alert(JSON.stringify(response));}  ); return false;" value="Play tracks"/>

what happens is that the client doesn't switch to 30 secs for the second song but just skip it (which actually seems to me a better behaviour); I've also noticed that from the client (I have an alert on response) I can't get any information about "readability" so if I look at the response for the second song there's nothing which tells to me that is not readable in Italy, am I right? Of course you can get that information using an API server call as you showed.

2) About tokens, the problem is with freemium users (free users in the first six months), who still can't pass through their tokens; this make a simple API call like getting the top5 songs for an artist (which requires token) not available for them...

3) About the "Diamonds" example, can you explain me better? It means that, if I request the top5 songs for Rihanna using an Italian token and I get Diamonds, with its id, that id not only could be not streamable in e.g. Germany but it could also happen that the song is actually streamable in Germany but only if I use another (German) id?

标签: deezer
1条回答
疯言疯语
2楼-- · 2019-06-06 10:44

[EDIT to complete/correct answer]

  • When a track isn't available in the current country of the user, the deezer api set the flag "readable" to false and the SDK Player skip automatically the track unavailable (switch automatically to 30s preview).

  • The differences isn't huge between countries.

  • If you want to use the current country of the premium user and not the location of your server, don't forget to add the &access_token=TOKEN in each request. If you want to be sure to have the perfect geolocated content for all users (Premium, Freemium and unlogged), it's better to request the api from the client side and not the server side. FYI: We are currently reviewing this behavior to optimize and standardize that.

  • A same track can have many ids with different country rights (ex : http://www.deezer.com/fr/track/60978718). If you request the top 5 from an artist with italian token and the same request with german token, sometimes happens, you have the same songs but not the same id. One reason is that depending on the country, it may happen that the same songs are not licensed by the same label.

About the behavior with the API :

http://api.deezer.com/2.0/track/18232696 : This track is available in France and isn't in Germany (sorry i don't have a UK Exemple)

Request from Germany :

{"id":18232696,"readable":false,"title":"Charmaine","link":"http:\/\/www.deezer.com\/track\/18232696","duration":280,"track_position":6,"disk_number":1,"rank":1,"preview":"http:\/\/cdn-preview-1.deezer.com\/stream\/1451d74b90d3331db9e35a4071b4795c-0.mp3","artist":{"id":379393,"name":"Suckers","link":"http:\/\/www.deezer.com\/artist\/379393","picture":"http:\/\/api.deezer.com\/2.0\/artist\/379393\/image","radio":true},"album":{"id":1713045,"title":"Candy Salad","link":"http:\/\/www.deezer.com\/music\/suckers\/candy-salad-1713045","cover":"http:\/\/api.deezer.com\/2.0\/album\/1713045\/image","release_date":"0000-00-00"},"type":"track"}

Request from France :

{"id":18232696,"readable":true,"title":"Charmaine","link":"http:\/\/www.deezer.com\/track\/18232696","duration":280,"track_position":6,"disk_number":1,"rank":1,"preview":"http:\/\/cdn-preview-1.deezer.com\/stream\/1451d74b90d3331db9e35a4071b4795c-0.mp3","artist":{"id":379393,"name":"Suckers","link":"http:\/\/www.deezer.com\/artist\/379393","picture":"http:\/\/api.deezer.com\/2.0\/artist\/379393\/image","radio":true},"album":{"id":1713045,"title":"Candy Salad","link":"http:\/\/www.deezer.com\/music\/suckers\/candy-salad-1713045","cover":"http:\/\/api.deezer.com\/2.0\/album\/1713045\/image","release_date":"0000-00-00"},"type":"track"}

About the behavior with the SDK :

An unavailable tracks is skipped automatically by the SDK Player. The unavailable tracks is considered "non-existent" in the current playlist/queue.

PS : I'm part of Deezer Team

查看更多
登录 后发表回答