让 youtube 控件始终可见

keep youtube controls always visible

我正在尝试制作一个 chrome 扩展,使控件在本地 YouTube 页面中的 YouTube 视频中始终可见。

到目前为止我有这个 js

$(document).ready(function() {  
 
   setInterval(function(){
       $('.ytp-autohide').removeClass('ytp-autohide');
       $('#player-container').mouseover();
   },100);
   
});

但是删除 ytp-autohide class 会停止 timer/bar 进度,我无法弄清楚如何通过 js 鼠标悬停或类似的方式激活 showcontrols 功能。

我能否以某种方式保持进度条和时间,或者交替使用 js 重新创建 mouseover showcontrols 功能?

那就是:

setTimeout(function(){

    let video = document.querySelector("#movie_player")

    setInterval(function(){
      video.dispatchEvent(new Event('mousemove'));
    },100);
},1500)

所以你没有定位正确的元素并且你没有正确触发事件。