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

发布于 2024-10-02 14:04:06 字数 734 浏览 6 评论 0原文

这是我的情况:

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

MPMoviePlayerViewController* modalVideoController

在 .m

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

// url 没有问题...已经检查过:)

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

  [modalVideoController release];
}

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

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

here is my situation :

I call a local movie with an URL. the function is in a custom viewController

in .h :

MPMoviePlayerViewController* modalVideoController

in .m

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

// no problem with url ... already check :)

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

  [modalVideoController release];
}

Problem : if the user hit the enter/exit fullscreen button (the double arrow button at right of the fastfoward button in the video button panel), the modalviewController normaly disappear but the video still playing , no images just sounds.

is there a way to kill the video after the button is pressed ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

装纯掩盖桑 2024-10-09 14:04:06

答:

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

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

Answer:

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

this way stop correctly the movie. Last details: modalVideoController became global.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文