iOS Developer Library

Developer

MediaPlayer Framework Reference MPRemoteCommandCenter Class Reference

Options
Deployment Target:

On This Page
Language:

MPRemoteCommandCenter

The MPRemoteCommandCenter class provides the general command properties to handle events sent by an external media player. Use the sharedCommandCenter method to generate a singleton to register target-action pairs to a command property to handle an event. More...

Inheritance


Conforms To


Import Statement


import MediaPlayer @import MediaPlayer;

Availability


Available in iOS 7.1 and later.
  • A control endpoint for selecting the next media item. (read-only)

    Declaration

    Swift

    var nextTrackCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *nextTrackCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to select the media item immediately after the current media item.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for selecting the previous media item. (read-only)

    Declaration

    Swift

    var previousTrackCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *previousTrackCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to select the media item immediately before the current media item.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for pausing the current media item. (read-only)

    Declaration

    Swift

    var pauseCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *pauseCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to pause the currently playing media item.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for playing the selected media item. (read-only)

    Declaration

    Swift

    var playCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *playCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate thta the app needs to play the selected media item.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for stopping play of the current media item. (read-only)

    Declaration

    Swift

    var stopCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *stopCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to stop playing the current media item.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for switching between playing and pausing the current media item. (read-only)

    Declaration

    Swift

    var togglePlayPauseCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *togglePlayPauseCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to switch between playing and stopping the current media item. If the current item is playing, it must be paused. If the current item is paused, it must resume playing.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for changing the playback rate of the current media item. (read-only)

    Declaration

    Swift

    var changePlaybackRateCommand: MPChangePlaybackRateCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPChangePlaybackRateCommand *changePlaybackRateCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to change the play rate of the current media item. The play rate can be increased, but it cannot be negative.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for seeking backward through a single media item. (read-only)

    Declaration

    Swift

    var seekBackwardCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *seekBackwardCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to search backwards through the media item in the data source.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for seeking forward through a single media item. (read-only)

    Declaration

    Swift

    var seekForwardCommand: MPRemoteCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRemoteCommand *seekForwardCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to search forwards through the media item in the data source.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for indicating that a user does not like a media item. (read-only)

    Declaration

    Swift

    var dislikeCommand: MPFeedbackCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPFeedbackCommand *dislikeCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to mark that the user does not like the media item.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for indicating that a user likes a media item. (read-only)

    Declaration

    Swift

    var likeCommand: MPFeedbackCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPFeedbackCommand *likeCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to mark that the user likes the media item.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for indicating that a user wants to mark a media item. (read-only)

    Declaration

    Swift

    var bookmarkCommand: MPFeedbackCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPFeedbackCommand *bookmarkCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to mark that the wants to return to the media item at a later time.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for indicating the rating for a media item. (read-only)

    Declaration

    Swift

    var ratingCommand: MPRatingCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPRatingCommand *ratingCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to mark the media item with the rating selected by the user.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for playing a previous point in a media item. (read-only)

    Declaration

    Swift

    var skipBackwardCommand: MPSkipIntervalCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPSkipIntervalCommand *skipBackwardCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to jump to a previous point in the current media item. The amount of time skipped is specified in the event’s interval property.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • A control endpoint for playing a future point in a media item. (read-only)

    Declaration

    Swift

    var skipForwardCommand: MPSkipIntervalCommand! { get }

    Objective-C

    @property(nonatomic, readonly) MPSkipIntervalCommand *skipForwardCommand

    Discussion

    Associate a target-action pair with this property to handle events sent from an external media player. These events indicate that the app needs to jump to a future point in the current media item. The amount of time skipped is specified in the event’s interval property.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.

  • Returns a singleton object for event handling.

    Declaration

    Swift

    class func sharedCommandCenter() -> MPRemoteCommandCenter!

    Objective-C

    + (MPRemoteCommandCenter *)sharedCommandCenter

    Return Value

    An instance of a MPRemoteCommandCenter object.

    Discussion

    Call the sharedCommandCenter method to return an instance of the command center. Add target-action pairs to MPRemoteCommandCenter commands to handle events.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later.