Ios 更改MPMoviePlayerController的内容

Ios 更改MPMoviePlayerController的内容,ios,mpmovieplayercontroller,Ios,Mpmovieplayercontroller,当我尝试以下操作时,双击当前正在播放的视频将停止,但新视频不会播放。我刚得到一个黑屏 UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; tap.numberOfTapsRequired = 2; [self.moviePlayer.view addGestureRecognizer:tap]; - (void)han

当我尝试以下操作时,双击当前正在播放的视频将停止,但新视频不会播放。我刚得到一个黑屏

UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
tap.numberOfTapsRequired = 2;
[self.moviePlayer.view addGestureRecognizer:tap];


- (void)handleTap:(UITapGestureRecognizer *)gesture {

    NSBundle *bundle = [NSBundle mainBundle];
    NSString *moviePath = [bundle pathForResource:@"Movie2" ofType:@"mp4"];


    [self.moviePlayer setContentURL:[NSURL fileURLWithPath:moviePath]];
    NSLog(@"contentURL: %@", self.moviePlayer.contentURL);
}
log语句正确地显示file://localhost/Users/me/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/15072262-7BC0-42D5-840C-740CF5B97D55/MyApp.app/Movie2.mp4


如果我在第一次创建MPMoviePlayerController时将其设置为contentURL,则Movie2.mp4有效并播放。为什么我不能更改播放机的内容?

实际上,在更改内容URL后,我必须告诉播放机播放:
[self.moviePlayer play]

你订阅了所有的通知吗?也许它是想告诉你发生了什么,而你只是忽视了它。。。