Add Sponsor Block and settings

This commit is contained in:
Arkadiusz Fal
2021-10-23 18:49:45 +02:00
parent e64a520d5e
commit 8e0af22b94
21 changed files with 362 additions and 114 deletions

View File

@@ -21,6 +21,9 @@ struct PlaybackBar: View {
Spacer()
HStack(spacing: 4) {
if !player.lastSkipped.isNil {
restoreLastSkippedSegmentButton
}
if player.currentVideo!.live {
Image(systemName: "dot.radiowaves.left.and.right")
} else if player.isLoadingAvailableStreams || player.isLoadingStream {
@@ -30,7 +33,6 @@ struct PlaybackBar: View {
streamControl
.disabled(player.isLoadingAvailableStreams)
.frame(alignment: .trailing)
.environment(\.colorScheme, .dark)
.onChange(of: player.streamSelection) { selection in
guard !selection.isNil else {
return
@@ -42,6 +44,7 @@ struct PlaybackBar: View {
.frame(maxWidth: 180)
#endif
}
.environment(\.colorScheme, .dark)
.transaction { t in t.animation = .none }
.foregroundColor(.gray)
.font(.caption2)
@@ -91,6 +94,19 @@ struct PlaybackBar: View {
return "ends at \(timeFinishAtString)"
}
private var restoreLastSkippedSegmentButton: some View {
Button {
player.restoreLastSkippedSegment()
} label: {
HStack(spacing: 4) {
Image(systemName: "arrow.uturn.left.circle")
Text(player.lastSkipped!.category)
Text("")
}
}
.buttonStyle(.plain)
}
private var streamControl: some View {
#if os(macOS)
Picker("", selection: $player.streamSelection) {