#video-player {
width: 800px;
height: 450px;
background-color: #000;
margin: 0 auto;
}
#video {
width: 100%;
height: 100%;
}
#controls {
position: absolute;
bottom: 0;
width: 100%;
background-color: rgba(0, 0, 0, 0.5);
color: #fff;
padding: 10px;
}
#play-pause {
background-color: #fff;
color: #000;
padding: 10px 20px;
border: none;
cursor: pointer;
}
#seek-bar {
width: 100%;
}
Copy code
// JavaScript for controlling the video player
var video = document.getElementById("video");
var playPauseButton = document.getElementById("play-pause");
var seekBar = document.getElementById("seek-bar");
video.addEventListener("timeupdate", function(){
var value = (100 / video.duration) * video.currentTime;
seekBar.value = value;
});
function playPause() {
if (video.paused) {
video.play();
playPauseButton.innerHTML = "Pause";
} else {
video.pause();
playPauseButton.innerHTML = "Play";
}
}
function seekBar() {
var seekBarValue = seekBar.value;
var seekTime = video.duration * (seekBarValue / 100);
video.currentTime = seekTime;
}