iosswiftapple-musicitunes-search-api

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.


Solution

  • 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.