mirror of
https://github.com/yattee/yattee.git
synced 2025-10-16 04:18:13 +00:00
PiP and UI improvements
This commit is contained in:
28
macOS/PictureInPictureDelegate.swift
Normal file
28
macOS/PictureInPictureDelegate.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
import AVKit
|
||||
import Foundation
|
||||
|
||||
final class PictureInPictureDelegate: NSObject, AVPlayerViewPictureInPictureDelegate {
|
||||
var playerModel: PlayerModel!
|
||||
|
||||
func playerViewShouldAutomaticallyDismissAtPicture(inPictureStart _: AVPlayerView) -> Bool {
|
||||
false
|
||||
}
|
||||
|
||||
func playerViewWillStartPicture(inPicture _: AVPlayerView) {
|
||||
playerModel.playingInPictureInPicture = true
|
||||
playerModel.presentingPlayer = false
|
||||
}
|
||||
|
||||
func playerViewWillStopPicture(inPicture _: AVPlayerView) {
|
||||
playerModel.playingInPictureInPicture = false
|
||||
playerModel.presentPlayer()
|
||||
}
|
||||
|
||||
func playerView(
|
||||
_: AVPlayerView,
|
||||
restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: (Bool) -> Void
|
||||
) {
|
||||
playerModel.presentingPlayer = true
|
||||
completionHandler(true)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user