i dunno
This commit is contained in:
@@ -6,12 +6,23 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import AVFoundation
|
||||||
|
|
||||||
struct CreateExerciseActionsView: View {
|
struct CreateExerciseActionsView: View {
|
||||||
@ObservedObject var workoutExercise: CreateWorkoutExercise
|
@ObservedObject var workoutExercise: CreateWorkoutExercise
|
||||||
var superset: CreateWorkoutSuperSet
|
var superset: CreateWorkoutSuperSet
|
||||||
var viewModel: WorkoutViewModel
|
var viewModel: WorkoutViewModel
|
||||||
|
|
||||||
|
@State var avPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4")!)
|
||||||
|
@State var videoExercise: Exercise? {
|
||||||
|
didSet {
|
||||||
|
if let viddd = self.videoExercise?.videoURL,
|
||||||
|
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
|
||||||
|
self.avPlayer = AVPlayer(url: url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
VStack {
|
VStack {
|
||||||
@@ -60,6 +71,7 @@ struct CreateExerciseActionsView: View {
|
|||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
Button(action: {
|
Button(action: {
|
||||||
|
videoExercise = workoutExercise.exercise
|
||||||
}) {
|
}) {
|
||||||
Image(systemName: "video.fill")
|
Image(systemName: "video.fill")
|
||||||
}
|
}
|
||||||
@@ -90,6 +102,13 @@ struct CreateExerciseActionsView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.sheet(item: $videoExercise) { exercise in
|
||||||
|
PlayerView(player: $avPlayer)
|
||||||
|
.onAppear{
|
||||||
|
avPlayer.isMuted = true
|
||||||
|
avPlayer.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user