MPMediaItem is a collection of properties that represents a single item contained in the media library. It contains property to see if audio file of the iPod is DRM or downloaded. See below.
This code is in case of search.
var items = [MPMediaItem]() var query = MPMediaQuery.songs() query.addFilterPredicate(MPMediaPropertyPredicate(value: "Love", forProperty: MPMediaItemPropertyTitle, comparisonType: .contains)) for item in query.items! { if item.assetURL == nil { // file not downloaded } if item.hasProtectedAsset { // file is DRM } }
😘
- Tags
- DRM, iOS, iPod, MPMediaItem