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.
Asked
Active
Viewed 1,840 times
2
-
Ca you post some example code ? – JFPicard Apr 19 '15 at 18:36
-
I think you can try for MPMoviePlayer notifications. YTPlayer have play, pause & stop methods. – Uttam Sinha Apr 19 '15 at 18:48
-
UIWindowDidBecomeHiddenNotification RF:http://stackoverflow.com/a/26068475/1083128 – Mia Jun 30 '15 at 06:05
1 Answers
15
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.

keepsmiling
- 370
- 1
- 13