experiment(PodcastPlayerView): add skip ±15s buttons to full player controls
This commit is contained in:
@@ -144,6 +144,14 @@ final class PodcastPlayerViewModel {
|
|||||||
updateNowPlaying()
|
updateNowPlaying()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func skipForward15() {
|
||||||
|
seek(to: min(currentTime + 15, duration))
|
||||||
|
}
|
||||||
|
|
||||||
|
func skipBackward15() {
|
||||||
|
seek(to: max(currentTime - 15, 0))
|
||||||
|
}
|
||||||
|
|
||||||
private func setupPlayer(url: URL, title: String) {
|
private func setupPlayer(url: URL, title: String) {
|
||||||
currentPodcastTitle = title
|
currentPodcastTitle = title
|
||||||
|
|
||||||
@@ -347,11 +355,23 @@ struct PodcastPlayerView: View {
|
|||||||
.foregroundStyle(.tertiary)
|
.foregroundStyle(.tertiary)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HStack(spacing: 36) {
|
||||||
|
Button { vm.skipBackward15() } label: {
|
||||||
|
Image(systemName: "gobackward.15")
|
||||||
|
.font(.system(size: 32))
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
}
|
||||||
Button { vm.togglePlayPause() } label: {
|
Button { vm.togglePlayPause() } label: {
|
||||||
Image(systemName: vm.isPlaying ? "pause.circle.fill" : "play.circle.fill")
|
Image(systemName: vm.isPlaying ? "pause.circle.fill" : "play.circle.fill")
|
||||||
.font(.system(size: 72))
|
.font(.system(size: 72))
|
||||||
.foregroundStyle(.primary)
|
.foregroundStyle(.primary)
|
||||||
}
|
}
|
||||||
|
Button { vm.skipForward15() } label: {
|
||||||
|
Image(systemName: "goforward.15")
|
||||||
|
.font(.system(size: 32))
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user