0

I have a simple HTML5 video player. I would like it so when the user clicks a div on the site, this then opens the video up to fullscreen.

    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <div class="top-video">
        <video controls="" muted="" autoplay="" playsinline="" id="topVideo">
          <source src="https://player.vimeo.com/external/419906207.hd.mp4?s=7c6f9edf7137540923b2931ac0359420124e5d6e&profile_id=174&amp;loop=0&amp;autoplay=1" type="video/mp4">
        </video>
    </div>  

I have tried using jQuery to target this but cannot, does anyone have a solution?

Brad
  • 459
  • 2
  • 9

1 Answers1

2

According to the MDN documentation, an Element.requestFullscreen() could help you with that

$('#div-you-need-to-click').click((e) => {
  $('#topVideo')[0].requestFullscreen();
})
twerk kid
  • 76
  • 3