Audio echo after replacing audio track

I’ve been having an issue when switching camera with replaceTrack() where the audio input stopped working.

So i also use replaceTrack() to add back in the original microphone, most devices only have 1 mic so i always take the 0 position from getAudioTracks()

So my code to switch camera and keep the audio input:

this.OV.getUserMedia(<any>{
          videoSource: this.OVCurrentCamera === 'front' ? backDeviceId : frontDeviceId,
          audioSource: typeof audioDevices[0] !== 'undefined' ? audioDevices[0].deviceId : true
        }).then((mediaStream) =>  {

          let videoTrack = mediaStream.getVideoTracks()[0];
          let audioTrack = mediaStream.getAudioTracks()[0];


          console.log("USING VIDEO TRACK",videoTrack)
          console.log("USING audio TRACK",audioTrack)
          this.OVPublisher.replaceTrack(videoTrack).then(() => {
            this.OVCurrentCamera = this.OVCurrentCamera === 'front' ? 'back' : 'front';
          }).catch(() => {
            this.toast.error('There was a problem switching cameras.');
          })

          this.OVPublisher.replaceTrack(audioTrack).then(() => {
            console.log("AUDIO TRACK REPLACED")
            
          }).catch(()=>{
            this.toast.error('There was a problem activating your microphone.');
          })
        }).catch(() => {
          this.toast.error('Could not access devices');
        })

The problem now is that the publsher can hear themselves as like an echo, this issue has been reported before here: https://github.com/OpenVidu/openvidu/issues/449

Apparently this was fixed a few versions ago, but i’m still experiencing this in 2.20.0.

Has anyone a resolution for this? I have also attempted to use 2.22.0 and the issue still happens there as well.

So i can replace the video track and completely lose audio input, or i can also force to replace the audio track with the original to get the input again but with an echo.

As per the link above i’m going to try:

publisher.videoReference.muted = true

After the audio track is replaced, and i will report back.

UPDATE

That workaround didn’t do anything, the echo still happens! So now it’s either switch the camera and have no audio input, or have a publisher listening to themselves