检测webview视频何时在ios8上变为全屏 [英] Detect when a webview video becomes fullscreen on ios8

查看:129
本文介绍了检测webview视频何时在ios8上变为全屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,用户可以从UIWebview打开视频,包括Youtube。
在iOS7中,我能够在开始播放时或在全屏播放时收到通知,这对我向用户显示某些选项和修改界面至关重要。

I have an app where users can open videos from UIWebview, including Youtube ones. In iOS7, I was able to get a notification when it started playing, or when it became full screen, which is vital for me to show certain options to the user and modify the interface.

我曾经使用过:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(VideoExitFullScreen:) name:@"UIMoviePlayerControllerDidExitFullscreenNotification" object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(VideoEnterFullScreen:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];

然而,自iOS8以来,我无法实现这一目标。这就像是不再从UIWebview视频触发通知。但是,正如我测试的那样,它仍然是从普通视频,非Webview触发的。

However, since iOS8, I can't achieve this. It is like the notification is no longer triggered from UIWebview videos. However, it is still triggered from normal videos, non-Webview, as I've tested.

知道发生了哪些变化?

推荐答案

这是我为此找到的工作..

This is the work around I found for this..

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(VideoExitFullScreen:)
                                                 name:UIWindowDidBecomeVisibleNotification
                                               object:self.view.window];

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(VideoEnterFullScreen:)
                                                 name:UIWindowDidBecomeHiddenNotification
                                               object:self.view.window];

这篇关于检测webview视频何时在ios8上变为全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆