mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-27 16:42:41 +00:00
fix(tvos): build (#4511)
This commit is contained in:
@@ -322,19 +322,21 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate, AVPla
|
||||
_restoreUserInterfaceForPIPStopCompletionHandler = completionHandler
|
||||
}
|
||||
|
||||
func playerViewController(
|
||||
_: AVPlayerViewController,
|
||||
willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||
) {
|
||||
// iOS automatically pauses videos after exiting fullscreen,
|
||||
// but it's better if we resume playback
|
||||
let wasPlaying = player?.timeControlStatus == .playing
|
||||
#if !os(tvOS)
|
||||
func playerViewController(
|
||||
_: AVPlayerViewController,
|
||||
willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||
) {
|
||||
// iOS automatically pauses videos after exiting fullscreen,
|
||||
// but it's better if we resume playback
|
||||
let wasPlaying = player?.timeControlStatus == .playing
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { [weak self] context in
|
||||
guard let self, !context.isCancelled, wasPlaying else { return }
|
||||
self.player?.play()
|
||||
coordinator.animate(alongsideTransition: nil) { [weak self] context in
|
||||
guard let self, !context.isCancelled, wasPlaying else { return }
|
||||
self.player?.play()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func setRestoreUserInterfaceForPIPStopCompletionHandler(_ restore: Bool) {
|
||||
guard let _restoreUserInterfaceForPIPStopCompletionHandler else { return }
|
||||
|
||||
@@ -1167,7 +1167,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
viewController.player = player
|
||||
|
||||
// Set the initial playback speed in controls to match playback rate
|
||||
if #available(iOS 16.0, *) {
|
||||
if #available(iOS 16.0, tvOS 16.0, *) {
|
||||
if let initialSpeed = viewController.speeds.first(where: { $0.rate == _rate }) {
|
||||
viewController.selectSpeed(initialSpeed)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user