is there anyway to make Volume 0% in safari browser using react/javascript?

187 Views Asked by At

I am building a react app. its using react and daily.co for video calls. Can someone suggest me a way to control volume and make it 0% if needed to mute participants using JavaScript AND REACT . kindly include a code example for more clarity.

I googled a number of libraries but im not sure which one i should use to achieve this.

1

There are 1 best solutions below

0
mikenlanggio On

If you want to control system volume, you cannot.
Javascript can control video or audio on its site.
For example:

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

Which values:

1.0 is highest volume (100%. This is default)
0.5 is half volume (50%)
0.0 is silent (same as mute)

See more: w3schools

To do the same in ReactJS you can use useRef hook to reference to video/audio you want to control and do the same above