yattee/Apple TV/PlayerView.swift

26 lines
522 B
Swift
Raw Normal View History

2021-06-10 22:50:10 +00:00
import AVKit
import Foundation
import SwiftUI
struct PlayerView: View {
2021-06-11 00:05:59 +00:00
@ObservedObject private var provider: VideoDetailsProvider
init(id: String) {
provider = VideoDetailsProvider(id)
}
2021-06-10 22:50:10 +00:00
var body: some View {
ZStack {
if let video = provider.video {
2021-06-14 18:05:02 +00:00
PlayerViewController(video: video)
.edgesIgnoringSafeArea(.all)
2021-06-10 22:50:10 +00:00
}
}
.task {
async {
provider.load()
}
}
}
}