How to get MPMediaItemCollection knowing its item url?

277 Views Asked by At

I save item URL:

var itemUrl: URL? = nil
itemUrl = (qryAlbums.collections[currAlbum].items[currItem].assetURL!)

let tempString: String = (track.last?.value(forKey: “url”) as! String?)!

track.setValue(itemUrl?.absoluteString, forKey: “url”)

now i can play this item with AVPLayer:

AudioPlayerManager.sharedInstance.play(itemUrl)

Q: Now having items url how i can get collection and item index ?

0

There are 0 best solutions below