mirror of
https://github.com/yattee/yattee.git
synced 2025-01-06 01:20:31 +05:30
Fix build on tvOS
This commit is contained in:
parent
7b9bbd8974
commit
7e7225c59f
@ -15,8 +15,8 @@ import SwiftUI
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
func playerViewController(_: AVPlayerViewController, willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator) {
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
|
func playerViewController(_: AVPlayerViewController, willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator) {
|
||||||
guard rotateToLandscapeOnEnterFullScreen.isRotating else { return }
|
guard rotateToLandscapeOnEnterFullScreen.isRotating else { return }
|
||||||
if PlayerModel.shared.currentVideoIsLandscape {
|
if PlayerModel.shared.currentVideoIsLandscape {
|
||||||
let delay = PlayerModel.shared.activeBackend == .appleAVPlayer && avPlayerUsesSystemControls ? 0.8 : 0
|
let delay = PlayerModel.shared.activeBackend == .appleAVPlayer && avPlayerUsesSystemControls ? 0.8 : 0
|
||||||
@ -27,17 +27,14 @@ import SwiftUI
|
|||||||
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: orientation)
|
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: orientation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func playerViewController(_: AVPlayerViewController, willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator) {
|
func playerViewController(_: AVPlayerViewController, willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator) {
|
||||||
let wasPlaying = player.isPlaying
|
let wasPlaying = player.isPlaying
|
||||||
coordinator.animate(alongsideTransition: nil) { context in
|
coordinator.animate(alongsideTransition: nil) { context in
|
||||||
#if os(iOS)
|
|
||||||
if wasPlaying {
|
if wasPlaying {
|
||||||
self.player.play()
|
self.player.play()
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if !context.isCancelled {
|
if !context.isCancelled {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
self.player.lockedOrientation = nil
|
self.player.lockedOrientation = nil
|
||||||
@ -56,6 +53,15 @@ import SwiftUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func playerViewController(_: AVPlayerViewController, restoreUserInterfaceForFullScreenExitWithCompletionHandler completionHandler: @escaping (Bool) -> Void) {
|
||||||
|
withAnimation(nil) {
|
||||||
|
player.presentingPlayer = true
|
||||||
|
}
|
||||||
|
|
||||||
|
completionHandler(true)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
func playerViewControllerWillStartPictureInPicture(_: AVPlayerViewController) {}
|
func playerViewControllerWillStartPictureInPicture(_: AVPlayerViewController) {}
|
||||||
|
|
||||||
func playerViewControllerWillStopPictureInPicture(_: AVPlayerViewController) {}
|
func playerViewControllerWillStopPictureInPicture(_: AVPlayerViewController) {}
|
||||||
@ -86,14 +92,6 @@ import SwiftUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func playerViewController(_: AVPlayerViewController, restoreUserInterfaceForFullScreenExitWithCompletionHandler completionHandler: @escaping (Bool) -> Void) {
|
|
||||||
withAnimation(nil) {
|
|
||||||
player.presentingPlayer = true
|
|
||||||
}
|
|
||||||
|
|
||||||
completionHandler(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ extension AppleAVPlayerViewController: AVPlayerViewControllerDelegate {
|
|||||||
|
|
||||||
func playerViewControllerDidEndDismissalTransition(_: AVPlayerViewController) {}
|
func playerViewControllerDidEndDismissalTransition(_: AVPlayerViewController) {}
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
func playerViewController(
|
func playerViewController(
|
||||||
_: AVPlayerViewController,
|
_: AVPlayerViewController,
|
||||||
willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator
|
willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator
|
||||||
@ -102,6 +103,7 @@ extension AppleAVPlayerViewController: AVPlayerViewControllerDelegate {
|
|||||||
_: AVPlayerViewController,
|
_: AVPlayerViewController,
|
||||||
willEndFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator
|
willEndFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator
|
||||||
) {}
|
) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
func playerViewController(
|
func playerViewController(
|
||||||
_: AVPlayerViewController,
|
_: AVPlayerViewController,
|
||||||
|
Loading…
Reference in New Issue
Block a user