PiP improvements

This commit is contained in:
Arkadiusz Fal
2022-08-19 00:40:46 +02:00
parent ace8c6e3ff
commit 6c6ba19df4
16 changed files with 120 additions and 162 deletions

View File

@@ -1,27 +1,16 @@
import Defaults
import SwiftUI
struct AppleAVPlayerView: NSViewControllerRepresentable {
struct AppleAVPlayerView: NSViewRepresentable {
@EnvironmentObject<PlayerModel> private var player
@State private var controller: AppleAVPlayerViewController?
func makeNSView(context _: Context) -> some NSView {
let playerLayerView = PlayerLayerView(frame: .zero)
init(controller: AppleAVPlayerViewController? = nil) {
self.controller = controller
playerLayerView.player = player
return playerLayerView
}
func makeNSViewController(context _: Context) -> AppleAVPlayerViewController {
if self.controller != nil {
return self.controller!
}
let controller = AppleAVPlayerViewController()
controller.playerModel = player
player.avPlayerBackend.controller = controller
return controller
}
func updateNSViewController(_: AppleAVPlayerViewController, context _: Context) {}
func updateNSView(_: NSViewType, context _: Context) {}
}