Playing an Apple Music Item (Cloud Item) using AVPlayer

I am trying to build an app that plays songs from the user's library using AVPlayer. Querying the songs using media query to get MPMediaItems and then using each media item's user to create an AVPlayerItem for the song and then playing the player item in AVPlayer. However, I am running into an issue where the asset url for an apple music item is nil (This is a cloud item which is in the library because the user has an apple music subscription). Is there another way to get the URL for this cloud item or an alternate way to play the item using AVPlayer?


Thanks


Usman

Replies

No, there is no way to play a cloud item with AVPlayer. You must use MPMusicPlayerController instead.