Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIWebView Embed video callbacks are not working in iOS8?

In my application I am loading some webpages embedded with Photos and Videos. Also I am using the following notifications to manage the player,

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

This is working fine in iOS7, but in iOS8 its not working. Any workarounds? Thanks in advance.

like image 541
christijk Avatar asked Sep 11 '14 07:09

christijk


1 Answers

This is one option, I have found.. The problem is that is not Will is DID become hidden..

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

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

If, I find a fix for the second notification I will posted it.. :)

like image 199
valbu17 Avatar answered Oct 01 '22 17:10

valbu17