mirror of
https://github.com/yattee/yattee.git
synced 2025-10-11 01:48:12 +00:00
simplified fullscreen and orientation handling
- iPad: rotate to device orientation on startup - fixed controls in portrait fullscreen - iOS: don’t call setNeedsDrawing multiple times - On iOS we call set needs drawing only once. - Added cooldown time to MPV.Client setNeedsDrawing to avoid multiple successive calls - make fullscreen animation smoother - dragGesture now calls toggleFullScreenAction - fix tvOS and macOS build Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
@@ -17,12 +17,11 @@ import SwiftUI
|
||||
|
||||
#if os(iOS)
|
||||
func playerViewController(_: AVPlayerViewController, willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator) {
|
||||
guard rotateToLandscapeOnEnterFullScreen.isRotating else { return }
|
||||
if PlayerModel.shared.currentVideoIsLandscape {
|
||||
let delay = PlayerModel.shared.activeBackend == .appleAVPlayer && avPlayerUsesSystemControls ? 0.8 : 0
|
||||
// not sure why but first rotation call is ignore so doing rotate to same orientation first
|
||||
Delay.by(delay) {
|
||||
let orientation = OrientationTracker.shared.currentDeviceOrientation.isLandscape ? OrientationTracker.shared.currentInterfaceOrientation : self.rotateToLandscapeOnEnterFullScreen.interaceOrientation
|
||||
let orientation = OrientationTracker.shared.currentDeviceOrientation.isLandscape ? OrientationTracker.shared.currentInterfaceOrientation : self.rotateToLandscapeOnEnterFullScreen.interfaceOrientation
|
||||
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation)
|
||||
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: orientation)
|
||||
}
|
||||
@@ -37,8 +36,6 @@ import SwiftUI
|
||||
}
|
||||
if !context.isCancelled {
|
||||
#if os(iOS)
|
||||
self.player.lockedOrientation = nil
|
||||
|
||||
if Constants.isIPhone {
|
||||
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: .portrait)
|
||||
}
|
||||
|
Reference in New Issue
Block a user