在iPhone上的MPMoviePlayerController下一页/上一页按钮(Next/Pre

2019-06-26 01:33发布

当使用的MPMoviePlayerController,播放按钮被包围“下一步”和“上一步”按钮。

我如何获得通知单击时? 有一种方法用的内容的列表(数组)喂的MPMoviePlayerController?

Answer 1:

弥敦道是关于需要实现自己的UI的球员,如果你想按钮通知是正确的。 您可以从有关播放状态的玩家得到通知,虽然。

从AddMusic例如,当自为含有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];
}


Answer 2:

当用户按下一个/上一个按钮,没有生成通知(应提交有关该错误),所以唯一的办法来解决这个没有任何未经批准的视图爬行是为了实现自己的视频覆盖图:

MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc]
    initWithContentURL:someUrl];
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];

NSArray* windows = [[UIApplication sharedApplication] windows];
if ([windows count] > 1) {
  UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
  [moviePlayerWindow addSubview:yourCustomOverlayView];
}

不理想,但标准控件是很容易重新实现。



Answer 3:

我不认为你有过太多的控制MPMoviePlayerController 。 它是一个标准组件,基本上可以开始和停止播放影片,没有别的。



文章来源: Next/Previous buttons on iPhone MPMoviePlayerController