mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Animations improvements
This commit is contained in:
@@ -9,7 +9,7 @@ import SwiftUI
|
||||
|
||||
final class MPVBackend: PlayerBackend {
|
||||
static var controlsUpdateInterval = 0.5
|
||||
static var networkStateUpdateInterval = 0.3
|
||||
static var networkStateUpdateInterval = 1.0
|
||||
|
||||
private var logger = Logger(label: "mpv-backend")
|
||||
|
||||
|
@@ -225,15 +225,13 @@ final class PlayerModel: ObservableObject {
|
||||
}
|
||||
#endif
|
||||
|
||||
navigation.hideKeyboard()
|
||||
|
||||
if !presentingPlayer {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
withAnimation(.linear(duration: 0.25)) {
|
||||
self?.presentingPlayer = true
|
||||
}
|
||||
#if os(iOS)
|
||||
Delay.by(0.5) {
|
||||
self.navigation.hideKeyboard()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if !presentingPlayer { presentingPlayer = true }
|
||||
|
||||
#if os(macOS)
|
||||
Windows.player.open()
|
||||
@@ -241,13 +239,17 @@ final class PlayerModel: ObservableObject {
|
||||
#endif
|
||||
}
|
||||
|
||||
func hide() {
|
||||
withAnimation(.linear(duration: 0.25)) {
|
||||
func hide(animate: Bool = true) {
|
||||
if animate {
|
||||
withAnimation(.easeOut(duration: 0.2)) {
|
||||
presentingPlayer = false
|
||||
}
|
||||
} else {
|
||||
presentingPlayer = false
|
||||
}
|
||||
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.playingFullScreen = false
|
||||
self?.exitFullScreen(showControls: false)
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
@@ -591,9 +593,7 @@ final class PlayerModel: ObservableObject {
|
||||
exitFullScreen()
|
||||
|
||||
#if !os(macOS)
|
||||
if closePlayerOnItemClose {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in self?.hide() }
|
||||
}
|
||||
if closePlayerOnItemClose { Delay.by(0.2) { self.hide() } }
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user