From 9fefa996f284338a9efe4237016f571b080073dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Chmiela?= Date: Fri, 1 Apr 2016 10:51:31 +0200 Subject: [PATCH] Use the delegate in controller --- RCTVideoPlayerViewController.h | 3 ++- RCTVideoPlayerViewController.m | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/RCTVideoPlayerViewController.h b/RCTVideoPlayerViewController.h index aac5e026..fc2675fc 100644 --- a/RCTVideoPlayerViewController.h +++ b/RCTVideoPlayerViewController.h @@ -8,7 +8,8 @@ #import #import "RCTVideo.h" +#import "RCTVideoPlayerViewControllerDelegate.h" @interface RCTVideoPlayerViewController : AVPlayerViewController -@property (nonatomic, weak) id rctVideoView; +@property (nonatomic, weak) id rctDelegate; @end diff --git a/RCTVideoPlayerViewController.m b/RCTVideoPlayerViewController.m index 118180a7..b1b768d7 100644 --- a/RCTVideoPlayerViewController.m +++ b/RCTVideoPlayerViewController.m @@ -14,9 +14,15 @@ @implementation RCTVideoPlayerViewController -- (IBAction)close:(id)sender +- (void)viewDidDisappear:(BOOL)animated { - [self.rctVideoView setFullscreen:false]; + [super viewDidDisappear:animated]; + [_rctDelegate videoPlayerViewControllerDidDismiss:self]; +} + +- (void)viewWillDisappear:(BOOL)animated { + [_rctDelegate videoPlayerViewControllerWillDismiss:self]; + [super viewWillDisappear:animated]; } @end