MPMediaEntity Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/MediaPlayer.framework
Availability
Available in iOS 4.2 and later.
Companion guide
Declared in
MPMediaEntity.h

Overview

The MPMediaEntity class serves as the abstract superclass for MPMediaItem and MPMediaItemCollection instances, and in turn for MPMediaPlaylist instances. As the superclass, MPMediaEntity defines methods used by those subclasses.

Tasks

Working with Media Properties

Class Methods

canFilterByProperty:

Indicates if a media property key can be used to construct a media property predicate.

+ (BOOL)canFilterByProperty:(NSString *)property
Parameters
property

The key for the media property that you want to examine.

Return Value

YES if the property you are testing can be used to construct a media property predicate (of type MPMediaPropertyPredicate); otherwise, NO.

Discussion

The media property keys you can use with this property are listed in this document and in General Media Item Property Keys, Podcast Item Property Keys, Playlist Property Keys, and User-Defined Property Keys.

Availability
  • Available in iOS 4.2 and later.
Declared In
MPMediaEntity.h

Instance Methods

enumerateValuesForProperties:usingBlock:

Executes a provided block with the fetched values for the given item properties.

- (void) enumerateValuesForProperties: (NSSet *) properties usingBlock: (void (^)(NSString *property, id value, BOOL *stop)) block;
Parameters
properties

A set of property keys that you want the values for.

block

A block object that executes for each fetched property value. If a value is not available, your block is sent nil.

Discussion

Use this method to get property values in a batch fashion. In some cases, enumerating over a set of property keys can be more efficient than fetching each individual property with valueForProperty:.

The media property keys you can use with this property are listed in this document and in General Media Item Property Keys, Podcast Item Property Keys, Playlist Property Keys, and User-Defined Property Keys.

Availability
  • Available in iOS 4.0 and later.
Declared In
MPMediaEntity.h

valueForProperty:

Gets the value for a specified media property key.

- (id) valueForProperty: (NSString *) property
Parameters
property

The media property key that you want the corresponding value of.

Return Value

The value for the media property key.

Discussion

The media property keys you can use with this property are listed in this document and in General Media Item Property Keys, Podcast Item Property Keys, Playlist Property Keys, and User-Defined Property Keys.

Availability
  • Available in iOS 4.2 and later.
Declared In
MPMediaEntity.h

Constants

Media Entity Property Keys

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

NSString *const MPMediaEntityPropertyPersistentID;     // filterable
Constants
MPMediaEntityPropertyPersistentID

The persistent identifier for a media entity. Value is an NSNumber object containing a uint64_t (unsigned long long).

Can be used to build a media property predicate as described in MPMediaPropertyPredicate Class Reference.

Available in iOS 4.2 and later.

Declared in MPMediaEntity.h.