From b4e04bccd1c6c87bd9a62b5ee4011e46ddf0c183 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 28 Jul 2019 01:14:19 +0000 Subject: [PATCH] assets/scripts.js: Improve handling of seeking - Don't apply impressions when the player seeks into moments with impression data - Fix false positives when seeking within the first few seconds of a segment --- assets/scripts.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/assets/scripts.js b/assets/scripts.js index fe89365..4b2be9a 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -185,13 +185,14 @@ function addChoices(r) { document.getElementById("choiceCaption").innerHTML = choicePoints[r.id].description; } -function momentStart(m) { - console.log('momentStart', m); +function momentStart(m, seeked) { + console.log('momentStart', m, seeked); if (m.type == 'scene:cs_bs') { addZones(currentSegment); addChoices(m); } - applyImpression(m.impressionData); + if (!seeked) + applyImpression(m.impressionData); } function momentUpdate(m, ms) { @@ -202,8 +203,8 @@ function momentUpdate(m, ms) { } } -function momentEnd(m) { - console.log('momentEnd', m); +function momentEnd(m, seeked) { + console.log('momentEnd', m, seeked); if (m.type == 'scene:cs_bs') { setNextSegment(null); addZones(currentSegment); @@ -213,6 +214,7 @@ function momentEnd(m) { } var timerId = 0; +var lastMs = 0; function ontimeupdate(evt) { var ms = getCurrentMs(); @@ -229,30 +231,33 @@ function ontimeupdate(evt) { timerId = setTimeout(ontimeupdate, timeLeft); } + // Distinguish between the user seeking manually with