I have interesting question. It is possible to play music preview from iTunes music store in iOS app? How to do that? I need your help.
1 Answers
Yes, you can do this. I have a published app which does this.
You need to get the URL's to the music preview files. One way is via the iTunes search API's. Another is via the Apple Enterprise Partner Feed.
http://www.apple.com/itunes/affiliates/resources/documentation/itunes-enterprise-partner-feed.html
Once you have the URL, you can feed it to MPMoviePlayerController for progressive-download/playback. Or you can download the file yourself and feed it into AVAudioPlayer or your own playback infrastructure.
Please check the Apple guidelines for using preview links. I believe you must be an affiliate, and you must be advertising the sale of the associated song. I also believe (please check) that Apple also permits affiliates to place these preview links on web pages, alongside affiliate links to purchase the songs.

- 39,369
- 12
- 121
- 149
-
@TomSwift what do you mean by "and you must be advertising the sale of the associated song" ? – jonypz Nov 08 '11 at 11:42
-
1@jonypz. My understanding is that as an affiliate you can only use the apple-provided preview link if you are using it to promote the sale of the associated song. – TomSwift Nov 09 '11 at 17:02
-
Do you guys know if there's any way to find out from what part of the song is the preview? I mean form what second it starts. – Nick Dima Oct 18 '12 at 17:15
-
@NickDima - AFIK that's not possible – TomSwift Oct 18 '12 at 17:39
-
3@TomSwift, you mention sending the preview url to MPMusicPlayerController - I've searched high and low for ways to do that, rather than using an MPMediaItem. Could you provide some more detail? – Juan Fran Jimenez Oct 23 '12 at 00:49
-
1@Juan Jimenez - you're right; MPMusicPlayerController is only for playing items from the user's library. I edited my answer to reflect this. – TomSwift Oct 23 '12 at 15:20