WIP
This commit is contained in:
50
Werkout_ios/Views/VideoPlayerView.swift
Normal file
50
Werkout_ios/Views/VideoPlayerView.swift
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// VideoPlayerView.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 6/27/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import AVKit
|
||||
import SafariServices
|
||||
|
||||
struct VideoPlayerView: View {
|
||||
let url: URL
|
||||
@State var player: AVPlayer?
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("Done")
|
||||
})
|
||||
.padding()
|
||||
|
||||
SafariWebView(url: url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SafariWebView: UIViewControllerRepresentable {
|
||||
let url: URL
|
||||
|
||||
func makeUIViewController(context: Context) -> SFSafariViewController {
|
||||
return SFSafariViewController(url: url)
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct VideoPlayerView_Previews: PreviewProvider {
|
||||
static let exercise = PreviewData.parseExercises().first!
|
||||
|
||||
static var previews: some View {
|
||||
VideoPlayerView(url: Bundle.main.url(forResource: "Straight_Leg_Sit_Up", withExtension: "mp4")!)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user