1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30
yattee/Shared/Player/AVPlayerView.swift
Arkadiusz Fal 01f58b6458 Hello, mpv! 🎉
2022-08-15 16:33:54 +02:00

26 lines
849 B
Swift

import Defaults
import SwiftUI
struct AVPlayerView: UIViewControllerRepresentable {
@EnvironmentObject<CommentsModel> private var comments
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlayerModel> private var player
@EnvironmentObject<SubscriptionsModel> private var subscriptions
func makeUIViewController(context _: Context) -> UIViewController {
let controller = AppleAVPlayerViewController()
controller.commentsModel = comments
controller.navigationModel = navigation
controller.playerModel = player
controller.subscriptionsModel = subscriptions
player.avPlayerBackend.controller = controller
return controller
}
func updateUIViewController(_: UIViewController, context _: Context) {
player.rebuildTVMenu()
}
}