How to remove Echo and Noise while recording ,video in (both video stream and audio stream) in javascript

I have to record video on my web page and I have to show the video to the user.kind off device testing. But when I render the video on the web page, I’m hearing echo and noise.
Below is the code I used

<video autoplay></video>
<script>
const constraints = {
video: true,
audio: true
};
const video = document.querySelector('video');
navigator.mediaDevices.getUserMedia(constraints).
then((stream) => {video.srcObject = stream});
</script>

Source: AngularJS