0

我有几部电影使用此代码播放和呈现。

如您所见,我还删除了默认的电影控件并添加了一个自定义叠加层,它基本上只是停止了视频。

这是我的问题...当我使用自定义叠加按钮停止电影时,我似乎没有收到“MPMoviePlayerPlaybackDidFinishNotification”

注意:如果我让电影播放并自行停止,一切正常。

是否有任何“强制” PlaybackDidFinish 通知的方式?

我可以做这样的事情吗[self moviePlayBackDidFinish:something]??

谢谢你!

- (void) playMovie {
NSString *path = [[NSBundle mainBundle] pathForResource:@"movie_frog" ofType:@"m4v"];
NSURL *url = [NSURL fileURLWithPath:path];
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];

if(mp) {

    self.myMoviePlayer = mp;
    [mp release];

    //movie view
    [self.view addSubview:myMoviePlayer.view];
    myMoviePlayer.view.frame = CGRectMake(0.0,0.0,480,320);
    self.myMoviePlayer.controlStyle = MPMovieControlStyleNone;
    [self.myMoviePlayer play];

    //videoNav
 _videoNav = [[videoNav alloc] initWithNibName:@"videoNav" bundle:nil];
 [self.view addSubview:_videoNav.view];

[[NSNotificationCenter defaultCenter] addObserver:self 
                                selector:@selector(moviePlayBackDidFinish:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:nil];



}

}

4

1 回答 1

1

我用


[[NSNotificationCenter defaultCenter] postNotificationName: MPMoviePlayerPlaybackDidFinishNotification object:nil];

于 2010-06-04T10:56:10.680 回答