Contents

MPMediaItem

A collection of properties that represents a single item in the media library.

Declaration

class MPMediaItem

Overview

A media item has an overall unique identifier, accessed using the MPMediaItemPropertyPersistentID property key, as well as specific identifiers for its metadata. These identifiers persists across application launches.

A media item can have a wide range of metadata associated with it. You access this metadata using the value(forProperty:) method along with the property keys described in this document. You can also access metadata in a batch fashion using the enumerateValues(forProperties:using:) method. Anytime the app accesses more than one property, enumerating over a set of property keys is more efficient than fetching each individual property. MPMediaEntity defines both of these methods, the abstract superclass of MPMediaItemCollection, and described in MPMediaEntity.

You use attributes of media items to build media queries for searching the Media library. MPMediaType, General media item property keys, and Podcast Item Property Keys describe these attributes. In addition, Media entity property keys describes the MPMediaEntityPropertyPersistentID property, and MPMediaQuery describes media queries.

Topics

Media item properties

Obtaining group properties

Media item types and keys

See Also

Media items and playlists