JSFiddle - React, Tailwind, and code Playground
by SpiceLab
HTML
<article>
<video id="myVideo" width="320" height="176" autoplay>
<source src="https://www.w3schools.com/tags/mov_bbb.mp4" type="video/mp4">
<source src="https://www.w3schools.com/tags/mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<button onclick="getVolume()" type="button">getVolume</button>
<button onclick="setSilenceVolume()" type="button">setVolume '0.0'</button>
<button onclick="setFullVolume()" type="button">setVolume '1.0'</button>
</article>
<script>
var vid = document.getElementById("myVideo");
function getVolume() {
alert(vid.volume);
}
function setSilenceVolume() {
vid.volume = 0.0;
}
function setFullVolume() {
vid.volume = 1.0;
}
window.onload = function() {
setSilenceVolume();
}
</script>
CSS
article,video {margin:10px 0}
video {display:block}