开发者

How to control Next Track Item on MPMusicPlayer

开发者 https://www.devze.com 2023-01-27 08:58 出处:网络
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 MPMusicPlayerControllerNowPla

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
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消