1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 14:50:32 +05:30
yattee/Shared/Player/AVPlayerView.swift

26 lines
849 B
Swift
Raw Normal View History

2021-09-25 13:48:22 +05:30
import Defaults
2021-07-19 04:02:46 +05:30
import SwiftUI
2022-02-17 01:53:11 +05:30
struct AVPlayerView: UIViewControllerRepresentable {
2021-12-05 01:05:41 +05:30
@EnvironmentObject<CommentsModel> private var comments
2021-10-28 22:44:55 +05:30
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlayerModel> private var player
2021-12-18 01:31:05 +05:30
@EnvironmentObject<SubscriptionsModel> private var subscriptions
2021-08-24 03:01:51 +05:30
2022-02-17 01:53:11 +05:30
func makeUIViewController(context _: Context) -> UIViewController {
let controller = AppleAVPlayerViewController()
2021-08-23 00:43:33 +05:30
2021-12-05 01:05:41 +05:30
controller.commentsModel = comments
2021-10-28 22:44:55 +05:30
controller.navigationModel = navigation
controller.playerModel = player
2021-12-18 01:31:05 +05:30
controller.subscriptionsModel = subscriptions
2022-02-17 01:53:11 +05:30
player.avPlayerBackend.controller = controller
2021-07-19 04:02:46 +05:30
return controller
}
2022-02-17 01:53:11 +05:30
func updateUIViewController(_: UIViewController, context _: Context) {
2021-10-25 03:56:25 +05:30
player.rebuildTVMenu()
}
2021-07-19 04:02:46 +05:30
}