Class

MPMediaItem

A media item represents a single piece of media (such as one song or one video podcast) in the iPod library. 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.

Overview

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. In some cases, this is more efficient. Both of these methods are defined in MPMediaEntity, the abstract superclass of MPMediaItemCollection, and described in MPMediaEntity.

You use attributes of media items to build media queries for searching the iPod library. These attributes are described in MPMediaType, General Media Item Property Keys, and Podcast Item Property Keys. In addition, the MPMediaEntityPropertyPersistentID property is described in Media Entity Property Keys. Media queries are described in MPMediaQuery.

Starting in iOS 5.0, a media item can represent a video from the iPod library, whereas previously only audio was supported. See MPMediaType.

Symbols

Obtaining Group Properties

class func persistentIDProperty(forGroupingType: MPMediaGrouping)

Obtains the persistent identifier key for a specified grouping type.

class func titleProperty(forGroupingType: MPMediaGrouping)

Obtains the title key for a specified grouping type.

Constants

MPMediaType
General Media Item Property Keys

You obtain metadata for a media item by calling the valueForProperty method with these property keys. Some properties can also be used to build media property predicates, as described in MPMediaPropertyPredicate. These properties are marked here as filterable.

Podcast Item Property Keys

You obtain metadata for a podcast media item by calling the valueForProperty method with these property keys. So-called filterable properties can also be used to build media property predicates, as described in MPMediaPropertyPredicate.

User-Defined Property Keys

You obtain user-defined metadata for a media item by calling the value(forProperty:) method with these property keys. User-defined properties cannot be used to build media property predicates.

Relationships

Inherits From