Video muted Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Video

Description

The muted property sets or gets whether the audio output of the video should be muted.

This property reflects the <video> muted attribute.

Set the muted property with the following Values

Value Description
true|false Sets whether the audio output of the video should be muted

Return Value

A Boolean, returns true if the audio output of the video is muted, otherwise it returns false

Default Value is false.

The following code shows how to Turn off sound for a video:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="320" height="240" controls muted>
  <source src="your.mp4" type="video/mp4">
  <source src="your.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>//from   ww w. j  a va  2  s  .com

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myVideo").muted = true;
}
</script>

</body>
</html>

Related Tutorials