From d526479fe0983cbd1aa1a4a6ab1dd1ba82e85bb7 Mon Sep 17 00:00:00 2001 From: Cedric Guinoiseau Date: Thu, 6 Jul 2023 09:37:02 +0200 Subject: [PATCH] fix: issue 3040, prevent crash --- ios/Video/RCTVideo.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 82a604f2..fbfd635b 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -665,6 +665,11 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH self.onVideoFullscreenPlayerWillPresent?(["target": reactTag as Any]) if let playerViewController = _playerViewController { + if(_controls) { + // prevents crash https://github.com/react-native-video/react-native-video/issues/3040 + self._playerViewController?.removeFromParent() + } + viewController.present(playerViewController, animated:true, completion:{ self._playerViewController?.showsPlaybackControls = self._controls self._fullscreenPlayerPresented = fullscreen