2022-05-21 02:53:14 +05:30
|
|
|
import AVKit
|
2021-09-25 13:48:22 +05:30
|
|
|
import Defaults
|
2021-07-19 04:02:46 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
2022-08-21 02:35:40 +05:30
|
|
|
#if os(iOS)
|
|
|
|
struct AppleAVPlayerView: UIViewRepresentable {
|
|
|
|
func makeUIView(context _: Context) -> some UIView {
|
|
|
|
let playerLayerView = PlayerLayerView(frame: .zero)
|
|
|
|
return playerLayerView
|
|
|
|
}
|
|
|
|
|
|
|
|
func updateUIView(_: UIViewType, context _: Context) {}
|
2021-07-19 04:02:46 +05:30
|
|
|
}
|
2022-08-21 02:35:40 +05:30
|
|
|
#else
|
|
|
|
struct AppleAVPlayerView: UIViewControllerRepresentable {
|
|
|
|
func makeUIViewController(context _: Context) -> AppleAVPlayerViewController {
|
|
|
|
let controller = AppleAVPlayerViewController()
|
2022-11-25 02:06:05 +05:30
|
|
|
PlayerModel.shared.avPlayerBackend.controller = controller
|
2022-08-21 02:35:40 +05:30
|
|
|
|
|
|
|
return controller
|
|
|
|
}
|
|
|
|
|
|
|
|
func updateUIViewController(_: AppleAVPlayerViewController, context _: Context) {
|
2022-11-25 02:06:05 +05:30
|
|
|
PlayerModel.shared.rebuildTVMenu()
|
2022-08-21 02:35:40 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|