Implemented support to audio_did_seek_relative (#2632)

* Implemented support to audio_did_seek_relative
This commit is contained in:
evandrocoan 2023-09-04 22:15:15 -03:00 committed by GitHub
parent ee0697cd58
commit 90514daafd
2 changed files with 12 additions and 1 deletions

View file

@ -553,9 +553,11 @@ class Reviewer:
def on_seek_backward(self) -> None:
av_player.seek_relative(-self.seek_secs)
gui_hooks.audio_did_seek_relative(self.web, -self.seek_secs)
def on_seek_forward(self) -> None:
av_player.seek_relative(self.seek_secs)
gui_hooks.audio_did_seek_relative(self.web, self.seek_secs)
def onEnterKey(self) -> None:
if self.state == "question":

View file

@ -218,7 +218,16 @@ hooks = [
Hook(
name="audio_did_pause_or_unpause",
args=["webview: aqt.webview.AnkiWebView"],
doc="""Called when the audio is paused or unpaused.""",
doc="""Called when the audio is paused or unpaused.
This hook is triggered by the action in Anki's More menu or the related key binding.
The webview is provided in case you wish to use this hook with web-based audio.""",
),
Hook(
name="audio_did_seek_relative",
args=["webview: aqt.webview.AnkiWebView", "seek_seconds: int"],
doc="""Called when the audio is sought forward (positive seek) or backwards (negative seek).
This hook is triggered by the action in Anki's More menu or the related key binding.
The webview is provided in case you wish to use this hook with web-based audio.""",
),
# Debug
###################