1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 06:40:32 +05:30
yattee/Apple TV/PlayerView.swift
Arkadiusz Fal 0e02a6e25a Cells view
2021-06-25 00:13:27 +02:00

32 lines
611 B
Swift

import AVKit
import Foundation
import SwiftUI
struct PlayerView: View {
@ObservedObject private var provider: VideoDetailsProvider
init(id: String) {
provider = VideoDetailsProvider(id)
}
var body: some View {
VStack {
pvc?
.edgesIgnoringSafeArea(.all)
}
.task {
Task.init {
provider.load()
}
}
}
var pvc: PlayerViewController? {
guard provider.video != nil else {
return nil
}
return PlayerViewController(video: provider.video!)
}
}