Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes crash in iOS 13.6 iPhone 11 #15

Open
wants to merge 1 commit into
base: feature/ios-track-fullscreen-controls
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions ios/Video/RCTVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,15 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N

if (!CGRectEqualToRect(oldRect, newRect)) {
if (CGRectEqualToRect(newRect, [UIScreen mainScreen].bounds)) {
NSLog(@"in fullscreen");
if (!_fullscreenPlayerPresented && _controls) {
_fullscreenPlayerPresented = YES;
bool shouldFire = !_fullscreenPlayerPresented;

dispatch_async(dispatch_get_main_queue(), ^{
if (shouldFire) {
_fullscreenPlayerPresented = YES;
}
});

if (shouldFire) {
if(self.onVideoFullscreenPlayerWillPresent) {
self.onVideoFullscreenPlayerWillPresent(@{@"target": self.reactTag});
}
Expand All @@ -714,9 +720,15 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
}
} else {
NSLog(@"not fullscreen");
if (_fullscreenPlayerPresented && _controls) {
_fullscreenPlayerPresented = NO;
bool shouldFire = _fullscreenPlayerPresented;

dispatch_async(dispatch_get_main_queue(), ^{
if (shouldFire) {
_fullscreenPlayerPresented = NO;
}
});

if (shouldFire) {
if(self.onVideoFullscreenPlayerWillDismiss) {
self.onVideoFullscreenPlayerWillDismiss(@{@"target": self.reactTag});
}
Expand Down