From 9e0590965951a7ac2816564169f0fb27d4353e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Thu, 23 May 2024 19:02:13 +0200 Subject: [PATCH] fix duplicated share button fixes #691 add `--initial-audio-sync=` to MPV settings. Might fix #690 but needs to be toggled by the user. We leave the standard settings. Also added links to the icons on macOS. --- Model/Player/Backends/MPVClient.swift | 1 + Shared/Defaults.swift | 1 + Shared/Settings/AdvancedSettings.swift | 40 ++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/Model/Player/Backends/MPVClient.swift b/Model/Player/Backends/MPVClient.swift index 8a10f2dc..f33f6e61 100644 --- a/Model/Player/Backends/MPVClient.swift +++ b/Model/Player/Backends/MPVClient.swift @@ -72,6 +72,7 @@ final class MPVClient: ObservableObject { checkError(mpv_set_option_string(mpv, "sub-scale", Defaults[.captionsFontScaleSize])) checkError(mpv_set_option_string(mpv, "sub-color", Defaults[.captionsFontColor])) checkError(mpv_set_option_string(mpv, "user-agent", UserAgentManager.shared.userAgent)) + checkError(mpv_set_option_string(mpv, "initial-audio-sync", Defaults[.mpvInitialAudioSync] ? "yes" : "no")) // GPU // diff --git a/Shared/Defaults.swift b/Shared/Defaults.swift index 7ed7a298..6b9b7a18 100644 --- a/Shared/Defaults.swift +++ b/Shared/Defaults.swift @@ -270,6 +270,7 @@ extension Defaults.Keys { static let mpvDeinterlace = Key("mpvDeinterlace", default: false) static let mpvHWdec = Key("hwdec", default: "auto-safe") static let mpvDemuxerLavfProbeInfo = Key("mpvDemuxerLavfProbeInfo", default: "no") + static let mpvInitialAudioSync = Key("mpvInitialAudioSync", default: true) static let showCacheStatus = Key("showCacheStatus", default: false) static let feedCacheSize = Key("feedCacheSize", default: "50") diff --git a/Shared/Settings/AdvancedSettings.swift b/Shared/Settings/AdvancedSettings.swift index c4c6b4ea..0e1d25f3 100644 --- a/Shared/Settings/AdvancedSettings.swift +++ b/Shared/Settings/AdvancedSettings.swift @@ -10,6 +10,7 @@ struct AdvancedSettings: View { @Default(.mpvEnableLogging) private var mpvEnableLogging @Default(.mpvHWdec) private var mpvHWdec @Default(.mpvDemuxerLavfProbeInfo) private var mpvDemuxerLavfProbeInfo + @Default(.mpvInitialAudioSync) private var mpvInitialAudioSync @Default(.showCacheStatus) private var showCacheStatus @Default(.feedCacheSize) private var feedCacheSize @Default(.showPlayNowInBackendContextMenu) private var showPlayNowInBackendContextMenu @@ -83,6 +84,9 @@ struct AdvancedSettings: View { UIApplication.shared.open(URL(string: "https://mpv.io/manual/stable/#options-cache-pause-initial")!) } #elseif os(macOS) + .onTapGesture { + NSWorkspace.shared.open(URL(string: "https://mpv.io/manual/stable/#options-cache-pause-initial")!) + } .onHover(perform: onHover(_:)) #endif #endif @@ -100,6 +104,9 @@ struct AdvancedSettings: View { UIApplication.shared.open(URL(string: "https://mpv.io/manual/stable/#options-cache-secs")!) } #elseif os(macOS) + .onTapGesture { + NSWorkspace.shared.open(URL(string: "https://mpv.io/manual/stable/#options-cache-secs")!) + } .onHover(perform: onHover(_:)) #endif @@ -123,6 +130,9 @@ struct AdvancedSettings: View { UIApplication.shared.open(URL(string: "https://mpv.io/manual/stable/#options-cache-pause-wait")!) } #elseif os(macOS) + .onTapGesture { + NSWorkspace.shared.open(URL(string: "https://mpv.io/manual/stable/#options-cache-pause-wait")!) + } .onHover(perform: onHover(_:)) #endif #endif @@ -147,6 +157,30 @@ struct AdvancedSettings: View { UIApplication.shared.open(URL(string: "https://mpv.io/manual/stable/#options-deinterlace")!) } #elseif os(macOS) + .onTapGesture { + NSWorkspace.shared.open(URL(string: "https://mpv.io/manual/stable/#options-deinterlace")!) + } + .onHover(perform: onHover(_:)) + #endif + #endif + } + } + + Toggle(isOn: $mpvInitialAudioSync) { + HStack { + Text("initial-audio-sync") + #if !os(tvOS) + Image(systemName: "link") + .accessibilityAddTraits([.isButton, .isLink]) + .font(.footnote) + #if os(iOS) + .onTapGesture { + UIApplication.shared.open(URL(string: "https://mpv.io/manual/stable/#options-initial-audio-sync")!) + } + #elseif os(macOS) + .onTapGesture { + NSWorkspace.shared.open(URL(string: "https://mpv.io/manual/stable/#options-initial-audio-sync")!) + } .onHover(perform: onHover(_:)) #endif #endif @@ -165,6 +199,9 @@ struct AdvancedSettings: View { UIApplication.shared.open(URL(string: "https://mpv.io/manual/stable/#options-hwdec")!) } #elseif os(macOS) + .onTapGesture { + NSWorkspace.shared.open(URL(string: "https://mpv.io/manual/stable/#options-hwdec")!) + } .onHover(perform: onHover(_:)) #endif #endif @@ -191,6 +228,9 @@ struct AdvancedSettings: View { UIApplication.shared.open(URL(string: "https://mpv.io/manual/stable/#options-demuxer-lavf-probe-info")!) } #elseif os(macOS) + .onTapGesture { + NSWorkspace.shared.open(URL(string: "https://mpv.io/manual/stable/#options-demuxer-lavf-probe-info")!) + } .onHover(perform: onHover(_:)) #endif #endif