diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 720d99ec1..95a9d3ef8 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -39,6 +39,7 @@ Sander Santema
Thomas Brownback
Andrew Gaul
kenden
+Nickolay Yudin
********************
diff --git a/qt/aqt/mpv.py b/qt/aqt/mpv.py
index da0cad250..eab2e4514 100644
--- a/qt/aqt/mpv.py
+++ b/qt/aqt/mpv.py
@@ -84,6 +84,7 @@ class MPVBase:
"--ontop",
"--audio-display=no",
"--keep-open=no",
+ "--reset-on-next-file=pause",
]
def __init__(self, window_id=None, debug=False):
diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py
index a286b1129..20e3d719e 100644
--- a/qt/aqt/sound.py
+++ b/qt/aqt/sound.py
@@ -333,11 +333,20 @@ class MpvManager(MPV, SoundOrVideoPlayer):
self._on_done: Optional[OnDoneCallback] = None
self.default_argv += ["--config-dir=" + base_path]
super().__init__(window_id=None, debug=False)
+ self.init()
+
+ def init(self) -> None:
+ self.command("keybind", "q", "stop")
+ self.command("keybind", "Q", "stop")
+ self.command("keybind", "CLOSE_WIN", "stop")
+ self.command("keybind", "ctrl+w", "stop")
+ self.command("keybind", "ctrl+c", "stop")
def play(self, tag: AVTag, on_done: OnDoneCallback) -> None:
assert isinstance(tag, SoundOrVideoTag)
self._on_done = on_done
path = os.path.join(os.getcwd(), tag.filename)
+ self.command("script-message", "osc-visibility", "never", "no-osd")
self.command("loadfile", path, "append-play")
gui_hooks.av_player_did_begin_playing(self, tag)
@@ -350,10 +359,13 @@ class MpvManager(MPV, SoundOrVideoPlayer):
def seek_relative(self, secs: int) -> None:
self.command("seek", secs, "relative")
- def on_idle(self) -> None:
- if self._on_done:
+ def on_property_idle_active(self, val) -> None:
+ if val and self._on_done:
self._on_done()
+ def on_start_file(self) -> None:
+ self.command("script-message", "osc-visibility", "auto", "no-osd")
+
def shutdown(self) -> None:
self.close()