mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +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 }
|
||||
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)?
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue