interrupt current audio when autoplay off
This commit is contained in:
parent
f71484a444
commit
db69f84c0a
@ -1772,6 +1772,9 @@ where id in %s"""
|
||||
else:
|
||||
audio = c.answer_av_tags()
|
||||
av_player.play_tags(audio)
|
||||
else:
|
||||
av_player.maybe_interrupt()
|
||||
|
||||
|
||||
txt = self.mw.prepare_card_text_for_display(txt)
|
||||
txt = gui_hooks.card_will_show(
|
||||
|
@ -187,6 +187,8 @@ The front of this card is empty. Please run Tools>Empty Cards."""
|
||||
# play audio?
|
||||
if self.autoplay(c):
|
||||
av_player.play_tags(c.question_av_tags())
|
||||
else:
|
||||
av_player.maybe_interrupt()
|
||||
|
||||
# render & update bottom
|
||||
q = self._mungeQA(q)
|
||||
@ -230,6 +232,8 @@ The front of this card is empty. Please run Tools>Empty Cards."""
|
||||
# play audio?
|
||||
if self.autoplay(c):
|
||||
av_player.play_tags(c.answer_av_tags())
|
||||
else:
|
||||
av_player.maybe_interrupt()
|
||||
|
||||
a = self._mungeQA(a)
|
||||
a = gui_hooks.card_will_show(a, c, "reviewAnswer")
|
||||
|
@ -95,14 +95,17 @@ class AVPlayer:
|
||||
def play_tags(self, tags: List[AVTag]) -> None:
|
||||
"""Clear the existing queue, then start playing provided tags."""
|
||||
self._enqueued = tags[:]
|
||||
if self.interrupt_current_audio:
|
||||
self._stop_if_playing()
|
||||
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:
|
||||
if self.interrupt_current_audio:
|
||||
self._stop_if_playing()
|
||||
|
||||
def play_file(self, filename: str) -> None:
|
||||
self.play_tags([SoundOrVideoTag(filename=filename)])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user