Skip to content

Instantly share code, notes, and snippets.

@TachibanaKaoru
Last active December 27, 2015 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TachibanaKaoru/7278793 to your computer and use it in GitHub Desktop.
Save TachibanaKaoru/7278793 to your computer and use it in GitHub Desktop.
catch notification from iPod player.
// (link MediaPlayer.framework)
// get item changed notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePlayerStatus:) name:MPMusicPlayerControllerNowPlayingItemDidChangeNotification object:nil];
// get status changed notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePlayerStatus:) name:MPMusicPlayerControllerPlaybackStateDidChangeNotification object:nil];
// get volume changed notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePlayerStatus:) name:MPMusicPlayerControllerVolumeDidChangeNotification object:nil];
[[MPMusicPlayerController iPodMusicPlayer] beginGeneratingPlaybackNotifications];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment