MPMoviePlayer中没有显示视频的权限?

时间:2012-12-13 11:50:52

标签: iphone xcode

我正在使用此代码将视频放在MPMoviePlayerController上,但我没有在MPMoviePlayerController上看到视频范围,它只显示黑屏。

  NSURL *url = [NSURL fileURLWithPath:self.moviePath];
  if (playerViewController != nil){
      [playerViewController release];
   }
   playerViewController =[[[MPMoviePlayerController alloc] init]retain];
   playerViewController.view.frame = CGRectMake(0.0, 0.0, videoView.frame.size.width, videoView.frame.size.height);
   playerViewController.backgroundView.backgroundColor = [UIColor clearColor];

   playerViewController setContentURL:url];
   playerViewController.controlStyle=MPMovieControlStyleDefault;
   playerViewController.shouldAutoplay = FALSE;
   playerViewController.repeatMode=NO;
   [videoView addSubview:playerViewController.view];

1 个答案:

答案 0 :(得分:0)

尝试这样做,然后检查它是否正常工作:

NSURL *url=[NSURL URLWithString:moviePath];