Reputation: 21
I am playing Youtube videos in YTPlayerView. Video playing well (Opening in AVFullScreenViewController). But, after click on 'DONE' button the video auto opening full screen(video time length is there.). How to handle that tap on 'DONE' button to stop / pause video.
Upvotes: 2
Views: 1867
Reputation: 370
Well, MPMoviePlayer notifications won't work, instead add the below notification to your AVFullScreenViewController :
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closedFullScreen:) name:UIWindowDidBecomeHiddenNotification object:nil];
-(void)closedFullScreen:(NSNotification *)myNotification{
//required stuff here like dismissing your AVFullScreenViewController
}
Once the Done button is clicked, this notification will be fired. Here you can stop the video, use the youtube video's time properties, or even dismiss your present controller to go back to any other/previous controller. Perhaps, for now, this is the only work around for getting the Done button action for ytplayerview.
Upvotes: 15