Contents

MPRemoteCommand

An object that responds to remote command events.

Declaration

class MPRemoteCommand

Overview

The Media Player framework defines a standard set of remote command objects for handling media-related events. When an accessory or iOS user interface generates a remote control event, the system notifies the corresponding command object on the shared MPRemoteCommandCenter instance. That command object executes any attached handlers.

To respond to a particular event, register a handler with the appropriate MPRemoteCommand object.

Listing 1. Registering a remote control event handler

If you explicitly don’t want to enable a given command, fetch the command object and set its enabled property to false. Disabling a remote command lets the system know that it shouldn’t display any related UI for that command when your app is the Now Playing app.

The framework defines many subclasses to handle specific kinds of commands. Sometimes, these subclasses let you specify other information related to the command. For example, feedback commands let you specify a localized string that describes the meaning of the feedback. When supporting a particular command, be sure to look up the specific class used to handle those events.

Topics

Handling events

Enabling a command object

See Also

Setting up the remote event handler