MPMoviePlayerController 不响应 setFullscreen = NO

发布于 2024-10-06 13:36:26 字数 865 浏览 0 评论 0原文

我正在使用 MPMovieController 作为基础创建一个自定义 MovieController。 将视频切换到全屏,

_[moviePlayer setFullscreen:YES animated:YES];_

我可以通过调用相同的函数([moviePlayer setFullscreen:NOanimated:YES];) 以使电影播放器​​恢复到原始状态(即当用户按下完成按钮)不起作用。

作为替代方案,我还尝试 -

a) 监听 MPMoviePlayerDidExitFullscreenNotification 并调用 moviePlayBackDidFinish: 函数作为结果。

b) 使用此功能从“完成”功能内发布我的自定义通知 -

NSDictionary *thisDictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:MPMovieFinishReasonUserExited] forKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];  
[[NSNotificationCenter defaultCenter] postNotificationName:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer userInfo:thisDictionary];

但在所有这些情况下,电影播放器​​视图不会返回到其原始状态。

请帮忙。

谢谢!

I'm creating a custom MovieController using MPMovieController as base. I can switch the video to full-screen by calling

_[moviePlayer setFullscreen:YES animated:YES];_

Calling the same function ([moviePlayer setFullscreen:NO animated:YES];) to bring the movie-player back to the original state (ie when user press Done button) does not work.

As an alternative, I've also tried to -

a) listening to MPMoviePlayerDidExitFullscreenNotification and calling moviePlayBackDidFinish: function as a result of this.

b) posting my custom notification from inside "Done" function using this -

NSDictionary *thisDictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:MPMovieFinishReasonUserExited] forKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];  
[[NSNotificationCenter defaultCenter] postNotificationName:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer userInfo:thisDictionary];

But in all these cases, the movie-player view does not come back to its original state.

Help Please.

Thanks!

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

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

发布评论

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

评论(1

烟火散人牵绊 2024-10-13 13:36:26

您必须注册该事件的通知。当您准备播放视频时,请执行以下操作

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

,并在您的电影PlayBackDidFinish选择器中执行以下操作

  [[UIApplication sharedApplication] setStatusBarHidden:YES];
  [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification 
        object:nil];


[self dismissModalViewControllerAnimated:YES];

You have to register notification for the event. When you prepare for to play the video, do like this

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

and in your moviePlayBackDidFinish selector, do like this

  [[UIApplication sharedApplication] setStatusBarHidden:YES];
  [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification 
        object:nil];


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