---
title: MPRemoteCommand
framework: mediaplayer
role: symbol
role_heading: Class
path: mediaplayer/mpremotecommand
---

# MPRemoteCommand

An object that responds to remote command events.

## Declaration

```swift
class MPRemoteCommand
```

## Overview

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

- [addTarget(handler:)](mediaplayer/mpremotecommand/addtarget(handler:).md)
- [addTarget(_:action:)](mediaplayer/mpremotecommand/addtarget(_:action:).md)
- [removeTarget(_:)](mediaplayer/mpremotecommand/removetarget(_:).md)
- [removeTarget(_:action:)](mediaplayer/mpremotecommand/removetarget(_:action:).md)
- [MPRemoteCommandHandlerStatus](mediaplayer/mpremotecommandhandlerstatus.md)

### Enabling a command object

- [isEnabled](mediaplayer/mpremotecommand/isenabled.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [MPChangePlaybackPositionCommand](mediaplayer/mpchangeplaybackpositioncommand.md)
- [MPChangePlaybackRateCommand](mediaplayer/mpchangeplaybackratecommand.md)
- [MPChangeRepeatModeCommand](mediaplayer/mpchangerepeatmodecommand.md)
- [MPChangeShuffleModeCommand](mediaplayer/mpchangeshufflemodecommand.md)
- [MPFeedbackCommand](mediaplayer/mpfeedbackcommand.md)
- [MPRatingCommand](mediaplayer/mpratingcommand.md)
- [MPSkipIntervalCommand](mediaplayer/mpskipintervalcommand.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Setting up the remote event handler

- [Becoming a now playable app](mediaplayer/becoming-a-now-playable-app.md)
- [MPRemoteCommandCenter](mediaplayer/mpremotecommandcenter.md)
- [MPRemoteCommandEvent](mediaplayer/mpremotecommandevent.md)
