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

32 lines
606 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 {
Task {
2021-06-11 04:20:10 +05:30
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
}