diff --git a/MPVKit/Sources/DesktopMPVBridge/NuvioMPVView.swift b/MPVKit/Sources/DesktopMPVBridge/NuvioMPVView.swift index 3d3ce1dd..1743a875 100644 --- a/MPVKit/Sources/DesktopMPVBridge/NuvioMPVView.swift +++ b/MPVKit/Sources/DesktopMPVBridge/NuvioMPVView.swift @@ -179,6 +179,8 @@ final class NuvioMPVView: NSOpenGLView { guard mpv != nil else { return } var id = Int64(trackId) mpv_set_property(mpv, "aid", MPV_FORMAT_INT64, &id) + refreshTracks() + onStateChanged?() } func selectSubtitle(_ trackId: Int) { @@ -189,11 +191,15 @@ final class NuvioMPVView: NSOpenGLView { var id = Int64(trackId) mpv_set_property(mpv, "sid", MPV_FORMAT_INT64, &id) } + refreshTracks() + onStateChanged?() } func addSubtitleUrl(_ url: String) { guard mpv != nil else { return } command("sub-add", args: [url, "select"]) + refreshTracks() + onStateChanged?() } func removeExternalSubtitles() { @@ -208,6 +214,8 @@ final class NuvioMPVView: NSOpenGLView { } } checkError(mpv_set_option_string(mpv, "sid", "no")) + refreshTracks() + onStateChanged?() } func removeExternalSubtitlesAndSelect(_ trackId: Int) { @@ -226,6 +234,8 @@ final class NuvioMPVView: NSOpenGLView { } else { checkError(mpv_set_option_string(mpv, "sid", "no")) } + refreshTracks() + onStateChanged?() } private var pendingSubStyle: (String, Float, Float, Int)? diff --git a/MPVKit/Sources/DesktopMPVBridge/NuvioPlayerWindow.swift b/MPVKit/Sources/DesktopMPVBridge/NuvioPlayerWindow.swift index fc175455..2a43c71c 100644 --- a/MPVKit/Sources/DesktopMPVBridge/NuvioPlayerWindow.swift +++ b/MPVKit/Sources/DesktopMPVBridge/NuvioPlayerWindow.swift @@ -221,6 +221,7 @@ final class NuvioPlayerWindow { private func syncStateFromMPV() { guard mpvView != nil, mpvView.mpv != nil else { return } mpvView.refreshPlaybackState() + mpvView.refreshTracks() state.isLoading = mpvView.isPlayerLoading state.isPlaying = mpvView.isPlayerPlaying state.isEnded = mpvView.isPlayerEnded