Anki Forums

Option controlling autoplay of audio dropped into card editing window

As suggested in another thread, I’m making this thread to see if there is any interest in an option like this.

2.1.33 saw a relatively minor temporary change to how pasting audio into a field on a flashcard worked. Previously, Anki would play the audio pasted into a field automatically, but in 2.1.33 the audio would no longer play when doing this. This change was reverted in 2.1.34.

I use Anki to learn foreign languages, and I often make flashcards on the go when I come cross an unknown word while watching something, for example. Adding the audio means I’ll have to wait for the audio clip to finish playing before I can get back to whatever I was doing. I think this is a fairly compelling argument against this functionality, especially as a language learner.

Perhaps I’m missing something, but I don’t see the benefits of having the autoplay functionality there, other than double checking that you have the right clip, and that the clip sounds good, but in the few instances that you’d want to do this, you are literally one click away from being able to do this anyway even if the functionality isn’t there: the preview button.

You could of course argue that one can turn off audio from Anki in the volume mixer (on Windows-based OSes, at least), and I have actually done this from time to time, but it means one has to go into the volume mixer and mute/unmute Anki every time you want to engage in TL content or rep cards in Anki. This is a obviously a bigger inconvenience than just pressing an additional button (see previous paragraph).

If, for whatever reason, this functionality has to stay, an option to enable/disable it would be nice.

1 Like

I’ve just implemented this here.


if @dae thinks this is a worthwhile addition, I can open a pull request.


That page is getting a bit big again, and it may make more sense to split it out into a separate “Editing” tab. But so far we’ve only heard from one user - if a lot of demand doesn’t present itself, it may end up being better done in an add-on, as every option we add makes the UI more complicated, and adds to the maintenance burden.

1 Like

This looks like a nice solution, though I understand dae’s concern with settings bloat. Excuse my ignorance (I’m not very familiar with the workings of GitHub), but is there any way I can implement the code you’ve linked to on my own? I couldn’t find any of the files mentioned on the page you linked to. Or is the only way for me to do this via an add-on?

May I ask why the current functionality is there? Like I outlined in the original post, I don’t understand the benefits of the audio playing automatically. If you want to hear what it looks like, you can just preview the card.

Using this is a bit complicated since you have to build dependencies and run from source.

I think this can be done with an add-on. I’ll do that and return to you later.


Copy the code below to a file named and put it in a folder called something like editor_no_autoplay, then copy that folder to your addons21 folder found in Anki’s data folder.

import html
import urllib.parse

from aqt.editor import Editor, pics

def myFnameToLink(self, fname: str) -> str:
    ext = fname.split(".")[-1].lower()
    if ext in pics:
        name = urllib.parse.quote(fname.encode("utf8"))
        return '<img src="%s">' % name
        return "[sound:%s]" % html.escape(fname, quote=False)

Editor.fnameToLink = myFnameToLink

Having it autoplay allows users to confirm they selected the correct file. People are used to it, and complained when the behaviour changed.


Thank you so much for going above and beyond just to help out a stranger like me. I tested it out, and it works perfectly.

1 Like