Check media reports a problem, but is it?

I recently modified the templates of some of my cards to create audio loops.

Now when I do a Check media, I get this message:

Anki can not detect used files when you use {{Field}} references in media/LaTeX tags. The media/LaTeX tags should be placed on individual notes instead.

I’ve checked and I understand the affected section is this one:

<div id="audio-container">
  <audio id="audio-player" src="{{Loop}}"></audio>
  <button id="loop-button">Loop Audio</button>

The script is working as expected and Anki is actually getting the audio from the {{Loop}} field (which includes the filename of the mp3).

I understand now this message means there might be more media that’s referenced somewhere within a tag in a template but Anki is unable to account for it and therefore might not appear as missing/unused in the Check Media process. There is probably nothing wrong with this, but to be honest at first it looked to me as if there is something I should fix. And it looks like I am not alone (1, 2).

So my suggestion is to change the wording of the message to better inform users of what’s going on. Maybe something like:

Some of your cards have media file references inside HTML tags in templates. Please, be aware that Anki cannot detect these files and therefore the unused/missing media reported here does not account for them. The affected templates are: XXXXXXX

Or something to that effect. I’m sure someone could phrase it better, but just to give an idea.

For now, the check can be avoided by using the <source> tag.

<audio id="audio-player">
  <source src="{{Loop}}" type="audio/mpeg" />

1 Like

Working good as a workaround, thanks!