eiprol eiprol - 8 months ago 66
iOS Question

Detect when a webview video becomes fullscreen on ios8

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.

I used to use this:

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

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

However, since iOS8, I can't achieve this, 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)

Any idea of what have changed?

Answer Source

This is the work around I found for this..

[[NSNotificationCenter defaultCenter] addObserver:self

[[NSNotificationCenter defaultCenter] addObserver:self