Skip to content

Commit b3cb44a

Browse files
committed
Player/Seekdialog: Add a 0.5s action threshold when the OSD is hiding to reduce miss-seeks due to UI interaction
1 parent ad06ecb commit b3cb44a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/windows/seekdialog.py

+11
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class SeekDialog(kodigui.BaseDialog):
136136

137137
HIDE_DELAY = 4 # This uses the Cron tick so is +/- 1 second accurate
138138
OSD_HIDE_ANIMATION_DURATION = 0.2
139+
OSD_HIDE_ACTION_THRESHOLD = 0.5
139140
SKIP_STEPS = {"negative": [-10000], "positive": [30000]}
140141

141142
def __init__(self, *args, **kwargs):
@@ -634,6 +635,11 @@ def onAction(self, action):
634635
if controlID == self.MAIN_BUTTON_ID:
635636
# we're seeking from the timeline with the OSD open - do an actual timeline seek
636637

638+
# ignore seek actions for a split second when the OSD is hiding or was hiding
639+
if (action.getId() in KEY_MOVE_SET and self._osdHideAnimationTimeout and
640+
self._osdHideAnimationTimeout + self.OSD_HIDE_ACTION_THRESHOLD >= time.time()):
641+
return
642+
637643
if action in (xbmcgui.ACTION_MOVE_RIGHT, xbmcgui.ACTION_STEP_FORWARD):
638644
self.setProperty('show.chapters', '')
639645
if self.useDynamicStepsForTimeline:
@@ -680,6 +686,11 @@ def onAction(self, action):
680686
self.resetSeeking()
681687

682688
elif controlID == self.NO_OSD_BUTTON_ID or passThroughMain:
689+
# ignore seek actions for a split second when the OSD is hiding or was hiding
690+
if (action.getId() in KEY_MOVE_SET and self._osdHideAnimationTimeout and
691+
self._osdHideAnimationTimeout + self.OSD_HIDE_ACTION_THRESHOLD >= time.time()):
692+
return
693+
683694
if action in (xbmcgui.ACTION_MOVE_RIGHT, xbmcgui.ACTION_MOVE_LEFT):
684695
# we're seeking from the timeline, with the OSD closed; act as we're skipping
685696
if not self._seeking:

0 commit comments

Comments
 (0)