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

121
Views
HTML click button full screen

I am trying to inject my JS code in order to click the "fullscreen" button for this html video - http://techslides.com/demos/sample-videos/small.webm

Problem is, I don't know the function to call full screen. What is it called?

function fullScreenClick() {         
  var video = document.getElementsByTagName('video');     
  video[0].play();
}  

fullScreenClick();
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Try this :

<script>
var elem = document.getElementById("myvideo");
function openFullscreen() {
  if (elem.requestFullscreen) {
    elem.requestFullscreen();
  } else if (elem.webkitRequestFullscreen) { /* Safari */
    elem.webkitRequestFullscreen();
  } else if (elem.msRequestFullscreen) { /* IE11 */
    elem.msRequestFullscreen();
  }
}
</script>
about 4 years ago · Juan Pablo Isaza Report

0

You can do this simply by using the onClick function of the video element. First, you need to wrap your video inside the video tag. I have added the code so you can better see the example:

$('#video').click(function(){this.paused?this.play():this.pause();});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<video id="video"><source src="http://techslides.com/demos/sample-videos/small.webm"></video>

Or you can simply add the inline function into your HTML onclick tag.

about 4 years ago · Juan Pablo Isaza Report

0

It's element.requestFullscreen().

function fullScreenClick() {         
  var video = document.getElementsByTagName('video')[0];
  video.requestFullscreen();
}  

fullScreenClick();

To support IE and Safari, you might need to use webkitRequestFullscreen or msRequestFullscreen.

Check the document here or here.

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!