mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 07:21:58 +00:00
fix: refresh tracks on subtitle selection
This commit is contained in:
parent
b1b5a82fce
commit
57ada58667
2 changed files with 11 additions and 0 deletions
|
|
@ -179,6 +179,8 @@ final class NuvioMPVView: NSOpenGLView {
|
||||||
guard mpv != nil else { return }
|
guard mpv != nil else { return }
|
||||||
var id = Int64(trackId)
|
var id = Int64(trackId)
|
||||||
mpv_set_property(mpv, "aid", MPV_FORMAT_INT64, &id)
|
mpv_set_property(mpv, "aid", MPV_FORMAT_INT64, &id)
|
||||||
|
refreshTracks()
|
||||||
|
onStateChanged?()
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectSubtitle(_ trackId: Int) {
|
func selectSubtitle(_ trackId: Int) {
|
||||||
|
|
@ -189,11 +191,15 @@ final class NuvioMPVView: NSOpenGLView {
|
||||||
var id = Int64(trackId)
|
var id = Int64(trackId)
|
||||||
mpv_set_property(mpv, "sid", MPV_FORMAT_INT64, &id)
|
mpv_set_property(mpv, "sid", MPV_FORMAT_INT64, &id)
|
||||||
}
|
}
|
||||||
|
refreshTracks()
|
||||||
|
onStateChanged?()
|
||||||
}
|
}
|
||||||
|
|
||||||
func addSubtitleUrl(_ url: String) {
|
func addSubtitleUrl(_ url: String) {
|
||||||
guard mpv != nil else { return }
|
guard mpv != nil else { return }
|
||||||
command("sub-add", args: [url, "select"])
|
command("sub-add", args: [url, "select"])
|
||||||
|
refreshTracks()
|
||||||
|
onStateChanged?()
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeExternalSubtitles() {
|
func removeExternalSubtitles() {
|
||||||
|
|
@ -208,6 +214,8 @@ final class NuvioMPVView: NSOpenGLView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkError(mpv_set_option_string(mpv, "sid", "no"))
|
checkError(mpv_set_option_string(mpv, "sid", "no"))
|
||||||
|
refreshTracks()
|
||||||
|
onStateChanged?()
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeExternalSubtitlesAndSelect(_ trackId: Int) {
|
func removeExternalSubtitlesAndSelect(_ trackId: Int) {
|
||||||
|
|
@ -226,6 +234,8 @@ final class NuvioMPVView: NSOpenGLView {
|
||||||
} else {
|
} else {
|
||||||
checkError(mpv_set_option_string(mpv, "sid", "no"))
|
checkError(mpv_set_option_string(mpv, "sid", "no"))
|
||||||
}
|
}
|
||||||
|
refreshTracks()
|
||||||
|
onStateChanged?()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var pendingSubStyle: (String, Float, Float, Int)?
|
private var pendingSubStyle: (String, Float, Float, Int)?
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,7 @@ final class NuvioPlayerWindow {
|
||||||
private func syncStateFromMPV() {
|
private func syncStateFromMPV() {
|
||||||
guard mpvView != nil, mpvView.mpv != nil else { return }
|
guard mpvView != nil, mpvView.mpv != nil else { return }
|
||||||
mpvView.refreshPlaybackState()
|
mpvView.refreshPlaybackState()
|
||||||
|
mpvView.refreshTracks()
|
||||||
state.isLoading = mpvView.isPlayerLoading
|
state.isLoading = mpvView.isPlayerLoading
|
||||||
state.isPlaying = mpvView.isPlayerPlaying
|
state.isPlaying = mpvView.isPlayerPlaying
|
||||||
state.isEnded = mpvView.isPlayerEnded
|
state.isEnded = mpvView.isPlayerEnded
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue