mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add rate change selector
This commit is contained in:
@@ -122,8 +122,10 @@ enum ResolutionSetting: String, CaseIterable, Defaults.Serializable {
|
||||
switch self {
|
||||
case .best:
|
||||
return "Best available quality"
|
||||
case .hd2160p:
|
||||
case .hd2160p60:
|
||||
return "4K, 60fps"
|
||||
case .hd2160p:
|
||||
return "4K"
|
||||
default:
|
||||
return value.name
|
||||
}
|
||||
|
@@ -176,8 +176,10 @@ struct PlayerControls: View {
|
||||
HStack {
|
||||
#if !os(tvOS)
|
||||
fullscreenButton
|
||||
rateButton
|
||||
|
||||
Spacer()
|
||||
#endif
|
||||
Spacer()
|
||||
// button("Music Mode", systemImage: "music.note")
|
||||
}
|
||||
}
|
||||
@@ -194,6 +196,41 @@ struct PlayerControls: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
private var rateButton: some View {
|
||||
#if os(macOS)
|
||||
ratePicker
|
||||
.labelsHidden()
|
||||
.frame(maxWidth: 70)
|
||||
#else
|
||||
Menu {
|
||||
ratePicker
|
||||
.frame(width: 45, height: 30)
|
||||
#if os(iOS)
|
||||
.background(VisualEffectBlur(blurStyle: .systemThinMaterial))
|
||||
#endif
|
||||
.mask(RoundedRectangle(cornerRadius: 3))
|
||||
} label: {
|
||||
Text(player.rateLabel(player.currentRate))
|
||||
.foregroundColor(.primary)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
var ratePicker: some View {
|
||||
Picker("Rate", selection: rateBinding) {
|
||||
ForEach(PlayerModel.availableRates, id: \.self) { rate in
|
||||
Text(player.rateLabel(rate)).tag(rate)
|
||||
}
|
||||
}
|
||||
.transaction { t in t.animation = .none }
|
||||
}
|
||||
|
||||
private var rateBinding: Binding<Float> {
|
||||
.init(get: { player.currentRate }, set: { rate in player.currentRate = rate })
|
||||
}
|
||||
|
||||
var mediumButtonsBar: some View {
|
||||
HStack {
|
||||
#if !os(tvOS)
|
||||
|
Reference in New Issue
Block a user