This is the logic that i have written to mute the video and audio
const mute = async(type)=>{
if(type==="audio"){
await tracks[0].setEnabled(!trackState.audio);
setTrackState((ps)=>{
return {...ps, audio:!ps.audio};
});
}
else if(type==="video"){
await tracks[1].setEnabled(!trackState.video);
console.log("iamclosign my video", tracks[1], client.uid)
setTrackState((ps)=>{
return {...ps, video:!ps.video};
});
}
}
and below is where i am calling this function
<button className='btn' onClick={()=>mute("audio")}>
{trackState.audio?<i class="fa-solid fa-microphone fa-2xl mx-2" style={{'color': '#ffffff'}}></i>
:<i class="fa-solid fa-microphone-slash fa-2xl mx-2" style={{'color': '#ffffff'}}></i>}
</button>
<button className='btn' onClick={()=>mute("video")}>
{trackState.video?<i class="fa-solid fa-video fa-2xl mx-2" style={{'color': '#ffffff'}}></i>
:<i class="fa-solid fa-video-slash fa-2xl mx-2" style={{'color': '#ffffff'}}></i>}
</button>
after pressing the video mute button only for local user the stream is disbabled but the other users (remote) are able to see the video
local users console
remote user console

I am trying to write a code for audio vedio on off button but the vedio is not disabling from remote side although it is disabled from user side