Hello, mpv! 🎉

This commit is contained in:
Arkadiusz Fal
2022-02-16 21:23:11 +01:00
parent 48ab8b27c8
commit 0a36870480
75 changed files with 6516 additions and 932 deletions

27
macOS/AVPlayerView.swift Normal file
View File

@@ -0,0 +1,27 @@
import Defaults
import SwiftUI
struct AVPlayerView: NSViewControllerRepresentable {
@EnvironmentObject<PlayerModel> private var player
@State private var controller: AVPlayerViewController?
init(controller: AVPlayerViewController? = nil) {
self.controller = controller
}
func makeNSViewController(context _: Context) -> AVPlayerViewController {
if self.controller != nil {
return self.controller!
}
let controller = AVPlayerViewController()
controller.playerModel = player
player.controller = controller
return controller
}
func updateNSViewController(_: AVPlayerViewController, context _: Context) {}
}