iOS Developer Library

Developer

MediaPlayer Framework Reference MPNowPlayingInfoCenter Class Reference

Options
Deployment Target:

On This Page
Language:

MPNowPlayingInfoCenter

Use a now playing info center to set now-playing information for media being played by your app. More...

Inheritance


Conforms To


Import Statement


import MediaPlayer @import MediaPlayer;

Availability


Available in iOS 5.0 and later.
  • Returns the singleton now playing info center.

    Declaration

    Swift

    class func defaultCenter() -> MPNowPlayingInfoCenter!

    Objective-C

    + (MPNowPlayingInfoCenter *)defaultCenter

    Discussion

    The default now playing info center holds now-playing information for the app that is designated as the receiver for remote-control events. For information on how to configure your app to receive remote-control events, see Remote Control of Multimedia in Event Handling Guide for iOS.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 5.0 and later.

  • The current now-playing information for the default now playing info center.

    Declaration

    Swift

    var nowPlayingInfo: [NSObject : AnyObject]!

    Objective-C

    @property(copy) NSDictionary *nowPlayingInfo

    Discussion

    To clear the now playing info center dictionary, set it to nil.

    Import Statement

    import MediaPlayer

    Availability

    Available in iOS 5.0 and later.

  • These properties for the now playing info center dictionary supplement the available media item properties, as described in the Overview in this document.

    Declaration

    Swift

    let MPNowPlayingInfoPropertyElapsedPlaybackTime: NSString! let MPNowPlayingInfoPropertyPlaybackRate: NSString! let MPNowPlayingInfoPropertyPlaybackQueueIndex: NSString! let MPNowPlayingInfoPropertyPlaybackQueueCount: NSString! let MPNowPlayingInfoPropertyChapterNumber: NSString! let MPNowPlayingInfoPropertyChapterCount: NSString!

    Objective-C

    NSString *const MPNowPlayingInfoPropertyElapsedPlaybackTime; NSString *const MPNowPlayingInfoPropertyPlaybackRate; NSString *const MPNowPlayingInfoPropertyPlaybackQueueIndex; NSString *const MPNowPlayingInfoPropertyPlaybackQueueCount; NSString *const MPNowPlayingInfoPropertyChapterNumber; NSString *const MPNowPlayingInfoPropertyChapterCount;

    Constants

    • MPNowPlayingInfoPropertyElapsedPlaybackTime

      MPNowPlayingInfoPropertyElapsedPlaybackTime

      The elapsed time of the now playing item, in seconds.

      Value is an NSNumber object configured as a double. Elapsed time is automatically calculated, by the system, from the previously provided elapsed time and the playback rate. Do not update this property frequently—it is not necessary.

      Available in iOS 5.0 and later.

    • MPNowPlayingInfoPropertyPlaybackRate

      MPNowPlayingInfoPropertyPlaybackRate

      The playback rate of the now-playing item, with a value of 1.0 indicating the normal playback rate.

      Value is an NSNumber object configured as a double. The default value is 1.0. A playback rate value of 2.0 means twice the normal playback rate; a piece of media played at this rate would take half as long to play to completion. A value of 0.5 means half the normal playback rate; a piece of media played at this rate would take twice as long to play to completion.

      Available in iOS 5.0 and later.

    • MPNowPlayingInfoPropertyPlaybackQueueIndex

      MPNowPlayingInfoPropertyPlaybackQueueIndex

      The index of the now-playing item in the app’s playback queue.

      Value is an NSNumber object configured as an NSUInteger. The playback queue uses zero-based indexing. If you want the first item in the queue to be displayed as “item 1 of 10,” for example, set the item’s index to 0.

      Available in iOS 5.0 and later.

    • MPNowPlayingInfoPropertyPlaybackQueueCount

      MPNowPlayingInfoPropertyPlaybackQueueCount

      The total number of items in the app’s playback queue.

      Value is an NSNumber object configured as an NSUInteger.

      Available in iOS 5.0 and later.

    • MPNowPlayingInfoPropertyChapterNumber

      MPNowPlayingInfoPropertyChapterNumber

      The number corresponding to the chapter currently being played.

      Value is an NSNumber object configured as an NSUInteger. Chapter numbering uses zero-based indexing. If you want the first chapter in the now-playing item to be displayed as “Chapter 1,” for example, set the chapter number to 0.

      Available in iOS 5.0 and later.

    • MPNowPlayingInfoPropertyChapterCount

      MPNowPlayingInfoPropertyChapterCount

      The total number of chapters in the now-playing item.

      Value is an NSNumber object configured as an NSUInteger.

      Available in iOS 5.0 and later.

    Import Statement