1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30

Improve animations

This commit is contained in:
Arkadiusz Fal 2022-05-30 21:00:53 +02:00
parent 3cb20452c7
commit 9d79543085
2 changed files with 12 additions and 3 deletions

View File

@ -43,11 +43,18 @@ final class PiPDelegate: NSObject, AVPictureInPictureControllerDelegate {
_: AVPictureInPictureController,
restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void
) {
var delay = 0.0
#if os(iOS)
if player.currentItem.isNil {
delay = 0.5
}
#endif
if !player.currentItem.isNil {
player?.show()
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
completionHandler(true)
}
}

View File

@ -206,9 +206,11 @@ final class PlayerModel: ObservableObject {
}
func play(_ video: Video, at time: CMTime? = nil, showingPlayer: Bool = true) {
pause()
var delay = 0.0
#if !os(macOS)
delay = 0.3
#if os(iOS)
delay = 0.5
#endif
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in