After UnMuting Mic in WebRTC there's a severe Local Loopback (Own Voice) problem in Chrome.

120 views
Skip to first unread message

Roy Singh

unread,
Jun 16, 2020, 5:09:46 AM6/16/20
to discuss-webrtc

We've successfully implemented WebRTC is our system for Audio Call and Video Call including the CoTurn STUN/TURN server etc.


All is working fine until we decided to implement a Mute Mic and Mute Webcam function (for Local Stream only) where we can still see or hear other party but they cant see or hear us.

When Muting the Mic (Local Stream) it works as it should with no problems but when we UnMute the Mic there seems to be a severe Loopback (we hear our own voice) from our Local Stream.


This behavior is ONLY IN CHROME we're using the latest Version 83.0.4103.97 (Official Build) (64-bit). We tried in the latest Firefox but this behavior is not there.


No matter what we tried we cant seem to eliminate this severe Loopback issue. I hope some friends here can help us please.


Here is our code that we currently use ;


var isMute = false;
$(document).on('click','#audio_mute_div',function(){
    var localStream = connection.attachStreams[0];
    console.log(localStream);
    if(isMute==false){
          isMute = true;;
          localStream.mute('audio');
          $('.audio_mute').attr('src','./assets/mute.png');
    }else{
         isMute = false;
         localStream.unmute('audio');
         $('.audio_mute').attr('src','./assets/audio.png');
    }
});

var isVideoMute = false;
$(document).on('click','#video_mute_div',function(){
    var localStream = connection.attachStreams[0];
    if(isVideoMute==false){
           isVideoMute = true;
           localStream.mute('video');
           $('.video_mute').attr('src','./assets/no-video.png');
    }else{
         isVideoMute = false;
         localStream.unmute('video');
         $('.video_mute').attr('src','./assets/video-camera.png');
    }
});

Eric Davies

unread,
Jun 16, 2020, 1:55:26 PM6/16/20
to discuss-webrtc
Mute the video object in which you are playing the local stream.

Roy Singh

unread,
Jun 16, 2020, 10:21:49 PM6/16/20
to discuss...@googlegroups.com
In our Video Call Window there 2 buttons (Mute Mic and Mute WebCam) we can do localStream.mute('video'); when UnMute Mic but then there's No Video but the Loopback Issue goes away but when we localStream.unmute('video'); again to enable the video the Loopback Issue comes back. So it would not be possible to conduct a Video Call if we can't localStream.unmute('video');.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/cda55555-5690-49d0-8f84-9ad4034fb290o%40googlegroups.com.

Roy Singh

unread,
Jun 17, 2020, 5:15:48 AM6/17/20
to discuss-webrtc

I managed to solve this problem by simply adding this line ;

connection.streamEvents.selectFirst('local').mediaElement.muted=true;

in the UnMute Function, so now the function looks like this ;

   isMute = false;
   localStream.unmute('audio');

   connection.streamEvents.selectFirst('local').mediaElement.muted=true;

   $('.audio_mute').attr('src','./assets/audio.png');

It solved the Loopback issue and it took me 5 days to look for this solution and finally found it here - https://www.rtcmulticonnection.org/docs/unmute/

share  edit  delete  flag 

Henrik Andreasson

unread,
Jun 17, 2020, 5:42:58 AM6/17/20
to discuss-webrtc
Please note that https://www.rtcmulticonnection.org/ is not an official build of WebRTC. Please ask questions related to that library separately.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Roy Singh

unread,
Jun 17, 2020, 9:28:39 PM6/17/20
to discuss-webrtc
Yes Bro Eric, what you said before was absolutely right but I wasn't able to find the command to do that in RTCMultiConnection even after going through their documentations a few times. Fortunately, I found the answer in the reply section of one of their sample pages and that too posted by another user. 

Thank You for leading me to the right logic to solve this Bro Eric... :)
Reply all
Reply to author
Forward
0 new messages