From 39c3144e4cde185ab75a0fbfff14a0a4fa5ab8f4 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 28 Jul 2019 06:01:13 +0000 Subject: [PATCH] assets/scripts.js: Improve timer logic Use end of ongoing moments and start of upcoming moments too. --- assets/scripts.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/assets/scripts.js b/assets/scripts.js index 4861f0c..3110b06 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -220,15 +220,10 @@ function ontimeupdate(evt) { var ms = getCurrentMs(); currentSegment = getSegmentId(ms); - // ontimeupdate resolution is about a second. Augment it using timer. if (timerId) { clearTimeout(timerId); timerId = 0; } - if (currentSegment && nextSegment && nextSegment != currentSegment) { - var timeLeft = segmentMap.segments[currentSegment].endTimeMs - ms; - timerId = setTimeout(ontimeupdate, timeLeft); - } // Distinguish between the user seeking manually with