Class

MPPlayableContentManager

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

Declaration

class MPPlayableContentManager : NSObject

Overview

Data is provided by the app to the content manager so that the media player can browse the content provided. A delegate provides the media player the ability to perform actions that manage the app’s playback queue.

You don’t create a new content manager directly, instead you grab the shared content manager using the shared() method. After getting the shared content manager, your next step depends on the features your app supports:

  • To provide content navigation and suggested content for CarPlay, immediately set both the dataSource and delegate properties. After setting these properties, use the beginUpdates() and endUpdates() methods to load the information from the data source.

  • To provide suggested content when the user connects headphones, a Bluetooth stereo, or another output device, set only the delegate property. After you set a delegate, iOS automatically calls methods in the MPPlayableContentDelegate protocol allowing you to suggest appropriate content.

Topics

Providing Playable Content

var dataSource: MPPlayableContentDataSource?

The data source provided by the app.

protocol MPPlayableContentDataSource

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

Responding to Playback Events

var delegate: MPPlayableContentDelegate?

A delegate that lets the media player manage the app’s playback queue.

protocol MPPlayableContentDelegate

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

Setting the Content Manager

class func shared() -> Self

Returns the current content manager instance.

Updating Data

func beginUpdates()

Updates several Media Player content items at once.

func endUpdates()

Ends a synchronized update.

func reloadData()

Reloads the data from the data source.

Retrieving Information on Currently Playing Items

var context: MPPlayableContentManagerContext

The current state of the playable content endpoint.

var nowPlayingIdentifiers: [String]

The content items currently playing based on their identifiers.

Relationships

Inherits From

Conforms To

See Also

External Media Player Items

class MPContentItem

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

class MPPlayableContentManagerContext

An object representing the current state of the playable endpoint.