1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 14:50: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, _: AVPictureInPictureController,
restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void
) { ) {
var delay = 0.0
#if os(iOS)
if player.currentItem.isNil {
delay = 0.5
}
#endif
if !player.currentItem.isNil { if !player.currentItem.isNil {
player?.show() player?.show()
} }
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
completionHandler(true) completionHandler(true)
} }
} }

View File

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