In AnkiDroid there are currently two ways to use media in notes.
Standard Anki media:
[sound:audio.mp3]
[sound:video.mp4]
and HTML media:
<audio src="audio.mp3" controls></audio>
<video src="video.mp4" controls></video>
The problem is that manually using HTML media is inconvenient because:
it is very tedious; you need to write HTML in every note; and you still need to include [sound:...] anyway, otherwise media export/sync may not work correctly.
So normally we just use:
[sound:file]
However, I noticed that in recent versions the video behavior changed.
Even when using:
[sound:video.mp4]
the rendered HTML in the reviewer now becomes an HTML5 <video> element, so JavaScript works normally (playbackRate, events, controls, etc.), as if the video had been manually written as:
<video src="video.mp4" controls></video>
But with audio this does not happen.
When using:
[sound:audio.mp3]
the audio is still rendered as:
<a class="soundLink">
instead of an HTML5 <audio> element.
Because of this, JavaScript cannot access native audio properties.
What is intriguing is that previously video was rendered the same way audio is rendered today, only with:
<a class="soundLink">
So my questions are:
Why is video now rendered as HTML5 <video>? Will this HTML5 video rendering be permanent? Is there any chance the same will eventually happen for audio? Or will audio permanently continue to be rendered as:
<a class="soundLink">
This would help a lot of users who rely on JavaScript in their cards.