samedi 6 mars 2021

perform function when video's current time is greater than a certain value

i would like to hide a div after a video has reached a certain time. The following code is what I thought would in theory work but is not currently. Any solution would be appreciated!

 <body>
 <video id="vid" src="somevideo.mp4"></video>
 <div id="box"></div>
 <script>
    function hideDiv() {
  if (vid.currentTime > 5) {
  document.getElementById('box').style.display = 'none';
 }}

 </script>
 </body>

Aucun commentaire:

Enregistrer un commentaire