【发布时间】:2012-01-03 11:02:45
【问题描述】:
我有一个应用程序在 IOS4 中运行良好,但在 IOS5 中停止显示视频。以前我使用的是 MPMoviePlayerController,所以我切换到 MPMoviePlayerViewController,现在视频在 IOS5 中显示正常。
但是,现在在 IOS5 中,当按下 Done 按钮时,视频会在 MPMoviePlayerViewController 中停止播放,但 MPMoviePlayerController 不再调用 Notifications。
层次结构如下:
AppDelegate -> UITabBarController -> UITableView -> UIViewController 在其中调用 MPMoviePlayerViewController。在 UIViewController 内部,代码如下所示:
MPMoviePlayerViewController *tmpMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
self.moviePlayer = tmpMoviePlayer;
[self presentMoviePlayerViewControllerAnimated:self.moviePlayer];
NSNotificationCenter *notificationCenter = [ NSNotificationCenter defaultCenter ];
[notificationCenter addObserver:self
selector:@selector(moviePlayerPlaybackDidFinish:)
name:MPMoviePlayerWillExitFullscreenNotification
object:[self.moviePlayer moviePlayer ]];
我也尝试了以下通知名称,但没有一个被触发:
MPMoviePlayerPlaybackDidFinishNotification
MPMoviePlayerPlaybackStateDidChangeNotification
MPMoviePlayerPlaybackDidFinishReasonUserInfoKey
MPMoviePlayerNowPlayingMovieDidChangeNotification
MPMoviePlayerWillExitFullscreenNotification
MPMoviePlayerDidExitFullscreenNotification
我看到了 SO posting,其中 MPMoviePlayerViewController 是从 UITabBarController 中调用的,并且调用 presentMoviePlayerViewControllerAnimated 的视图未正确选择,但我无法获得任何其他视图来调用 presentMoviePlayerViewControllerAnimated。
任何想法为什么在按下 MPMoviePlayerViewController 的完成按钮时不再调用通知?
【问题讨论】:
标签: iphone notifications uitabbarcontroller ios5 mpmovieplayercontroller