From 504ec387bf8250ad33e85102f7cd129ce3fd790d Mon Sep 17 00:00:00 2001 From: Nikita Likhachev Date: Thu, 22 Dec 2022 13:07:06 +0700 Subject: [PATCH 1/3] iOS app crashes on call to presentFullScreenPlayer #2808 --- ios/Video/RCTVideo.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 769baba7..9bcf237a 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -635,14 +635,16 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH self.onVideoFullscreenPlayerWillPresent?(["target": reactTag as Any]) - viewController.present(viewController, animated:true, completion:{ - self._playerViewController?.showsPlaybackControls = true - self._fullscreenPlayerPresented = fullscreen - self._playerViewController?.autorotate = self._fullscreenAutorotate + if let playerViewController = _playerViewController { + viewController.present(playerViewController, animated:true, completion:{ + self._playerViewController?.showsPlaybackControls = true + self._fullscreenPlayerPresented = fullscreen + self._playerViewController?.autorotate = self._fullscreenAutorotate - self.onVideoFullscreenPlayerDidPresent?(["target": self.reactTag]) + self.onVideoFullscreenPlayerDidPresent?(["target": self.reactTag]) - }) + }) + } } } else if !fullscreen && _fullscreenPlayerPresented, let _playerViewController = _playerViewController { self.videoPlayerViewControllerWillDismiss(playerViewController: _playerViewController) From 603b851d5f2b6082738ad4eaa1f5ea86f18efaa0 Mon Sep 17 00:00:00 2001 From: Nikita Likhachev Date: Thu, 22 Dec 2022 13:17:33 +0700 Subject: [PATCH 2/3] fix reference self. explicitly --- ios/Video/RCTVideo.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 9bcf237a..8f3b0e78 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -324,7 +324,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH "target": self.reactTag ]) }.catch{_ in } - _videoLoadStarted = true + self._videoLoadStarted = true } } From 045f51eddb9cbb70856bd6f462b0245095cf98ec Mon Sep 17 00:00:00 2001 From: Nikita Likhachev Date: Thu, 22 Dec 2022 14:00:04 +0700 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 895b1bd7..d2244955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Version 6.0.0-alpha.4 +- Fix: iOS app crashes on call to presentFullScreenPlayer [#2808](https://github.com/react-native-video/react-native-video/pull/2971) - ensure src is always provided to native player even if it is invalid [#2857](https://github.com/react-native-video/react-native-video/pull/2857) - Sample: Add react-native-video controls support [#2852](https://github.com/react-native-video/react-native-video/pull/2852) - Android: Switch Google's maven repository to default `google()` [#2860](https://github.com/react-native-video/react-native-video/pull/2860)