【问题标题】:Done button action of MPMoviePlayerViewControllerMPMoviePlayerViewController 的完成按钮操作
【发布时间】:2014-12-05 10:48:54
【问题描述】:

我正在使用自定义 MPMoviePlayerViewController。 如下所示,

#import <MediaPlayer/MediaPlayer.h>

@interface customVideoViewController : MPMoviePlayerViewController
{
}

@end

我正在从其他类调用此 customVideoViewController 类以横向模式连续运行我的视频,视频运行良好,但我无法捕捉 MPMoviePlayerViewController 的 DONE 按钮的 onClick 动作。

谁能指导我。

这就是我调用这个视图的方式。

customVideoPlayerObj = [[customVideoViewController alloc]initWithContentURL:self.url];
[self presentViewController:customVideoPlayerObj animated:YES completion:nil];
[customVideoPlayerObj.moviePlayer play];

我需要捕捉点击完成按钮的动作,如何做到这一点...?

这是相同的观察者

[[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(doneButtonClick:)
                                                     name:MPMoviePlayerWillExitFullscreenNotification
                                                   object:customVideoPlayerObj];

但控制权没有进入doneButtonClick

【问题讨论】:

  • 您在哪种方法中添加通知观察者?
  • @Michael Dautermann 使用与我调用此方法相同的方法。我也尝试在 customVideoViewController 文件中添加观察者,但没有帮助

标签: xcode mpmovieplayercontroller


【解决方案1】:

当电影播放器​​退出全屏时触发 MPMoviePlayerWillExitFullscreenNotification 和 MPMoviePlayerDidExitFullscreenNotification。

【讨论】:

    【解决方案2】:

    您可以使用MPMoviePlayerPlaybackDidFinishNotification

    【讨论】:

    • 这是来自 Apple 在线文档[developer.apple.com/library/ios/documentation/MediaPlayer/…“当电影以全屏模式显示并且用户点击完成时,不会发送此通知。完成按钮暂停播放并导致电影播放器退出全屏模式。要检测这种情况,请注册其他通知,例如 MPMoviePlayerDidExitFullscreenNotification。"
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-28
    • 1970-01-01
    • 1970-01-01
    • 2016-01-08
    相关资源
    最近更新 更多