iOS:MPMoviePlayerController 完成按钮不起作用

发布于 2024-11-15 15:59:38 字数 679 浏览 1 评论 0原文

我将 MPMoviePlayerController 添加到视图中,如下所示:

player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.controlStyle = MPMovieControlStyleNone; 
[player.view setFrame:self.playerView.bounds];     
[self.playerView addSubview:player.view];

self.playerView 是我的主视图内的一个小视图,并且我有自定义按钮来控制同一主视图中的播放。这一切都很好。

我有一个全屏按钮,其工作方式如下:

- (IBAction) btnFullScreenPressed:(id)sender {
    [player setFullscreen:TRUE animated:TRUE];
    [player setControlStyle:MPMovieControlStyleFullscreen];
}

这工作正常,但是当我点击全屏控件上的“完成”按钮时,电影停止播放,但不会返回到我视图中较小的 self.playerView 。我怎样才能让它“非全屏”并返回到较小的 self.playerView?

谢谢。

I am adding an MPMoviePlayerController to a view like so:

player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.controlStyle = MPMovieControlStyleNone; 
[player.view setFrame:self.playerView.bounds];     
[self.playerView addSubview:player.view];

self.playerView is a small view inside my main view and I have custom buttons that control playback within that same main view. This all works fine.

I have a fullscreen button that works like so:

- (IBAction) btnFullScreenPressed:(id)sender {
    [player setFullscreen:TRUE animated:TRUE];
    [player setControlStyle:MPMovieControlStyleFullscreen];
}

This works fine, but then when I hit the Done button on the full screen controls, the movie stops playing but does not return to the smaller self.playerView in my view. How can I get it to "un-fullscreen" and return to the smaller self.playerView?

Thanks.

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

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

发布评论

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

评论(1

我是男神闪亮亮 2024-11-22 15:59:38

相当不直观的是,您实际上必须将控件样式设置为默认值,即:

- (IBAction) btnFullScreenPressed:(id)sender {
    [player setFullscreen:TRUE animated:TRUE];
    [player setControlStyle:MPMovieControlStyleDefault];
}

当然,然后当您收到 MPMoviePlayerWillExitFullscreenNotification 或 MPMoviePlayerDidExitFullscreenNotification (我更喜欢“did exit”)时,将其设置回无。

Quite unintuitively you actually have to set the control style to default, i.e.:

- (IBAction) btnFullScreenPressed:(id)sender {
    [player setFullscreen:TRUE animated:TRUE];
    [player setControlStyle:MPMovieControlStyleDefault];
}

and, of course, then set it back to none when you receive MPMoviePlayerWillExitFullscreenNotification or MPMoviePlayerDidExitFullscreenNotification (I prefer "did exit").

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