1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30
yattee/Shared/Player/AppleAVPlayerView.swift

28 lines
837 B
Swift
Raw Normal View History

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()
PlayerModel.shared.avPlayerBackend.controller = controller
2022-08-21 02:35:40 +05:30
return controller
}
func updateUIViewController(_: AppleAVPlayerViewController, context _: Context) {
PlayerModel.shared.rebuildTVMenu()
2022-08-21 02:35:40 +05:30
}
}
#endif