fix crash on source change, if the app was put in bg beforehand (#4074)

This commit is contained in:
Błażej Lewandowski 2024-08-22 10:30:23 +02:00 committed by GitHub
parent 0a1085ce03
commit b05201a9fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -488,8 +488,18 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
NowPlayingInfoCenterManager.shared.registerPlayer(player: _player!) NowPlayingInfoCenterManager.shared.registerPlayer(player: _player!)
} }
} else { } else {
if #available(iOS 16.0, *) {
// This feature caused crashes, if the app was put in bg, before the source change
// https://github.com/TheWidlarzGroup/react-native-video/issues/3900
self._playerViewController?.allowsVideoFrameAnalysis = false
}
_player?.replaceCurrentItem(with: playerItem) _player?.replaceCurrentItem(with: playerItem)
if #available(iOS 16.0, *) {
self._playerViewController?.allowsVideoFrameAnalysis = true
}
// later we can just call "updateNowPlayingInfo: // later we can just call "updateNowPlayingInfo:
NowPlayingInfoCenterManager.shared.updateNowPlayingInfo() NowPlayingInfoCenterManager.shared.updateNowPlayingInfo()
} }