-->

How to avoid echo and noise in javascript for webr

2020-02-19 08:29发布

问题:

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 , echo happened.

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

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

Thanks in advance.

回答1:

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.



回答2:

Do the followings:

1) In localVideo do the this:

localVideo.volume = 0;

localVideo.muted = 0;

2) Do same for the remoteVideo also:

remoteVideo.volume = 0;

remoteVideo.muted = 0;



回答3:

To resolve noise related issue, you should set autoplay=false for localstream.