<video id="videoPlayer" controls> <source src="sample-video.mp4" type="video/mp4"> </video> <p>Current Time: <span id="currentTime">0</span> seconds</p> <script> var videoPlayer = document.getElementById("videoPlayer"); var currentTimeDisplay = document.getElementById("currentTime"); videoPlayer.ontimeupdate = function() { currentTimeDisplay.innerHTML = Math.floor(videoPlayer.currentTime); }; </script>