在基于 UITabBarController 的 iOS 应用程序中使用多个 MPMoviePlayerController 实例
在我的 iPad 应用程序中,用户可以在每个选项卡中打开一个 MPMoviePlayerController(总共 5 个)。
在每个包含 movieplayer 实例的视图控制器中,我在 viewDidAppear: 方法中播放电影,并在 viewWillDisappear: 方法中暂停它。我还添加/删除视图控制器作为通知的观察者,以便只有当前可见的视图控制器才能接收通知。电影播放器是在 init 方法中设置的,没有什么特别的。
注意:虽然您可以创建多个 MPMoviePlayerController 对象并在界面中显示它们的视图,但一次只能有一个电影播放器可以播放其电影。
除了上面的注释之外,我在文档中找不到任何有关此内容的信息,但我猜测电影播放器以某种方式在视图控制器之间共享,因为当我在每个选项卡中强制使用一个电影播放器时,它有时会起作用,有时当我返回上一个选项卡。
MPMoviePlayerController 是否意味着一次只能处理一个视频,无论实例是否位于不同的类/选项卡中?
In my iPad app, the user can open one MPMoviePlayerController in each tab (total of 5).
In each viewcontroller containing a movieplayer instance, I play the movie in viewDidAppear: method, and I pause it in viewWillDisappear: method. I also add/remove the viewcontroller as an observer for notifications so that only the viewcontroller currently visible is receiving the notifications. The movieplayer is setup in the init method, and there is nothing really special about it.
Note: Although you can create multiple MPMoviePlayerController objects and present their views in your interface, only one movie player at a time can play its movie.
Besides the note above, I cannot find anything about this in the docs, but I´m guessing that the movieplayer is shared between viewcontrollers somehow, becasuse when I force one movieplayer in each tab it works sometimes, and sometimes the movieplayer is finished when I return to the previous tab.
Is it a fact that MPMoviePlayerController are meant only handle one video at a time, no matter if the instances are in different classes/tabs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论