2
votes

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.

1
Ca you post some example code ?JFPicard
I think you can try for MPMoviePlayer notifications. YTPlayer have play, pause & stop methods.Uttam Sinha
UIWindowDidBecomeHiddenNotification RF:stackoverflow.com/a/26068475/1083128Mia

1 Answers

15
votes

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.