Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

muteLocalVideoStream not muting the video in agora

Iam new to react native. Iam using agora rtc (3.1.3) for video calling in my app. It works perfectly. We have some actions like switching camera and muting video etc. For muting video iam using the below code

 const toggleVideo = async () => {
    let mute = vidMute;
    console.log('Video toggle', mute);
    await (engine.muteLocalVideoStream(!mute));
    setVidMute(!mute)
}

Where engine is my RtcEngine created using my app id. Issue is muteLocalVideoStream has no effect on my video. Iam testing in iphone. Please help

like image 639
Nikhila Mohan Avatar asked Sep 01 '25 20:09

Nikhila Mohan


1 Answers

The muteLocalVideoStream method only stops the transmission of the video stream to remote users, it does not stop the video stream capture i.e. the local user can still view their video normally.

If you want to stop the video on the local user's device as well you can use the enableLocalVideo method instead. You can edit the code on line 4 - await (engine.enableLocalVideo(!mute));

I tried out your code on v3.1.6 of react-native-agora and everything works as expected.

like image 54
Ekaansh Arora Avatar answered Sep 05 '25 09:09

Ekaansh Arora