Play & Pause HTML5 Video with Buttons
Oct 16, 2020 | HTML, Video
<video id="play" width="320" height="240" poster="" controls>
<source src="video.mp4" type="video/mp4">
<source src="video.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<script>
var video = document.getElementById("play");
function play_video() {
video.play();
}
function pause_video() {
video.pause();
}
</script>
<button onclick="play_video()" type="button">Play</button>
<button onclick="pause_video()" type="button">Pause</button>
Use buttons to control the play and pause functions on HTML5 videos.