Video controls Property - Enable, disable and check controls status: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Video

Description

Video controls Property - Enable, disable and check controls status:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="320" height="240">
  <source src="your.mp4" type="video/mp4">
  <source src="your.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video><br>

<button onclick="enableControls()" type="button">Enable controls</button>
<button onclick="disableControls()" type="button">Disable controls</button>
<button onclick="checkControls()" type="button">Check controls status</button>

<script>
var x = document.getElementById("myVideo");

function enableControls() {/*from ww w. ja v  a2 s.co  m*/
    x.controls = true;
    x.load();
}

function disableControls() {
    x.controls = false;
    x.load();
}

function checkControls() {
    console.log(x.controls);
}
</script>

</body>
</html>

Related Tutorials