WIP
This commit is contained in:
@@ -54,6 +54,21 @@ extension ExerciseElement {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func returnOtherVideoURL(currentURL: URL) -> URL? {
|
||||||
|
var urlString: String?
|
||||||
|
if currentURL.absoluteString.lowercased().contains(exercise.nsfwVideoURL.lowercased()) {
|
||||||
|
urlString = exercise.videoURL
|
||||||
|
} else {
|
||||||
|
urlString = exercise.nsfwVideoURL
|
||||||
|
}
|
||||||
|
|
||||||
|
if let urlString = urlString,
|
||||||
|
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ExerciseExercise: Codable, Hashable, Identifiable {
|
struct ExerciseExercise: Codable, Hashable, Identifiable {
|
||||||
@@ -123,4 +138,19 @@ extension ExerciseExercise {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func returnOtherVideoURL(currentURL: URL) -> URL? {
|
||||||
|
var urlString: String?
|
||||||
|
if currentURL.absoluteString.lowercased().contains(nsfwVideoURL.lowercased()) {
|
||||||
|
urlString = videoURL
|
||||||
|
} else {
|
||||||
|
urlString = nsfwVideoURL
|
||||||
|
}
|
||||||
|
|
||||||
|
if let urlString = urlString,
|
||||||
|
let url = URL(string: BaseURLs.currentBaseURL + urlString) {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,11 +41,29 @@ struct WorkoutDetailView: View {
|
|||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
|
|
||||||
GeometryReader { metrics in
|
GeometryReader { metrics in
|
||||||
PlayerView(player: $avPlayer)
|
ZStack {
|
||||||
.frame(width: metrics.size.width * 1, height: metrics.size.height * 1)
|
PlayerView(player: $avPlayer)
|
||||||
.onAppear{
|
.frame(width: metrics.size.width * 1, height: metrics.size.height * 1)
|
||||||
avPlayer.play()
|
.onAppear{
|
||||||
}
|
avPlayer.play()
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(action: {
|
||||||
|
if let assetURL = ((avPlayer.currentItem?.asset) as? AVURLAsset)?.url,
|
||||||
|
let videoURL = bridgeModule.currentExercise?.returnOtherVideoURL(currentURL: assetURL) {
|
||||||
|
avPlayer = AVPlayer(url: videoURL)
|
||||||
|
avPlayer.play()
|
||||||
|
}
|
||||||
|
}, label: {
|
||||||
|
Text("Toggle THOT")
|
||||||
|
.padding()
|
||||||
|
})
|
||||||
|
.background(.yellow)
|
||||||
|
.foregroundColor(.blue)
|
||||||
|
.cornerRadius(4)
|
||||||
|
.frame(width: 160, height: 60)
|
||||||
|
.position(x: metrics.size.width - 80, y: metrics.size.height - 30)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user