mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
28 lines
837 B
Swift
28 lines
837 B
Swift
import AVKit
|
|
import Defaults
|
|
import SwiftUI
|
|
|
|
#if os(iOS)
|
|
struct AppleAVPlayerView: UIViewRepresentable {
|
|
func makeUIView(context _: Context) -> some UIView {
|
|
let playerLayerView = PlayerLayerView(frame: .zero)
|
|
return playerLayerView
|
|
}
|
|
|
|
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
|