Last active
April 19, 2022 16:31
-
-
Save enobufs/f4ea4d248289adc5a18e8d79c2e92684 to your computer and use it in GitHub Desktop.
MediaTrackSettings.echoCancellation Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
<style> | |
html, body{ | |
height: 100%; | |
width: 100%; | |
} | |
#video{ | |
height: 300px; | |
width: 300px; | |
} | |
</style> | |
<script> | |
$(() => { | |
var constraints = { | |
audio: { | |
echoCancellationType: 'system', | |
echoCancellation: true, | |
noiseSuppression: true, | |
sampleRate:24000, | |
sampleSize:16, | |
channelCount:2, | |
volume:0.5 | |
}, | |
video: { | |
width:320, | |
height:240, | |
frameRate:{ideal:60, min:10} | |
} | |
} | |
navigator.mediaDevices.getUserMedia(constraints).then((stream) => { | |
$('#video')[0].srcObject = stream; | |
let statusHtml = ''; | |
stream.getTracks().forEach((track) => { | |
statusHtml = statusHtml + track.kind+":"+JSON.stringify(track.getSettings(), null, 2)+'<br>'; | |
console.log('settings:', track.getSettings()); | |
console.log('capabilities:', track.getCapabilities()); | |
}) | |
$('#status').html(statusHtml); | |
}).catch((err) => { | |
console.log(err); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>Echo Cancellation Test</h1> | |
<p>Try changing values of echoCancellation, noiseSuppression properties in the code.</p> | |
<div> | |
<video id='video' autoplay='false' playsinline='false'></video> | |
<pre id='status'></pre> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you