Add the ability to find and play media items including songs, audio podcasts, and audio books from within your app.


Use the MediaPlayer framework to enable users to play music, audio podcasts, and audio books from within your app. For example, you give users the option to play their own music from within your app while they try to complete a particular game level. Through MediaPlayer, your app can access media items synced from iTunes, iCloud Music Library, and Apple Music Subscription. It can also access non-Apple media items that users have stored on their devices. After being granted access to a user's media items, you can play them and add more to the user's device. Library access is read-only.

You can incorporate one of two types of media player into your app, depending on your goal. Use a system player if you want changes made in your app to also affect the Music app. Use an application player if you want to leave the Music app as is while playing audio. After deciding on the player, use media queries to retrieve media items that will populate the player.

To enable users to play videos containing MPMediaItem objects, use AVPlayer. You cannot play video media items using the MediaPlayer framework.

Event Handling

Apps that play audio or video content receive player events to start and stop playback, change tracks, and even rate an item. All media apps should support these events.

To receive player events, do the following:

• Use the shared MPRemoteCommandCenter object to register handlers for the events you wish to handle and to disable the events you are not interested in receiving.

• Begin playing audio. Your app must be the Now Playing app. An app does not receive remote control events until it begins playing audio. Test that your app is properly receiving and handling remote control events with Control Center, which you access by swiping up from the bottom edge of your screen. These controls send remote control events to the app that is currently or was most recently playing audio. You can also access the playback controls from the lock screen of the device.


Media Library Synchronization


An object that represents the state of synced media items on a device.

Media Player Basics

The media player provides the ability to play audio media items stored on a user's device from within your app.


A protocol that defines the interface for controlling audio media playback.


An object used to play audio media items from the device's Music app library.


A set of properties and methods used to modify audio media items in the player's media queue.


The abstract base class for audio media item and store queue descriptors.


A set of properties and methods used to modify items, based on their store identifier, in the player's queue.

Media Item Queries


An abstract class that defines classes for filtering media in a media query.


A set of predicates that define a filter used in a media query.


A query that specifies a set of media items from the device's media library by way of a filter and a grouping type.


A range of media items or media item collections from within a media query.

Media Player Queues


A media player object that you use to revise the queue representing currently playing.


A mutable queue containing the media items to be played by the media player.


An immutable queue containing the media items to be played by an application queue media player.

Media Items and Playlists


The abstract superclass for media items, media item collections, and media playlist instances.


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


A graphical image, such as music album cover art, associated with a media item.


A sorted set of media items from the media library.


Attributes define the type of playlist.


A playable collection of related media items.


A set of attributes used to describe a playlist when the playlist is first created.

Media Player User Interface


A slider control used to set the system audio output volume, and a button for choosing the audio output route.


A specialized view controller that provides a graphical interface for selecting media items.


The protocol you implement so that a media item picker can respond to a user making media item selections.

Global Volume Setting Methods

Global functions for setting the volume alert window status.

Now Playing Information

Use this class to provide information about the current track.


An object that you use to set now-playing information for media being played by your app.

Multiple Language Support


A set of interfaces used to set the language option for the now-playing item.


A grouped set of language options where only a single language option can be active at a time.

Language Option Characteristic Constants

The constants used to define language characteristics.

External Player and System Event Handling

Use these classes to support playback controls on external media players or the controls displayed by the system.

Setting up the Remote Event Handler

Classes that you use to set up remote event handling.

Responding to Track Navigation Events

Classes that respond to requests to change what part of a media item is played.

Responding to Changes to Media Playback Mode Events

Classes that respond to changes in how media items are played.

Responding to Feedback and Rating Events

Classes that handle incoming feedback and rating events.

Error Handling

let MPErrorDomain: String

The MediaPlayer framework error domain.


Error codes for the MediaPlayer error domain.


Error codes for the MPError domain.

External Media Player Items

Provide content and interact with external media players.


An object containing the information for a particular media item that is displayed to the user.


The data source providing media metadata to external media players so they can build user interfaces displaying your app’s content.


The protocol used to let external media players send playback commands to an app.


A shared content manager used to control interactions between your media app and system-provided or external media player interfaces.


An object representing the current state of the playable endpoint.

Extended Types


An AVMediaSelectionGroup represents a collection of mutually exclusive options for the presentation of media within an asset.


An AVMediaSelectionOption object represents a specific option for the presentation of media within a group of options.


The type used for the name of a notification.


Provides the infrastructure for managing the views of your UIKit app.



Key metrics about network playback for an associated movie player that is playing streamed content.


A single piece of information for a movie access log.


Data describing network resource playback failures for the associated movie player, including timestamps indicating when each failure occurred.


A single piece of information for a movie error log.


Constants describing the network load state of the movie player.


The types of content available in the movie file.


A type of movie player that manages the playback of a movie from a file or a network stream.


A simple view controller for displaying full-screen movies.


A timed metadata object that carries time-based information within HTTP streamed media.