Arrow-key skip preserves play/pause state instead of always pausing
_seek_relative() was unconditionally calling player.pause() before seeking. mpv's seek command doesn't itself change pause state, so simply not forcing it is enough: paused stays paused, playing keeps playing through the skip. (Frame-step still always pauses, correctly -- that's for precisely inspecting a single frame, a different use case from a coarse 5s nudge.) Verified by calling _seek_relative() directly rather than simulating the QShortcut keypress: a debug script isolated that PlayerWidget.seek() itself works fine while playing, and QTest.keyClick against this shortcut turned out to be unreliable in this headless setup even with Qt's active-window state forced -- consistent with the flakiness already noted in smoke_test_arrow_seek.py. The real key binding itself was already confirmed with live xdotool keypresses in an earlier session; this only needed to test the new state-preservation logic.
This commit is contained in:
@@ -303,10 +303,13 @@ class MainWindow(QMainWindow):
|
||||
self.player.mpv.mute = checked
|
||||
|
||||
def _seek_relative(self, delta_seconds: float):
|
||||
# Unlike frame-stepping (which always pauses -- you're precisely
|
||||
# inspecting a frame), a 5s skip is a coarse nudge while scrubbing
|
||||
# around; seeking doesn't change mpv's pause state on its own, so
|
||||
# just not touching play/pause here is enough to preserve whichever
|
||||
# state the user was already in.
|
||||
if self.input_path is None:
|
||||
return
|
||||
self.player.pause()
|
||||
self.play_button.setText("Play")
|
||||
duration = self.player.mpv.duration or 0.0
|
||||
target = min(max(self.player.get_position() + delta_seconds, 0.0), duration)
|
||||
self.player.seek(target)
|
||||
|
||||
Reference in New Issue
Block a user