0

这是我的情况:

我用 URL 调用本地电影。该功能位于自定义视图控制器中

在 .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];
}

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

按下按钮后有没有办法杀死视频?

4

1 回答 1

0

回答:

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

这样可以正确停止电影。最后的细节:modalVideoController 成为全球性的。

于 2010-11-18T16:15:37.773 回答