David Schumann
David Schumann

Reputation: 14813

Find out which apple music songs are playable in your country (e.g. via track_id)

Using the apple itunes search api it is possible to get information on songs such as artist, title and apple store track_id: enter image description here

Using an MPMusicPlayerController (i tried both system and application) one should be able to play songs using:

player = MPMusicPlayerController.systemMusicPlayer()
player.setQueueWithStoreIDs(["574050602"])
player.play()

As noted here some IDs seem to not work. (e.g. "574050602" is supposed to play a certain song by Rick Astley)

I have read that you need a country specific store id.

How can I determine whether a specific song will be playable or not without actually trying to play it?

The isStreamable property does not indicate whether I can actually stream it.

Upvotes: 0

Views: 437

Answers (2)

Jordi Bruin
Jordi Bruin

Reputation: 1588

The trackIDs are not shareable between countries. Therefore you will need to let the user get their own countries' trackID code by performing an API request with the user's countrycode.

Upvotes: 0

David Schumann
David Schumann

Reputation: 14813

To only get track IDs that are playable in your country you need to specify your country on search using the country parameter (source)

I have not found out what kind of problems the author at 1 had with this parameter, but there also seems to be an undocumented parameter s which might help.

Upvotes: 1

Related Questions