code: function startControlsTimeOut () {
  
        clearTimeout(controlsTimeout);
  
        if (controlsElement.style.display === "block") {
          controlsTimeout = setTimeout(function () {
            toggleControls();
          }, 5000);
        } else {
          toggleControls();
        }
      }
docs: Timeout feature for controls