1

我正在使用此代码尝试播放视频。然而,视频从未播放过,回调也不会说它已经完成。我看不到任何我丢失或不应该出现的东西。我已经检查了路径,这很好。确实会出现视频播放视图。它只是在那个时候不播放。

有什么建议么?

NSURL *movieURL = [[NSBundle mainBundle] URLForResource:@"IntroMovie" withExtension:@"mov"];

NSLog(@"%@", movieURL);

MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];

[moviePlayerController prepareToPlay];

[moviePlayerController.view setFrame:self.view.bounds];
[self.view addSubview:moviePlayerController.view];

[moviePlayerController play];
4

1 回答 1

7

The problem lies within the fact, that your moviePlayerController is being cleaned up due to ARC.

Try if it helps to introduce a strong property for the MPMoviePlayerController.

于 2013-10-03T12:30:38.413 回答