How to control Next Track Item on MPMusicPlayer
In MPMusicPlayer i want to display MPMediaPickerView if the Next Track item are finished.... How this is possib开发者_运维知识库le on phone....Please help me....
Watch for MPMusicPlayerControllerNowPlayingItemDidChangeNotification
, and in your selector
method, check the playbackState
for MPMusicPlaybackStateStopped
, do other checking (maybe nowPlayingItem
?), and present your view.
NSNotificationCenter * notifications = [NSNotificationCenter defaultCenter];
[notifications addObserver:self selector:@selector (trackDidChangeWithNotification:)
name:MPMusicPlayerControllerNowPlayingItemDidChangeNotification
object:self.iPodController];
.....
-(void)handleNextTrackNotification {
if ([self.iPodController playbackState] == MPMusicPlaybackStateStopped) {
// do whatever logic checks
// present view
}
}
精彩评论