mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -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()
|
||||
av_player.play_tags(audio)
|
||||
else:
|
||||
av_player.maybe_interrupt()
|
||||
av_player.clear_queue_and_maybe_interrupt()
|
||||
|
||||
txt = self.mw.prepare_card_text_for_display(txt)
|
||||
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):
|
||||
av_player.play_tags(c.question_av_tags())
|
||||
else:
|
||||
av_player.maybe_interrupt()
|
||||
av_player.clear_queue_and_maybe_interrupt()
|
||||
|
||||
# render & update bottom
|
||||
q = self._mungeQA(q)
|
||||
|
@ -236,7 +236,7 @@ The front of this card is empty. Please run Tools>Empty Cards."""
|
|||
if self.autoplay(c):
|
||||
av_player.play_tags(c.answer_av_tags())
|
||||
else:
|
||||
av_player.maybe_interrupt()
|
||||
av_player.clear_queue_and_maybe_interrupt()
|
||||
|
||||
a = self._mungeQA(a)
|
||||
a = gui_hooks.card_will_show(a, c, "reviewAnswer")
|
||||
|
|
|
@ -93,15 +93,16 @@ class AVPlayer:
|
|||
|
||||
def play_tags(self, tags: List[AVTag]) -> None:
|
||||
"""Clear the existing queue, then start playing provided tags."""
|
||||
self.clear_queue_and_maybe_interrupt()
|
||||
self._enqueued = tags[:]
|
||||
self.maybe_interrupt()
|
||||
self._play_next_if_idle()
|
||||
|
||||
def stop_and_clear_queue(self) -> None:
|
||||
self._enqueued = []
|
||||
self._stop_if_playing()
|
||||
|
||||
def maybe_interrupt(self) -> None:
|
||||
def clear_queue_and_maybe_interrupt(self) -> None:
|
||||
self._enqueued = []
|
||||
if self.interrupt_current_audio:
|
||||
self._stop_if_playing()
|
||||
|
||||
|
|
Loading…
Reference in a new issue