mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
make sure audio queue is cleared when transitioning between cards
https://anki.tenderapp.com/discussions/beta-testing/1846-anki-2122-beta#comment_48150139
This commit is contained in:
parent
522ee8fca7
commit
8845b05933
3 changed files with 6 additions and 5 deletions
|
@ -1774,7 +1774,7 @@ where id in %s"""
|
||||||
audio = c.answer_av_tags()
|
audio = c.answer_av_tags()
|
||||||
av_player.play_tags(audio)
|
av_player.play_tags(audio)
|
||||||
else:
|
else:
|
||||||
av_player.maybe_interrupt()
|
av_player.clear_queue_and_maybe_interrupt()
|
||||||
|
|
||||||
txt = self.mw.prepare_card_text_for_display(txt)
|
txt = self.mw.prepare_card_text_for_display(txt)
|
||||||
txt = gui_hooks.card_will_show(
|
txt = gui_hooks.card_will_show(
|
||||||
|
|
|
@ -191,7 +191,7 @@ The front of this card is empty. Please run Tools>Empty Cards."""
|
||||||
if self.autoplay(c):
|
if self.autoplay(c):
|
||||||
av_player.play_tags(c.question_av_tags())
|
av_player.play_tags(c.question_av_tags())
|
||||||
else:
|
else:
|
||||||
av_player.maybe_interrupt()
|
av_player.clear_queue_and_maybe_interrupt()
|
||||||
|
|
||||||
# render & update bottom
|
# render & update bottom
|
||||||
q = self._mungeQA(q)
|
q = self._mungeQA(q)
|
||||||
|
@ -236,7 +236,7 @@ The front of this card is empty. Please run Tools>Empty Cards."""
|
||||||
if self.autoplay(c):
|
if self.autoplay(c):
|
||||||
av_player.play_tags(c.answer_av_tags())
|
av_player.play_tags(c.answer_av_tags())
|
||||||
else:
|
else:
|
||||||
av_player.maybe_interrupt()
|
av_player.clear_queue_and_maybe_interrupt()
|
||||||
|
|
||||||
a = self._mungeQA(a)
|
a = self._mungeQA(a)
|
||||||
a = gui_hooks.card_will_show(a, c, "reviewAnswer")
|
a = gui_hooks.card_will_show(a, c, "reviewAnswer")
|
||||||
|
|
|
@ -93,15 +93,16 @@ class AVPlayer:
|
||||||
|
|
||||||
def play_tags(self, tags: List[AVTag]) -> None:
|
def play_tags(self, tags: List[AVTag]) -> None:
|
||||||
"""Clear the existing queue, then start playing provided tags."""
|
"""Clear the existing queue, then start playing provided tags."""
|
||||||
|
self.clear_queue_and_maybe_interrupt()
|
||||||
self._enqueued = tags[:]
|
self._enqueued = tags[:]
|
||||||
self.maybe_interrupt()
|
|
||||||
self._play_next_if_idle()
|
self._play_next_if_idle()
|
||||||
|
|
||||||
def stop_and_clear_queue(self) -> None:
|
def stop_and_clear_queue(self) -> None:
|
||||||
self._enqueued = []
|
self._enqueued = []
|
||||||
self._stop_if_playing()
|
self._stop_if_playing()
|
||||||
|
|
||||||
def maybe_interrupt(self) -> None:
|
def clear_queue_and_maybe_interrupt(self) -> None:
|
||||||
|
self._enqueued = []
|
||||||
if self.interrupt_current_audio:
|
if self.interrupt_current_audio:
|
||||||
self._stop_if_playing()
|
self._stop_if_playing()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue