Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

77
Views
Can't disable controls in a youtube video

I am running a content.js on a youtube page and i want it to disable the controls of the youtube video. I am getting the video by video=document.querySelector('video'); and when trying to do: video.controls=false; it does'nt work. Would love some help

content.js

here is the video tag when I run the code on youtube's console: enter image description here

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

let video = document.getElementById('vid');
video.removeAttribute('controls')
<div style="display:flex;flex-direction:column">
  Vid 1 :
  <video id="vid" controls>
    <source src="#" />
  </video>
  Vid 2 :
  <video id="vid2" controls>
    <source src="#" />
  </video>
</div>

See this post, on your <video> tag, you dont want to put controls if you don't want them
quick example :

<video width="400px" height="400px" controls> // this will show controls
   <source src="link" />
</video>
<video width="400px" height="400px"> // this won't show controls
   <source src="link" />
</video>
about 4 years ago · Juan Pablo Isaza Report

0

I've used @wOxxOm advice and figured out how to hide the play button and the timeline bar.

Here is the used code:

playButton=document.getElementsByClassName("ytp-play-button ytp-button")[0];
bar=document.getElementsByClassName("ytp-progress-bar-container")[0];

playButton.style.display="none";
bar.style.display="none";
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!