# Timer alert (beep / vibration) when Maximum Answer Time is reached

**URL:** <https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153>\
**Category:** Help\
**Created:** [June 19, 2026, 7:56am UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153 "2026-06-19T07:56:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aleks\_ya](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/aleks_ya/32/22205_2.png) [@aleks\_ya](https://forums.ankiweb.net/u/aleks_ya)\
**Post date:** [June 19, 2026, 7:56am UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/1 "2026-06-19T07:56:32Z")

</div>

Hello,

I often get distracted by my own thoughts while reviewing cards in AnkiDroid.  
I like the built-in on-screen timer that shows the time spent on each card, but I tend to lose track of time.

Is there any way to **make the timer vibrate or play a short beep** when the maximum answer time is reached?

Thank you!

---

<div class="post-metadata">

**Author:** ![ZornHadNoChoice](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/zornhadnochoice/32/28874_2.png) [@ZornHadNoChoice](https://forums.ankiweb.net/u/ZornHadNoChoice)\
**Post date:** [June 19, 2026, 12:27pm UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/2 "2026-06-19T12:27:21Z")

</div>

Add an audio file prefixed with an underscore to your `collection.media` folder or make a note with an audio file and use the name AnkiDroid assigns to it.

Add this code to your templates. You should change the name and time (in milliseconds):

```html
<script>
var audio = new Audio('_alertAudio.mp3');

setTimeout(() => {
audio.play();
}, 3000);
</script>

```

---

<div class="post-metadata">

**Author:** ![kaiu](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kaiu/32/32616_2.png) [@kaiu](https://forums.ankiweb.net/u/kaiu)\
**Post date:** [June 19, 2026, 12:51pm UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/3 "2026-06-19T12:51:51Z")

</div>

Vibration is also not difficult to do, here is vibration and a pause of 100 ms between them

```auto
navigator.vibrate([200, 100, 200]);

```

---

<div class="post-metadata">

**Author:** ![aleks\_ya](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/aleks_ya/32/22205_2.png) [@aleks\_ya](https://forums.ankiweb.net/u/aleks_ya)\
**Post date:** [June 20, 2026, 8:54am UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/4 "2026-06-20T08:54:45Z")

</div>

Thank you @ZornHadNoChoice and @kaiu !

Combining your approaches and AI I finished with this version (tap on the text tests the vibration):

```javascript
<div id="t" style="font-size:0.5em;text-align:right;margin:15px 0;color:grey;cursor:pointer">Time: 60s</div>
<script>
const S=60; let t=S; const d = document.getElementById('t');
function u(){d.textContent=`Time: ${t}s`;}
function vibrate() {if ("vibrate" in navigator) navigator.vibrate([800]);}
setInterval(()=>{t--; u(); if(t<=0){vibrate(); t=S; u();}},1000);
d.addEventListener('click', vibrate); u();
</script>

```

It’s compacted, because it’s copied to all card types.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/2/b/2b068e48810e2c0737035a006b8020cd0c6fbbf8.jpeg)

---

<div class="post-metadata">

**Author:** ![rizkym389](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/rizkym389/32/34104_2.png) [@rizkym389](https://forums.ankiweb.net/u/rizkym389)\
**Post date:** [June 26, 2026, 4:08am UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/5 "2026-06-26T04:08:17Z")

</div>

thank you!

---

<div class="post-metadata">

**Author:** ![rizkym389](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/rizkym389/32/34104_2.png) [@rizkym389](https://forums.ankiweb.net/u/rizkym389)\
**Post date:** [June 26, 2026, 4:58am UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/6 "2026-06-26T04:58:53Z")

</div>

i have better code, just change the number in the div or span. this will countdown to 0 and auto changes to red

```auto
<span class="amx-timer-widget" style="font-size:0.5em;text-align:right;margin:15px 0;color:inherite;opacity:75%;cursor:pointer">Time: 45s</span>
<span class="amx-timer-widget">Timer 1: 30s</span>
<span class="amx-timer-widget">Timer 1: 20s</span>

<!--- 13:02 revision --->
<script>
(function(){
  // bersihkan semua timer dari render/kartu sebelumnya dulu
  if(window.__amxTimerRegistry){
    window.__amxTimerRegistry.forEach(id=>clearInterval(id));
  }
  window.__amxTimerRegistry = [];

  document.querySelectorAll('.amx-timer-widget:not([data-amx-init])').forEach(function(el){
    el.setAttribute('data-amx-init','1');
    const match=el.textContent.match(/^(.*?)(\d+)\s*s?\s*$/);
    const label=match?match[1].trim():'Time';
    const duration=match?parseInt(match[2]):60;
    let remaining=duration;
    let tickInterval=null;

    function render(){
      el.textContent=`${label} ${remaining}s`;
      el.style.color=remaining<=0?'red':'';
    }
    function buzz(){ if("vibrate" in navigator) navigator.vibrate([800]); }

    function startTicking(){
      if(tickInterval) clearInterval(tickInterval);
      tickInterval=setInterval(()=>{
        remaining--;
        if(remaining<=0){
          remaining=0; render(); buzz();
          clearInterval(tickInterval);
        } else {
          render();
        }
      },1000);
      window.__amxTimerRegistry.push(tickInterval);
    }

    el.addEventListener('click',()=>{
      buzz();
      if(remaining<=0){
        remaining=duration; render(); startTicking();
      }
    });

    render();
    startTicking();
  });
})();
</script>

```

![Shine Bocchi GIF](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/8/5/856eff89e665607f205a26e8e520ec8477223694.gif)

---

<div class="post-metadata">

**Author:** ![rizkym389](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/rizkym389/32/34104_2.png) [@rizkym389](https://forums.ankiweb.net/u/rizkym389)\
**Post date:** [June 26, 2026, 6:04am UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/7 "2026-06-26T06:04:00Z")

</div>

I’ve fixed the front-back vibration. no more mistakes for this new revision!

---

<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:** [July 26, 2026, 6:04am UTC](https://forums.ankiweb.net/t/timer-alert-beep-vibration-when-maximum-answer-time-is-reached/70153/8 "2026-07-26T06:04:46Z")

</div>

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