fix: issue 2744, call replaceCurrentItem in dispatch thread

This commit is contained in:
Cedric Guinoiseau 2023-07-06 09:33:05 +02:00
parent 3bd032b720
commit 12d7dd6d8b

View File

@ -310,7 +310,10 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
}
self._player = self._player ?? AVPlayer()
self._player?.replaceCurrentItem(with: playerItem)
// https://github.com/react-native-video/react-native-video/issues/2744#issuecomment-1237459473
DispatchQueue.global(qos: .default).async { [weak self] in
self?._player?.replaceCurrentItem(with: playerItem)
}
self._playerObserver.player = self._player
self.applyModifiers()
self._player?.actionAtItemEnd = .none