This commit is contained in:
PierluigiCod 2023-01-23 16:49:46 +01:00
parent 1e9f2e1492
commit 36af01cc7b

View File

@ -243,6 +243,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
} }
self.removePlayerLayer() self.removePlayerLayer()
self._playerObserver.player = nil self._playerObserver.player = nil
self._resouceLoaderDelegate = nil
self._playerObserver.playerItem = nil self._playerObserver.playerItem = nil
// perform on next run loop, otherwise other passed react-props may not be set // perform on next run loop, otherwise other passed react-props may not be set
@ -750,7 +751,6 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
} }
func removePlayerLayer() { func removePlayerLayer() {
_resouceLoaderDelegate = nil
_playerLayer?.removeFromSuperlayer() _playerLayer?.removeFromSuperlayer()
_playerLayer = nil _playerLayer = nil
_playerObserver.playerLayer = nil _playerObserver.playerLayer = nil
@ -882,6 +882,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
override func removeFromSuperview() { override func removeFromSuperview() {
_player?.pause() _player?.pause()
_player = nil _player = nil
_resouceLoaderDelegate = nil
_playerObserver.clearPlayer() _playerObserver.clearPlayer()
self.removePlayerLayer() self.removePlayerLayer()