Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Youtube keep video controls active

27 Nov 2022 »
let loop = () => {
  document.querySelector('.ytd-player').children[0].setAttribute('class', 'html5-video-player ytp-transparent ytp-exp-bottom-control-flexbox ytp-exp-ppp-update ytp-fit-cover-video ytp-fine-scrubbing-exp ytp-hide-info-bar ytp-large-width-mode ytp-autonav-endscreen-cancelled-state')
  setTimeout(() => {
    loop()
  }, 100)
}
loop()    
let button = document.createElement('button')
button.onclick = () => {
  if (1){
    let loop = () => {
      document.querySelector('.ytd-player').children[0].setAttribute('class', 'html5-video-player ytp-transparent ytp-exp-bottom-control-flexbox ytp-exp-ppp-update ytp-fit-cover-video ytp-fine-scrubbing-exp ytp-hide-info-bar ytp-large-width-mode ytp-autonav-endscreen-cancelled-state')
      setTimeout(() => {
        loop()
      }, 100)
    }
    loop()    
  }else{
    let video = document.querySelector("#movie_player")
	let loop = () => {
		video.dispatchEvent(new Event('mousemove'));
		setTimeout(() => {
			loop()
		}, 100)
	}
    loop()
  }
}
button.style.position = 'fixed'
button.style.top = '1px'
button.style.right = '200px'
button.style.fontSize = '10px'
button.style.zIndex = 9999999999999
button.innerText = 'keep'
document.querySelector('body').appendChild(button)

26sep23 -> not working anymore :(

https://stackoverflow.com/questions/65586000/keep-youtube-controls-always-visible

setTimeout(function(){
    let video = document.querySelector("#movie_player")

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