-1

In iOS 7, if i want to get UIWebView QuickTime "Done" event.

I can use NSNotification to get it.

This is my code.

 [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playerWillExitFullscreen:)
                                             name:@"UIMoviePlayerControllerWillExitFullscreenNotification"
                                           object:nil];
[_videoWebView loadRequest:[NSURLRequest requestWithURL:_contentURL]];

And use this function, i can get Done event in UIWebView.

- (void)playerWillExitFullscreen:(NSNotification *)notification

But in iOS 8, the notification is not work...(The notification name is hidden solution in iOS 7.)

So how can i get it(Done event) in iOS8 ?

1 Answers1

-1

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) name:UIWindowDidBecomeVisibleNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeFinished:) name:UIWindowDidBecomeHiddenNotification object:nil];

-(void)youTubeStarted:(NSNotification *)notification { // Entered Fullscreen code goes here.. AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; appDelegate.fullScreenVideoIsPlaying = YES; NSLog(@"%f %f",webViewForWebSite.frame.origin.x,webViewForWebSite.frame.origin.y);

}

-(void)youTubeFinished:(NSNotification *)notification{ // Left fullscreen code goes here... AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; appDelegate.fullScreenVideoIsPlaying = NO;

//CODE BELOW FORCES APP BACK TO PORTRAIT ORIENTATION ONCE YOU LEAVE VIDEO.
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
//present/dismiss viewcontroller in order to activate rotating.
UIViewController *mVC = [[UIViewController alloc] init];
[self presentViewController:mVC animated:NO completion:Nil];
//  [self presentModalViewController:mVC animated:NO];
[self dismissViewControllerAnimated:NO completion:Nil];
//   [self dismissModalViewControllerAnimated:NO];

}