<video id="videoPlayer" controls> <source src="sample-video.mp4" type="video/mp4"> </video> <progress id="progressBar" value="0" max="100"></progress> <script> var videoPlayer = document.getElementById("videoPlayer"); var progressBar = document.getElementById("progressBar"); videoPlayer.ontimeupdate = function() { var percentage = (videoPlayer.currentTime / videoPlayer.duration) * 100; progressBar.value = percentage; }; </script>