0

我正在使用此代码将视频放在 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];
4

1 回答 1

0

像这样尝试,然后检查它是否工作:

NSURL *url=[NSURL URLWithString:moviePath];
于 2012-12-13T12:12:25.373 回答