iPhone MPMoviePlayerController上的下一个/上一个按钮

Dav*_*zer 10 iphone mpmovieplayercontroller

使用MPMoviePlayerController时,播放按钮被"下一步"和"上一页"按钮包围.

如何在点击时收到通知?有没有办法为MPMoviePlayerController提供内容列表(数组)?

小智 6

如果你想要按钮通知,Nathan对于需要为播放器实现自己的UI是正确的.您可以从播放器获取有关播放状态的通知.

从AddMusic示例中,self是包含MPMusicPlayerController实例的控制器或模型:

- (void) registerForMediaPlayerNotifications {

    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];

    [notificationCenter addObserver: self
                           selector: @selector (handle_NowPlayingItemChanged:)
                               name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification
                             object: musicPlayer];

    [notificationCenter addObserver: self
                           selector: @selector (handle_PlaybackStateChanged:)
                               name: MPMusicPlayerControllerPlaybackStateDidChangeNotification
                             object: musicPlayer];

    /*
     // This sample doesn't use libray change notifications; this code is here to show how
     //     it's done if you need it.
     [notificationCenter addObserver: self
     selector: @selector (handle_iPodLibraryChanged:)
     name: MPMediaLibraryDidChangeNotification
     object: musicPlayer];

     [[MPMediaLibrary defaultMediaLibrary] beginGeneratingLibraryChangeNotifications];
     */

    [musicPlayer beginGeneratingPlaybackNotifications];
}
Run Code Online (Sandbox Code Playgroud)