fix: issue 3040, prevent crash

This commit is contained in:
Cedric Guinoiseau 2023-07-06 09:37:02 +02:00
parent 12d7dd6d8b
commit d526479fe0

View File

@ -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