# Audio echo after replacing audio track

**URL:** <https://openvidu.discourse.group/t/audio-echo-after-replacing-audio-track/4088>\
**Category:** Issues developing apps\
**Tags:** v2\
**Created:** [July 13, 2022, 4:15pm UTC](https://openvidu.discourse.group/t/audio-echo-after-replacing-audio-track/4088 "2022-07-13T16:15:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen\_Elkins1](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/glen_elkins1/32/1975_2.png) [@Glen\_Elkins1](https://openvidu.discourse.group/u/Glen_Elkins1)\
**Post date:** [July 13, 2022, 4:15pm UTC](https://openvidu.discourse.group/t/audio-echo-after-replacing-audio-track/4088/1 "2022-07-13T16:15:30Z")

</div>

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:

```auto
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](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
