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