I have got a UIViewController
in my app with a UIWebView
in it. The UIWebView
is fixed-size and configured to open any links in a new UIViewController
(browser). This works, but when I try clicking a video like YouTube or Vimeo from within the web view, it opens on top of the view controller. This would normally not be a problem, but I have an overlapping view that needs to get a message to move out of the way when this happens.
Is there a notification or any other way my view controller can get notified when a media player pops out of the UIWebView
? I really need this to work better, because it's really ugly the way it currently is.
Thanks!
From: http://www.alexcurylo.com/blog/2009/08/24/snippet-playing-youtube-videos/
Unfortunately, there’s no kind of direct control or notifications of loading, progress, quitting, etc. However, you can get some indirect notifications based on your application’s window state: add in your view controller
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowVisible:)
name:UIWindowDidBecomeVisibleNotification
object:self.view.window
];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowHidden:)
name:UIWindowDidBecomeHiddenNotification
object:self.view.window
];
to get these called when the YouTube window is shown and goes away respectively.
- (void)windowNowVisible:(NSNotification *)notification
{
NSLog(@"Youtube/ Media window appears");
}
- (void)windowNowHidden:(NSNotification *)notification
{
NSLog(@"Youtube/ Media window disappears.");
}
and hey, if that’s all you require by way of notification you’re good!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With