# JavaScript with Anki default media

**URL:** <https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207>\
**Category:** Help\
**Created:** [June 25, 2026, 3:09am UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207 "2026-06-25T03:09:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sousas](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Sousas](https://forums.ankiweb.net/u/Sousas)\
**Post date:** [June 25, 2026, 3:09am UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/1 "2026-06-25T03:09:10Z")

</div>

In AnkiDroid there are currently two ways to use media in notes.

Standard Anki media:

sound:meuaudio.mp3\] \[sound:meuvideo.mp4

and HTML media:

\<audio src=“meuaudio.mp3” controls\>\</audio\> \<video src=“meuvideo.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:meuvideo.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=“meuvideo.mp4” controls\>\</video\>

But with audio this does not happen.

When using:

sound:meuaudio.mp3

the audio is still rendered as:

\<a class=“soundLink” href=“playsound:q:1”\>

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” href=“playsound:q:1”\>

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” href=“playsound:q:1”\>

This would help a lot of users who rely on JavaScript in their cards.

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [June 26, 2026, 12:18am UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/2 "2026-06-26T00:18:59Z")

</div>

Consider editing your message to put sound tags and HTML tags ``between backticks in code blocks`. Right now some of your message is being processed by the forum as LaTeX or HTML, so some of it is unclear.

---

<div class="post-metadata">

**Author:** ![Sousas](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Sousas](https://forums.ankiweb.net/u/Sousas)\
**Post date:** [June 26, 2026, 7:57pm UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/3 "2026-06-26T19:57:51Z")

</div>

In AnkiDroid there are currently two ways to use media in notes.

Standard Anki media:

```plaintext
[sound:audio.mp3]
[sound:video.mp4]

```

and HTML media:

```html
<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:

```plaintext
[sound:file]

```

However, I noticed that in recent versions the video behavior changed.

Even when using:

```plaintext
[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:

```html
<video src="video.mp4" controls></video>

```

But with audio this does not happen.

When using:

```plaintext
[sound:audio.mp3]

```

the audio is still rendered as:

```html
<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:

```html
<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:

```html
<a class="soundLink">

```

This would help a lot of users who rely on JavaScript in their cards.

---

<div class="post-metadata">

**Author:** ![Sousas](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Sousas](https://forums.ankiweb.net/u/Sousas)\
**Post date:** [June 26, 2026, 8:38pm UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/5 "2026-06-26T20:38:32Z")

</div>

Sorry, Denika. I tried to edit the post, but it’s not working anymore because it’s no longer allowed. I also tried to delete it, but that’s not allowed anymore either. So I made another post like you advised. Then I created a new post with this name: “JavaScript with Anki default media”. When you have time, please take a look.

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [June 26, 2026, 10:28pm UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/6 "2026-06-26T22:28:52Z")

</div>

I saw that and merged it here. I’ve also un-deleted it now.  
Thanks for trying, but let’s keep this in a single thread.

---

<div class="post-metadata">

**Author:** ![Sousas](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Sousas](https://forums.ankiweb.net/u/Sousas)\
**Post date:** [June 28, 2026, 2:17am UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/7 "2026-06-28T02:17:41Z")

</div>

Thanks again, Denika

But do you know the answer to this?

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [July 1, 2026, 11:11pm UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/8 "2026-07-01T23:11:58Z")

</div>

I do not – I don’t use video or JavaScript. But let’s see what the devs have to say about it.

While you’re waiting, go to `Settings > About` – click `Copy debug info` – and paste that entire result here, so they know the details of your setup.

---

<div class="post-metadata">

**Author:** ![Sousas](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Sousas](https://forums.ankiweb.net/u/Sousas)\
**Post date:** [July 3, 2026, 1:47am UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/9 "2026-07-03T01:47:17Z")

</div>

I’m using only the standard Anki syntax:

```plaintext
[sound:audio.mp3]
[sound:video.mp4]

```

No custom media handling or special configuration.

This behavior is not specific to my device. It happens on any phone running a recent version of AnkiDroid.

I only noticed that videos are now rendered as HTML5 `<video>` elements, which is great for JavaScript because properties like playbackRate, events, and other native APIs work normally.

However, audio generated with

```plaintext
[sound:audio.mp3] 

```

still rendered as something like:

`<a class="soundLink" href="playsound:q:1"> `

instead of an HTML5 `<audio>` element, so JavaScript cannot access the native audio properties and methods.

My question is whether this difference is intentional and meant to be long-term, and if there are any plans for audio to eventually use `<audio>` as well.

```plaintext
AnkiDroid Version = 2.23.3 (9001068fd4819c6fb66cb8239e7166868ab47859)
Backend Version = 0.1.62-anki25.09.2 (25.09.2 3890e12c9e48c028c3f12aa58cb64bd9f8895e30)
Android Version = 11 (SDK 30)
ProductFlavor = play
Device Info = samsung | samsung | a20s | a20sub | SM-A207M | qcom
Webview User Agent = Mozilla/5.0 (Linux; Android 11; SM-A207M Build/RP1A.200720.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/149.0.7827.163 Mobile Safari/537.36
ACRA UUID = 007663ac-11e9-4f1f-8648-521800eff6c1
FSRS = 5.1.0 (Enabled: null)
Crash Reports Enabled = true

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [August 2, 2026, 1:48am UTC](https://forums.ankiweb.net/t/javascript-with-anki-default-media/70207/10 "2026-08-02T01:48:10Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
