ExitFullScreen按钮导致MPMoviePlayerViewController和presentMoviePlayerViewControllerAnimated出现问题

时间:2010-11-16 16:56:07

标签: iphone url uiviewcontroller mpmovieplayercontroller presentmodalviewcontroller

这是我的情况:

我用URL调用本地电影。该函数位于自定义viewController

在.h:

MPMoviePlayerViewController* modalVideoController

in .m

-(void)startVideoAd:(NSNotification*)notification
{
  NSURL* url = (NSURL*)[notification object]; 

//网址没问题...已经检查过:)

  modalVideoController = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
  [modalVideoController shouldAutorotateToInterfaceOrientation:YES];
  [self presentMoviePlayerViewControllerAnimated:modalVideoController];

  [modalVideoController release];
}

问题:如果用户点击进入/退出全屏按钮(视频按钮面板中fastfoward按钮右侧的双箭头按钮),modalviewController正常消失,但视频仍在播放,没有图像只是声音。

有没有办法在按下按钮后终止视频?

1 个答案:

答案 0 :(得分:0)

答案:

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    // avoid exitFullscreen button problem on FullScreen mode
    if(modalVideoController != nil)
    {
        [modalVideoController.moviePlayer stop];
    }   
}
这样就可以正确地停止电影了。最后的细节:modalVideoController变得全球化了。