Handling State Changes

Earlier in this section, three notifications were registered to receive callbacks. These notifications allow the app to determine the current state and behavior of the MPMusicPlayerController. The first method that is being watched will be called whenever the currently playing item changes. This method contains two parts. The first part updates the album artwork, and the second updates the labels that indicate the artist, song title, and album being played.

Every audio or video item being played through the MPMusicPlayerController is represented by an MPMediaItem object. This object can be retrieved by invoking the method nowPlayingItem on an instance of MPMusicPlayerController.

A new UIImage is created to represent the ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.