This commit is contained in:
Trey t
2023-07-14 15:29:24 -05:00
parent d57afc1527
commit 593cc496cd
9 changed files with 150 additions and 2991 deletions

View File

@@ -80,3 +80,34 @@ struct PlayerView: UIViewRepresentable {
uiView.setObserver()
}
}
class VideoURLCreator {
class func videoURL(thotStyle: ThotStyle, defaultVideoURLStr: String?, exerciseName: String?, workout: Workout?) -> URL? {
var urlString: String?
switch thotStyle {
case .always:
urlString = workout?.femaleVideos?.randomElement()
case .never:
urlString = defaultVideoURLStr
case .recovery:
if exerciseName?.lowercased() == "recover" {
urlString = workout?.femaleVideos?.randomElement()
} else {
urlString = defaultVideoURLStr
}
case .random:
if Bool.random() {
urlString = workout?.femaleVideos?.randomElement()
} else {
urlString = defaultVideoURLStr
}
}
if let urlString = urlString,
let url = URL(string: BaseURLs.currentBaseURL + "/media/" + urlString) {
return url
}
return nil
}
}