我正在使用此代码将视频放在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];
答案 0 :(得分:0)
尝试这样做,然后检查它是否正常工作:
NSURL *url=[NSURL URLWithString:moviePath];