Video startar with autoplay, but with volume in 50% or mute!

Asked

Viewed 1,103 times

1

My video tag shows my video/audio controls perfectly. Everything works. But I need to set the audio between 30% and 50% or even mute. You can do this with CSS and/or JS?

<video width="960" height="550" controls autoplay loop>
    <source src="video.mp4" type="video/mp4">
    <source src="movie.ogg" type="video/ogg">
    Seu navegador não suporta o aquivo de vídeo.
</video>

1 answer

3


To mute the video or audio:

<video muted id="myVideo">
....
</video>

To control the volume javascript is used:

var vid = document.getElementById("myVideo");
vid.volume = 0.2;

Using jQuery:

$("myVideo").prop("volume", 0.5);

Sources: W3schools, W3schools

  • Antony, easy to use the "muted". Vlw by the tip. I’m still crawling in the area. JS is still a bit confusing for me. But vlw for having shown the options. It only worked with MUTED. It looked like this: <video width="960" height="550" Controls autoplay loop muted> Thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.