fix(tvos): build (#4511)

This commit is contained in:
Kamil Moskała
2025-04-14 15:47:15 +02:00
committed by GitHub
parent ab8ec0699b
commit 40340467d7
2 changed files with 14 additions and 12 deletions
+13 -11
View File
@@ -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 }
+1 -1
View File
@@ -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)
}