mirror of
https://github.com/yattee/yattee.git
synced 2024-11-14 01:58:24 +00:00
27 lines
780 B
Swift
27 lines
780 B
Swift
import AVKit
|
|
import Defaults
|
|
import SwiftUI
|
|
|
|
#if os(iOS)
|
|
struct AppleAVPlayerView: UIViewRepresentable {
|
|
func makeUIView(context _: Context) -> some UIView {
|
|
PlayerLayerView(frame: .zero)
|
|
}
|
|
|
|
func updateUIView(_: UIViewType, context _: Context) {}
|
|
}
|
|
#else
|
|
struct AppleAVPlayerView: UIViewControllerRepresentable {
|
|
func makeUIViewController(context _: Context) -> AppleAVPlayerViewController {
|
|
let controller = AppleAVPlayerViewController()
|
|
PlayerModel.shared.avPlayerBackend.controller = controller
|
|
|
|
return controller
|
|
}
|
|
|
|
func updateUIViewController(_: AppleAVPlayerViewController, context _: Context) {
|
|
PlayerModel.shared.rebuildTVMenu()
|
|
}
|
|
}
|
|
#endif
|