1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 14:50:32 +05:30

Fix rate button

This commit is contained in:
Arkadiusz Fal 2022-05-20 23:20:18 +02:00
parent 7e7aca08a0
commit a4fb39a0d7
2 changed files with 12 additions and 5 deletions

View File

@ -217,7 +217,7 @@ final class MPVBackend: PlayerBackend {
}
func setRate(_ rate: Float) {
client.setDoubleAsync("speed", Double(rate))
client?.setDoubleAsync("speed", Double(rate))
}
func closeItem() {}

View File

@ -196,12 +196,12 @@ struct PlayerControls: View {
#endif
}
private var rateButton: some View {
@ViewBuilder private var rateButton: some View {
#if os(macOS)
ratePicker
.labelsHidden()
.frame(maxWidth: 70)
#else
#elseif os(iOS)
Menu {
ratePicker
.frame(width: 45, height: 30)
@ -212,9 +212,16 @@ struct PlayerControls: View {
} label: {
Text(player.rateLabel(player.currentRate))
.foregroundColor(.primary)
.frame(maxWidth: .infinity)
}
.buttonStyle(.plain)
.foregroundColor(.primary)
.frame(width: 50, height: 30)
#if os(macOS)
.background(VisualEffectBlur(material: .hudWindow))
#elseif os(iOS)
.background(VisualEffectBlur(blurStyle: .systemThinMaterial))
#endif
.mask(RoundedRectangle(cornerRadius: 3))
#endif
}