mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
@@ -1,34 +0,0 @@
|
||||
import AVKit
|
||||
import Foundation
|
||||
|
||||
final class PictureInPictureDelegate: NSObject, AVPlayerViewPictureInPictureDelegate {
|
||||
var playerModel: PlayerModel!
|
||||
|
||||
func playerViewShouldAutomaticallyDismissAtPicture(inPictureStart _: AVPlayerView) -> Bool {
|
||||
false
|
||||
}
|
||||
|
||||
func playerViewWillStartPicture(inPicture _: AVPlayerView) {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
||||
self?.playerModel.playingInPictureInPicture = true
|
||||
self?.playerModel.hide()
|
||||
}
|
||||
}
|
||||
|
||||
func playerViewWillStopPicture(inPicture _: AVPlayerView) {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
||||
self?.playerModel.playingInPictureInPicture = false
|
||||
self?.playerModel.show()
|
||||
}
|
||||
}
|
||||
|
||||
func playerView(
|
||||
_: AVPlayerView,
|
||||
restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: (Bool) -> Void
|
||||
) {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
||||
self?.playerModel.show()
|
||||
}
|
||||
completionHandler(true)
|
||||
}
|
||||
}
|
@@ -47,9 +47,17 @@ enum Windows: String, CaseIterable {
|
||||
}
|
||||
}
|
||||
|
||||
func hide() {
|
||||
window?.close()
|
||||
}
|
||||
|
||||
func toggleFullScreen() {
|
||||
window?.toggleFullScreen(nil)
|
||||
}
|
||||
|
||||
var visible: Bool {
|
||||
window?.isVisible ?? false
|
||||
}
|
||||
}
|
||||
|
||||
struct HostingWindowFinder: NSViewRepresentable {
|
||||
|
Reference in New Issue
Block a user