<!DOCTYPE html>
<html>
<body>
<video id="myVideo" width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<p>Click the buttons to get or set the volume of the video.</p>
<button onclick="getVolume()" type="button">What is the volume?</button>
<button onclick="setHalfVolume()" type="button">Set volume to 0.2</button>
<button onclick="setFullVolume()" type="button">Set volume to 1.0</button>
<script>
var x = document.getElementById("myVideo");
function getVolume() {
alert(x.volume);
}
function setHalfVolume() {
x.volume = 0.2;
}
function setFullVolume() {
x.volume = 1.0;
}
</script>
</body>
</html>