mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Fix various issues
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct AppleAVPlayerView: NSViewRepresentable {
|
||||
func makeNSView(context _: Context) -> some NSView {
|
||||
PlayerLayerView(frame: .zero)
|
||||
}
|
||||
|
||||
func updateNSView(_: NSViewType, context _: Context) {}
|
||||
}
|
34
macOS/MacOSPiPDelegate.swift
Normal file
34
macOS/MacOSPiPDelegate.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
import AVKit
|
||||
import Foundation
|
||||
|
||||
final class MacOSPiPDelegate: NSObject, AVPlayerViewPictureInPictureDelegate {
|
||||
var playerModel: PlayerModel { .shared }
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user