2022-05-20 21:23:14 +00:00
|
|
|
import AVKit
|
2021-09-25 08:18:22 +00:00
|
|
|
import Defaults
|
2021-07-18 22:32:46 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
2022-08-20 21:05:40 +00:00
|
|
|
#if os(iOS)
|
|
|
|
struct AppleAVPlayerView: UIViewRepresentable {
|
|
|
|
func makeUIView(context _: Context) -> some UIView {
|
2023-05-20 14:04:58 +00:00
|
|
|
PlayerLayerView()
|
2022-08-20 21:05:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func updateUIView(_: UIViewType, context _: Context) {}
|
2021-07-18 22:32:46 +00:00
|
|
|
}
|
2022-08-20 21:05:40 +00:00
|
|
|
#else
|
|
|
|
struct AppleAVPlayerView: UIViewControllerRepresentable {
|
|
|
|
func makeUIViewController(context _: Context) -> AppleAVPlayerViewController {
|
|
|
|
let controller = AppleAVPlayerViewController()
|
2022-11-24 20:36:05 +00:00
|
|
|
PlayerModel.shared.avPlayerBackend.controller = controller
|
2022-08-20 21:05:40 +00:00
|
|
|
|
|
|
|
return controller
|
|
|
|
}
|
|
|
|
|
|
|
|
func updateUIViewController(_: AppleAVPlayerViewController, context _: Context) {
|
2022-11-24 20:36:05 +00:00
|
|
|
PlayerModel.shared.rebuildTVMenu()
|
2022-08-20 21:05:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|