Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get the iTunes Store ID for an MPMediaItem?

Is there a way to get the iTunes Store ID for a song from an MPMediaItem?

I'm trying to pull the user's playlists, transfer those to another device, then play the songs using MPMusicPlayerController's setQueueWithStoreIDs. This would require mapping the MPMediaItems to content in the iTunes Store, which is the purpose of iTunes Match, which is included in an Apple Music subscription.

Theoretically, this should be possible for songs that were matched to iTunes content. However, I can't find a property or valueForKey on MPMediaItem or any other class in MPMediaPlayer framework that supports this. The persistentId set of properties are local DB keys and don't tie back to the iTunes content for the item. They don't seem to be the same across devices for the same user either.

like image 905
Jay Whitsitt Avatar asked Oct 19 '22 00:10

Jay Whitsitt


1 Answers

This is now possible in iOS 10.3+ using the playbackStoreID instance property on MPMediaItem.

https://developer.apple.com/documentation/mediaplayer/mpmediaitem/2813404-playbackstoreid

like image 189
Jay Whitsitt Avatar answered Oct 21 '22 03:10

Jay Whitsitt