保持YouTube控件始终可见 [英] keep youtube controls always visible

查看:58
本文介绍了保持YouTube控件始终可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个Chrome扩展程序,以使控件始终在本机youtube页面中的youtube视频上始终可见.

i'm trying to make a chrome extension that keeps the controls always visible on a youtube video within the native youtube page.

到目前为止,我有这个js

so far i have this js

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

但是删除ytp-autohide类将停止计时器/栏进度,并且我无法弄清楚如何通过js mouseover或类似方法激活showcontrols函数.

but removing the ytp-autohide class stops the timer/bar progress and i cant figure out how to instead activate the showcontrols function via js mouseover or somesuch.

我可以保留进度栏吗?时间以某种方式还是用js重新创建mouseover showcontrols函数?

can i keep the progress bar & time going somehow or alternately recreate the mouseover showcontrols function with js?

推荐答案

那是:

setTimeout(function(){

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

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

因此,您没有针对正确的元素,并且没有正确触发事件.

So you where not targeting the right element and you where not triggering the event correctly.

这篇关于保持YouTube控件始终可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆