From 1b1fc488ebb3213b03ea3ceb592cd5695b52e8b4 Mon Sep 17 00:00:00 2001 From: Perry Date: Tue, 25 Aug 2026 16:31:30 -0700 Subject: [PATCH] Fix overlay auto-hide timer ownership --- inject.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/inject.js b/inject.js index 79f4e583..af2ecdc8 100644 --- a/inject.js +++ b/inject.js @@ -889,16 +889,20 @@ function handleDrag(video, e) { parentElement.addEventListener("mousemove", startDragging); } -var timer = null; function showController(controller) { log("Showing controller", 4); controller.classList.add("vcs-show"); - if (timer) clearTimeout(timer); + // A page can contain multiple tracked media elements. Keep the timeout on + // the controller it belongs to so showing another controller cannot cancel + // this controller's pending hide. + if (controller.showTimeOut !== undefined) { + clearTimeout(controller.showTimeOut); + } - timer = setTimeout(function () { + controller.showTimeOut = setTimeout(function () { controller.classList.remove("vcs-show"); - timer = false; + controller.showTimeOut = undefined; log("Hiding controller", 5); }, 2000); }