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

150
Views
How to make a button that changes video's playstate?

I wanted to make a joke website and rickroll my friends, but I can only make a video autoplay with muted sounds. So I thought of making a fake cookie consent button that changes the video playstate (basically a button that plays the video)

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

0

function videoPlay() {
    var video = document.getElementById('myvideo');
    var btn = document.getElementById('playBtn');
    if (video.paused) {
        video.play();
        btn.innerHTML = "Pause"
    } else {
        video.pause();
        btn.innerHTML = "Play"
    }
}
<video id="myvideo" src="https://www.w3schools.com/html/mov_bbb.mp4"></video>
    <button id="playBtn" onclick="videoPlay()">Play</button>

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!