Stabilize iOS/watchOS/tvOS apps and add cross-platform audit remediation
This commit is contained in:
@@ -10,8 +10,10 @@ import AVKit
|
||||
|
||||
struct ExternalWorkoutDetailView: View {
|
||||
@StateObject var bridgeModule = BridgeModule.shared
|
||||
@State var avPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4")!)
|
||||
@State var smallAVPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4")!)
|
||||
@State var avPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4") ?? URL(fileURLWithPath: "/dev/null"))
|
||||
@State var smallAVPlayer = AVPlayer(url: URL(string: "https://dev.werkout.fitness/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4") ?? URL(fileURLWithPath: "/dev/null"))
|
||||
@State private var currentVideoURL: URL?
|
||||
@State private var currentSmallVideoURL: URL?
|
||||
@AppStorage(Constants.extThotStyle) private var extThotStyle: ThotStyle = .never
|
||||
@AppStorage(Constants.extShowNextVideo) private var extShowNextVideo: Bool = false
|
||||
@AppStorage(Constants.thotGenderOption) private var thotGenderOption: String = "female"
|
||||
@@ -49,8 +51,8 @@ struct ExternalWorkoutDetailView: View {
|
||||
.frame(width: metrics.size.width * 0.2,
|
||||
height: metrics.size.height * 0.2)
|
||||
.onAppear{
|
||||
avPlayer.isMuted = true
|
||||
avPlayer.play()
|
||||
smallAVPlayer.isMuted = true
|
||||
smallAVPlayer.play()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,6 +107,10 @@ struct ExternalWorkoutDetailView: View {
|
||||
avPlayer.play()
|
||||
smallAVPlayer.play()
|
||||
}
|
||||
.onDisappear {
|
||||
avPlayer.pause()
|
||||
smallAVPlayer.pause()
|
||||
}
|
||||
}
|
||||
|
||||
func playVideos() {
|
||||
@@ -115,8 +121,7 @@ struct ExternalWorkoutDetailView: View {
|
||||
defaultVideoURLStr: currentExtercise.exercise.videoURL,
|
||||
exerciseName: currentExtercise.exercise.name,
|
||||
workout: bridgeModule.currentWorkoutInfo.workout) {
|
||||
avPlayer = AVPlayer(url: videoURL)
|
||||
avPlayer.play()
|
||||
updateMainPlayer(for: videoURL)
|
||||
}
|
||||
|
||||
if let smallVideoURL = VideoURLCreator.videoURL(
|
||||
@@ -126,11 +131,34 @@ struct ExternalWorkoutDetailView: View {
|
||||
exerciseName: BridgeModule.shared.currentWorkoutInfo.nextExerciseInfo?.exercise.name,
|
||||
workout: bridgeModule.currentWorkoutInfo.workout),
|
||||
extShowNextVideo {
|
||||
smallAVPlayer = AVPlayer(url: smallVideoURL)
|
||||
smallAVPlayer.play()
|
||||
updateSmallPlayer(for: smallVideoURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateMainPlayer(for url: URL) {
|
||||
if currentVideoURL == url {
|
||||
avPlayer.seek(to: .zero)
|
||||
avPlayer.play()
|
||||
return
|
||||
}
|
||||
|
||||
currentVideoURL = url
|
||||
avPlayer = AVPlayer(url: url)
|
||||
avPlayer.play()
|
||||
}
|
||||
|
||||
private func updateSmallPlayer(for url: URL) {
|
||||
if currentSmallVideoURL == url {
|
||||
smallAVPlayer.seek(to: .zero)
|
||||
smallAVPlayer.play()
|
||||
return
|
||||
}
|
||||
|
||||
currentSmallVideoURL = url
|
||||
smallAVPlayer = AVPlayer(url: url)
|
||||
smallAVPlayer.play()
|
||||
}
|
||||
}
|
||||
|
||||
//struct ExternalWorkoutDetailView_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user