keep youtube controls always visible

Viewed 426

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

so far i have this js

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

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.

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

1 Answers

That would be:

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.

Related