Skip to content

Commit

Permalink
fix crash on source change, if the app was put in bg beforehand (#4074)
Browse files Browse the repository at this point in the history
  • Loading branch information
blazlew authored Aug 22, 2024
1 parent 0a1085c commit b05201a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ios/Video/RCTVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,18 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
NowPlayingInfoCenterManager.shared.registerPlayer(player: _player!)
}
} 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)

if #available(iOS 16.0, *) {
self._playerViewController?.allowsVideoFrameAnalysis = true
}

// later we can just call "updateNowPlayingInfo:
NowPlayingInfoCenterManager.shared.updateNowPlayingInfo()
}
Expand Down

0 comments on commit b05201a

Please sign in to comment.