1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 14:20:32 +05:30
yattee/Apple TV/PlayerView.swift

32 lines
607 B
Swift
Raw Normal View History

2021-06-11 04:20:10 +05:30
import AVKit
import Foundation
import SwiftUI
struct PlayerView: View {
2021-06-11 05:35:59 +05:30
@ObservedObject private var provider: VideoDetailsProvider
init(id: String) {
provider = VideoDetailsProvider(id)
}
2021-06-11 04:20:10 +05:30
var body: some View {
2021-06-17 00:42:41 +05:30
VStack {
pvc?
.edgesIgnoringSafeArea(.all)
2021-06-11 04:20:10 +05:30
}
.task {
async {
provider.load()
}
}
}
2021-06-17 00:42:41 +05:30
var pvc: PlayerViewController? {
guard provider.video != nil else {
return nil
}
return PlayerViewController(video: provider.video!)
}
2021-06-11 04:20:10 +05:30
}