如何在外部显示器上显示视频,同时在 iPad 上保持控制?

发布于 2024-11-15 13:28:46 字数 242 浏览 5 评论 0原文

我的 iPad 应用程序可以选择播放视频。我使用 MPMoviePlayerViewController 类来播放我的视频。

我的问题是:如果我想在连接的外部显示器上播放视频,如何像 YouTube 一样将播放控件保留在 iPad 上?如果我将 MPMoviePlayerViewController 的播放器的视图添加到外部屏幕的层次结构中,我可以正常播放视频,但我现在无法控制它。有没有办法移动或复制控件所在的视图并将其放置在 iPad 上的视图上?

My iPad app has the option to play videos. I use the MPMoviePlayerViewController class to play my videos.

My question is: if I want to play the videos on an attached external monitor, how do I keep the playback controls on the iPad like YouTube does? If I add the view of the MPMoviePlayerViewController 's player to the external screen's hierarchy I can play the video fine, but I now have no control over it. Is there a way to move or duplicate the view where the controls lie and place it on a view which resides on the iPad?

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

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

发布评论

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

评论(1

赠意 2024-11-22 13:28:46

我不知道是否有官方支持的方式以这种方式拉出原始 UI。 MPMoviePlayerViewController 仅通过其 moviePlayer 属性公开其使用的 MPMoviePlayerController 对象。 MPMoviePlayerController 反过来仅公开 viewbackgroundView,这对于此目的没有帮助。理论上,您可以检查电影播放器​​主视图的子视图,找到播放控件并尝试将它们移动到另一个屏幕。我有一种感觉,但这不会有好结果,因为它们绝不是静态的。你也永远不知道以后的 iOS 版本会发生什么,或者他们是否会让你在应用商店上进行黑客攻击。自己重新做一下 UI 可能会更省事。

实际上以编程方式控制视频播放很简单 - 视图控制器的moviePlayer实现了MPMediaPlayback 协议。

I'm not aware of an officially supported way of pulling out the original UI in this way. The MPMoviePlayerViewController only exposes the MPMoviePlayerController object it uses via its moviePlayer property. The MPMoviePlayerController in turn only exposes view and backgroundView, which aren't helpful for such a purpose. You could in theory inspect the subviews of the movie player's main view, find the playback controls and try to move them to the other screen. I have a feeling this will not end well though, as they're anything but static. You also never know what will happen in later iOS versions, or if they'll let your hack on the app store. It's probably less trouble to just re-do the UI yourself.

Actually controlling the video playback programmatically is straightforward - the view controller's moviePlayer implements the MPMediaPlayback protocol.

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