Search code examples
audiovideochatwebrtc

How to avoid echo and noise in javascript for webrtc


I am trying to implement a webrtc-based chat room. And I encountered the following problems in laptop. Without connecting to any other peer, just use getUserMedia(), I can get local video stream.

When I unmuted the <video>, echo happened.

Then I wear headphones, and found there is a continued noise. And I can hear my voice clearly.

I tried to turn down the volume, but it doesn't work.

Thanks in advance.


Solution

  • Make sure that you are muting the local <video> element if you have it in the DOM:

    <video id="vid1" autoplay="true" muted="muted"></video>
    

    See this post on the discuss-webrtc mailing list for more details and the WebRTC samples.