我有這樣的代碼MPMoviePlayerViewController的作品,MPMoviePlayerController不..爲什麼?
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"d" ofType:@"mp4"];
NSURL *url = [NSURL fileURLWithPath:filepath];
//part 1
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: url];
[player.view setFrame: self.view.bounds];
//[player prepareToPlay];
//[player setShouldAutoplay:YES];
//[player setControlStyle:2];
[self.view addSubview: player.view];
[player play];
//part2
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[[mp moviePlayer] prepareToPlay];
[[mp moviePlayer] setShouldAutoplay:YES];
[[mp moviePlayer] setControlStyle:2];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:mp];
[self presentMoviePlayerViewControllerAnimated:mp];
的第2部分的作品,第一部分不...他們使用的是相同的URL,我已經幾乎拷入和粘貼從ADC網站的片段
我使用ios5
感謝包括2部分只看到了部分1代碼,它一直讓我發瘋,因爲它不起作用。第2部分代碼很好用! – scum