From a82e90499b84a7481240fe5d78217e1af74826d9 Mon Sep 17 00:00:00 2001 From: Zhi Wang Date: Wed, 19 Jan 2022 18:31:44 -0500 Subject: [PATCH] update slider to use oninput, instead of onchange, but rate-limit it to twice per second --- assets/template/replay.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/assets/template/replay.html b/assets/template/replay.html index c36e5dc..ca8768f 100644 --- a/assets/template/replay.html +++ b/assets/template/replay.html @@ -40,7 +40,8 @@ - + @@ -84,7 +85,20 @@ } } + // limit the rate of refresh to twice per second. Otherwise + // the screen flicks like crazy + var lastFired = new Date().getTime() + function seek(end) { + var now = new Date().getTime() + var elapsed = now - lastFired + + if (elapsed <= 500) { + return + } + + lastFired = now + // pause the play if it is currently playing if (!icon.src.includes("play")) { playbtn()