WIP
This commit is contained in:
@@ -16,7 +16,11 @@ struct ExerciseListView: View {
|
||||
|
||||
@State var videoExercise: ExerciseExercise? {
|
||||
didSet {
|
||||
if let videoURL = self.videoExercise?.videoURL(thotStyle: thotStyle) {
|
||||
if let videoURL = VideoURLCreator.videoURL(
|
||||
thotStyle: thotStyle,
|
||||
defaultVideoURLStr: self.videoExercise?.videoURL,
|
||||
exerciseName: self.videoExercise?.name,
|
||||
workout: bridgeModule.currentWorkout) {
|
||||
avPlayer = AVPlayer(url: videoURL)
|
||||
avPlayer.play()
|
||||
}
|
||||
|
||||
@@ -49,10 +49,14 @@ struct WorkoutDetailView: View {
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
if let assetURL = ((avPlayer.currentItem?.asset) as? AVURLAsset)?.url,
|
||||
let videoURL = bridgeModule.currentExercise?.returnOtherVideoURL(currentURL: assetURL) {
|
||||
avPlayer = AVPlayer(url: videoURL)
|
||||
avPlayer.play()
|
||||
if let assetURL = ((avPlayer.currentItem?.asset) as? AVURLAsset)?.url {
|
||||
if assetURL.absoluteString.lowercased().contains("exercise_videos") {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
// avPlayer = AVPlayer(url: videoURL)
|
||||
// avPlayer.play()
|
||||
}
|
||||
}, label: {
|
||||
Text("Toggle THOT")
|
||||
@@ -98,16 +102,25 @@ struct WorkoutDetailView: View {
|
||||
}
|
||||
}
|
||||
.onChange(of: bridgeModule.currentExercise, perform: { newValue in
|
||||
if let videoURL = newValue?.videoURL(thotStyle: thotStyle) {
|
||||
if let videoURL = VideoURLCreator.videoURL(
|
||||
thotStyle: thotStyle,
|
||||
defaultVideoURLStr: newValue?.exercise.videoURL,
|
||||
exerciseName: newValue?.exercise.name,
|
||||
workout: bridgeModule.currentWorkout) {
|
||||
avPlayer = AVPlayer(url: videoURL)
|
||||
avPlayer.play()
|
||||
}
|
||||
})
|
||||
.onAppear{
|
||||
if let videoURL = bridgeModule.currentExercise?.videoURL(thotStyle: thotStyle) {
|
||||
if let videoURL = VideoURLCreator.videoURL(
|
||||
thotStyle: thotStyle,
|
||||
defaultVideoURLStr: bridgeModule.currentExercise?.exercise.videoURL,
|
||||
exerciseName: bridgeModule.currentExercise?.exercise.name,
|
||||
workout: bridgeModule.currentWorkout) {
|
||||
avPlayer = AVPlayer(url: videoURL)
|
||||
avPlayer.play()
|
||||
}
|
||||
|
||||
bridgeModule.completedWorkout = {
|
||||
if let workoutData = createWorkoutData() {
|
||||
presentedSheet = .completedWorkout(workoutData)
|
||||
|
||||
Reference in New Issue
Block a user