Merge pull request #2971 from somersets/fix/ios_crash_presentFullScreenPlayer

Fix(ios): crash present full screen player
This commit is contained in:
Olivier Bouillet 2023-01-02 21:28:09 +01:00 committed by GitHub
commit 5b0fd0e585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -8,6 +8,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)

View File

@ -324,7 +324,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
"target": self.reactTag
])
}.catch{_ in }
_videoLoadStarted = true
self._videoLoadStarted = true
}
}
@ -635,7 +635,8 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
self.onVideoFullscreenPlayerWillPresent?(["target": reactTag as Any])
viewController.present(viewController, animated:true, completion:{
if let playerViewController = _playerViewController {
viewController.present(playerViewController, animated:true, completion:{
self._playerViewController?.showsPlaybackControls = true
self._fullscreenPlayerPresented = fullscreen
self._playerViewController?.autorotate = self._fullscreenAutorotate
@ -644,6 +645,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
})
}
}
} else if !fullscreen && _fullscreenPlayerPresented, let _playerViewController = _playerViewController {
self.videoPlayerViewControllerWillDismiss(playerViewController: _playerViewController)
_presentingViewController?.dismiss(animated: true, completion:{