ipad - MPMoviePlayerViewController 未出现

标签 ipad ios media-player mpmovieplayer

我正在尝试为标题/启动屏幕加载一部小电影。但是,当我调用 presentMoviePlayerViewControllerAnimated 时,什么也没有发生。我已经确认该代码块正在执行,但用户无法感知到任何内容。

我的目标是 iPad,因此假设为 3.2。

如有任何帮助,我们将不胜感激。

- (void)viewDidLoad {
  [super viewDidLoad];

  NSString *path = [[NSBundle mainBundle] pathForResource:@"Intro" ofType:@"m4v" inDirectory:nil];
  NSURL *fileURL = [NSURL fileURLWithPath:path];
  MPMoviePlayerViewController *playerView = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
  [[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(playbackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:playerView.moviePlayer];
  [self presentMoviePlayerViewControllerAnimated:playerView];
  [playerView release];
}

- (void)playbackDidFinish:(NSNotification*)aNotification {
  MPMoviePlayerController *player = [aNotification object];
  [[NSNotificationCenter defaultCenter] removeObserver:self
                                                name:MPMoviePlayerPlaybackDidFinishNotification
                                              object:player];
  [player stop];
  [self dismissMoviePlayerViewControllerAnimated];
}

最佳答案

你应该放置这条线 [玩家 View 发布]; 后 这条线 [ self 解雇MoviePlayerViewControllerAnimated];

关于ipad - MPMoviePlayerViewController 未出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4784964/

相关文章:

ipad - 创建一个像 Pages 一样工作的 ScrollView

ios - 将 UIView 子类链接到 xib 文件

iphone - 如何检查Core Data是否已经有值?

Android-测试设备的 Mediaplayer 流媒体问题

video - libdash mpd 解析器与自定义播放器的集成

iPhone SDK : how to play music and record from the mic at the same time?

iphone - 如何合并两个 NSArray

ios - 如何仅在iTunes中上传iPad版本?

ios - 如何通过 Google 登录使用 Google Apps (iOS 7)

ios - 如何实现与 "Photos"中的捏合手势相关的动画?