This commit is contained in:
Trey t
2023-07-05 09:20:25 -05:00
parent eaa6997c18
commit 0e687036b6
6 changed files with 116 additions and 82 deletions

View File

@@ -19,8 +19,11 @@ struct ExternalWorkoutDetailView: View {
GeometryReader { metrics in
VStack {
HStack {
VideoPlayerView(avPlayer: $avPlayer, showDoneButton: false)
PlayerView(player: $avPlayer)
.frame(width: metrics.size.width * 0.6, height: metrics.size.height * 0.8)
.onAppear{
avPlayer.play()
}
ExtExerciseList(workout: workout,
currentExerciseIdx: bridgeModule.currentExerciseIdx)
@@ -39,17 +42,22 @@ struct ExternalWorkoutDetailView: View {
}
}
.onChange(of: bridgeModule.currentExercise, perform: { newValue in
var _url: URL?
if showNSFWVideos {
if let viddd = newValue?.exercise.nsfwVideoURL,
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
avPlayer = AVPlayer(url: url)
_url = url
}
} else {
if let viddd = newValue?.exercise.videoURL,
let url = URL(string: BaseURLs.currentBaseURL + viddd) {
avPlayer = AVPlayer(url: url)
_url = url
}
}
if let __url = _url {
avPlayer = AVPlayer(url: __url)
avPlayer.play()
}
})
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(.background)