From 2e4f60d4645d0e0e2fc1bcb41b16547525a7aff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marin=CC=83o?= Date: Mon, 15 Jul 2019 10:12:21 +0200 Subject: [PATCH 1/2] call callbacks when fullscreen is changed via controls --- ios/Video/RCTVideo.m | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index 4710afaa5a..841178e32a 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -704,7 +704,27 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N if (!CGRectEqualToRect(oldRect, newRect)) { if (CGRectEqualToRect(newRect, [UIScreen mainScreen].bounds)) { NSLog(@"in fullscreen"); - } else NSLog(@"not fullscreen"); + if (!_fullscreenPlayerPresented) { + _fullscreenPlayerPresented = YES; + if(self.onVideoFullscreenPlayerWillPresent) { + self.onVideoFullscreenPlayerWillPresent(@{@"target": self.reactTag}); + } + if(self.onVideoFullscreenPlayerDidPresent) { + self.onVideoFullscreenPlayerDidPresent(@{@"target": self.reactTag}); + } + } + } else { + NSLog(@"not fullscreen"); + if (_fullscreenPlayerPresented) { + _fullscreenPlayerPresented = NO; + if(self.onVideoFullscreenPlayerWillDismiss) { + self.onVideoFullscreenPlayerWillDismiss(@{@"target": self.reactTag}); + } + if(self.onVideoFullscreenPlayerDidDismiss) { + self.onVideoFullscreenPlayerDidDismiss(@{@"target": self.reactTag}); + } + } + } [self.reactViewController.view setFrame:[UIScreen mainScreen].bounds]; [self.reactViewController.view setNeedsLayout]; From f5428a2e61afc9448744fc179855e13a01d9cac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marin=CC=83o?= Date: Mon, 15 Jul 2019 10:12:42 +0200 Subject: [PATCH 2/2] make sure controls is set --- ios/Video/RCTVideo.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index 841178e32a..fe319992bd 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -704,7 +704,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N if (!CGRectEqualToRect(oldRect, newRect)) { if (CGRectEqualToRect(newRect, [UIScreen mainScreen].bounds)) { NSLog(@"in fullscreen"); - if (!_fullscreenPlayerPresented) { + if (!_fullscreenPlayerPresented && _controls) { _fullscreenPlayerPresented = YES; if(self.onVideoFullscreenPlayerWillPresent) { self.onVideoFullscreenPlayerWillPresent(@{@"target": self.reactTag}); @@ -715,7 +715,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } } else { NSLog(@"not fullscreen"); - if (_fullscreenPlayerPresented) { + if (_fullscreenPlayerPresented && _controls) { _fullscreenPlayerPresented = NO; if(self.onVideoFullscreenPlayerWillDismiss) { self.onVideoFullscreenPlayerWillDismiss(@{@"target": self.reactTag});