Objective c MPMoviePlayerController在ios 5中不工作
我在使用MPMoviePlayerController时遇到问题。它在iOS5中不起作用,只能在黑屏上显示。甚至不会抛出任何异常或错误。 这是我的密码:Objective c MPMoviePlayerController在ios 5中不工作,objective-c,ios5,Objective C,Ios5,我在使用MPMoviePlayerController时遇到问题。它在iOS5中不起作用,只能在黑屏上显示。甚至不会抛出任何异常或错误。 这是我的密码: NSString *path = [[NSBundle mainBundle] pathForResource:@"cavity" ofType:@"mov"]; NSLog(@"%@",path); _movieController = [[MPMoviePlayerController alloc] initWithContentURL:[
NSString *path = [[NSBundle mainBundle] pathForResource:@"cavity" ofType:@"mov"];
NSLog(@"%@",path);
_movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:path]];
[_movieController prepareToPlay];
[_movieController setFullscreen:NO];
[_movieController.view setFrame:CGRectMake(10, 25, 287, 213)];
[_movieController setControlStyle:MPMovieControlStyleEmbedded];
[_movieView addSubview:_movieController.view];
[_movieController play];
已在.h文件中声明了_movieController对象,但该对象仍不处于工作状态。请尝试此操作
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
[[mp moviePlayer] prepareToPlay];
[[mp moviePlayer] setUseApplicationAudioSession:NO];
[[mp moviePlayer] setShouldAutoplay:YES];
[[mp moviePlayer] setControlStyle:2];
[[mp moviePlayer] setRepeatMode:MPMovieRepeatModeOne];
[self presentMoviePlayerViewControllerAnimated:mp];
它不起作用。它持续显示装载和活动指示器。仍然没有播放电影。你在浏览器中检查了那个url吗?它是一个文件。我给出了那个文件的路径。NSString*path=[[NSBundle mainBundle]pathForResource:@cover of type:@mov];但它只是显示加载视图我想MPMoviePlayerViewController没有获取文件的路径,所以请检查该文件的路径。路径是正确的,我已经检查了两次。同样的代码在ios 4.x中工作,但在ios 5中停止。