无法在SDK 4.1中向MPMoviePlayerController添加叠加层 [英] Unable to add overlay to MPMoviePlayerController in SDK 4.1
问题描述
这是后续内容:在Streaming MPMoviePlayerController上叠加
我见过关于检查新窗口的各种线程,然后使用它来将我的自定义视图应用到我的全屏视频,但是在SDK 4.1中这似乎没有是这样的。
I've seen the various threads about checking for a new Window and then using that to apply my custom views to my fullscreen video however in SDK 4.1 this doesnt appear to be the case.
我已经尝试了一个计时器并且正在监听UIWindowDidBecomeKeyNotification,但在这两种情况下[[UIApplication sharedApplication] windows]都不包含多于1个项目。
I have tried a timer and listening for UIWindowDidBecomeKeyNotification but in neither case does [[UIApplication sharedApplication] windows] ever contain more than 1 item.
我尝试将我的视图添加到播放器视图属性,该视图属性在显示时工作正常,但不是全屏时,即使我在moviePlayBackDidEnterFullScreen事件中添加它
I have tried adding my view to the players view property which works fine when displayed in place, but not when fullscreen, even if I add it in moviePlayBackDidEnterFullScreen event
推荐答案
几周前我找到了解决这个问题的方法:
I found a solution to this problem a few weeks ago:
看来这个方法不能在iPad上工作(我还没有检查过iPhone SDK 4>)为了解决这个问题,您可以执行以下操作。
It seems this method does not work on the iPad (I havent checked iPhone SDK 4>) so in order to get round it you can do the following.
将视频添加到全屏后,您可以将控件直接添加到UIWindow(例如 [[[[UIApplication sharedApplication] windows] objectAtIndex:0] addSubView:myView]
),它们将显示在您的视频视频之上。
After adding your video and setting to fullscreen you can add your controls directly to the UIWindow (e.g. [[[[UIApplication sharedApplication] windows] objectAtIndex:0] addSubView:myView]
), they will then appear on top of your video video.
我发现的唯一问题是它们不遵守视图的方向规则,我手动必须在 willRotateToInterfaceOrientation中编写旋转代码
视图方法。
The only problem I have found with this is that they don't obey the orientation rules of the view and I have manually had to program the rotation code in the willRotateToInterfaceOrientation
method of the view.
这篇关于无法在SDK 4.1中向MPMoviePlayerController添加叠加层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!