mirror of
https://github.com/yattee/yattee.git
synced 2024-11-09 15:58:20 +00:00
61a4951831
- player is now a separate window on macOS - add setting to disable pause when player is closed (fixes #40) - add PiP settings: * Close PiP when starting playing other video * Close PiP when player is opened * Close PiP and open player when application enters foreground (iOS/tvOS) (fixes #37) - new player placeholder when in PiP, context menu with exit option
28 lines
692 B
Swift
28 lines
692 B
Swift
import Defaults
|
|
import SwiftUI
|
|
|
|
struct Player: NSViewControllerRepresentable {
|
|
@EnvironmentObject<PlayerModel> private var player
|
|
|
|
@State private var controller: PlayerViewController?
|
|
|
|
init(controller: PlayerViewController? = nil) {
|
|
self.controller = controller
|
|
}
|
|
|
|
func makeNSViewController(context _: Context) -> PlayerViewController {
|
|
if self.controller != nil {
|
|
return self.controller!
|
|
}
|
|
|
|
let controller = PlayerViewController()
|
|
|
|
controller.playerModel = player
|
|
player.controller = controller
|
|
|
|
return controller
|
|
}
|
|
|
|
func updateNSViewController(_: PlayerViewController, context _: Context) {}
|
|
}
|