mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
32 lines
607 B
Swift
32 lines
607 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 {
|
|
async {
|
|
provider.load()
|
|
}
|
|
}
|
|
}
|
|
|
|
var pvc: PlayerViewController? {
|
|
guard provider.video != nil else {
|
|
return nil
|
|
}
|
|
|
|
return PlayerViewController(video: provider.video!)
|
|
}
|
|
}
|