启动画面视频无法播放

时间:2014-11-19 10:36:23

标签: ios objective-c video splash-screen

我正在使用视频进行启动画面但它没有播放,它显示黑屏,这是我的代码

  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  NSString* moviePath = [[NSBundle mainBundle] pathForResource:@"hello" ofType:@"mp4"];
  NSURL* movieURL = [NSURL fileURLWithPath:moviePath];

  playerCtrl =  [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
  playerCtrl.scalingMode = MPMovieScalingModeFill;
  playerCtrl.controlStyle = MPMovieControlStyleNone;
  playerCtrl.view.autoresizingMask =UIViewAutoresizingFlexibleHeight;


 [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayBackDidFinish)
                                             name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
 [self.window addSubview:playerCtrl.view];
 [playerCtrl play];

1 个答案:

答案 0 :(得分:0)

您可以尝试将播放器视图框设置为窗口边界吗?

相关问题