Iphone ExitFullScreen按钮会导致MPMoviePlayServices控制器和PresentMoviePlayServices控制器出现问题

Iphone ExitFullScreen按钮会导致MPMoviePlayServices控制器和PresentMoviePlayServices控制器出现问题,iphone,url,uiviewcontroller,mpmovieplayercontroller,presentmodalviewcontroller,Iphone,Url,Uiviewcontroller,Mpmovieplayercontroller,Presentmodalviewcontroller,以下是我的情况: 我用URL调用本地电影。该函数位于自定义viewController中 在h中: MPMoviePlayerViewController* modalVideoController 英寸 -(void)startVideoAd:(NSNotification*)notification { NSURL* url = (NSURL*)[notification object]; //url没有问题。。。已检查: modalVideoController = [[MP

以下是我的情况:

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

在h中:

MPMoviePlayerViewController* modalVideoController
英寸

-(void)startVideoAd:(NSNotification*)notification
{
  NSURL* url = (NSURL*)[notification object]; 
//url没有问题。。。已检查:

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

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

有没有办法在按下按钮后关闭视频?

回答:

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    // avoid exitFullscreen button problem on FullScreen mode
    if(modalVideoController != nil)
    {
        [modalVideoController.moviePlayer stop];
    }   
}

这样可以正确地停止电影。最后一个详细信息:modalVideoController成为全局的。

这可能对您的问题没有帮助,但您不应该调用AutoRotateTointerFaceOrientation。这是对UIViewController实现的重写,这样电影可以旋转到横向。我找到了答案。其想法是将modalVideoController变量设置为全局变量,然后在主ViewController的ViewDidDisplay中,测试modalVideoController!=无,然后调用[modalVideoController.moviePlayer stop]。