refac: audio input

This commit is contained in:
Timothy Jaeryang Baek 2025-01-02 02:32:51 -08:00
parent fab82b51de
commit 43964de675
2 changed files with 14 additions and 2 deletions

View File

@ -217,7 +217,13 @@
const startRecording = async () => { const startRecording = async () => {
if ($showCallOverlay) { if ($showCallOverlay) {
if (!audioStream) { if (!audioStream) {
audioStream = await navigator.mediaDevices.getUserMedia({ audio: true }); audioStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
} }
mediaRecorder = new MediaRecorder(audioStream); mediaRecorder = new MediaRecorder(audioStream);

View File

@ -161,7 +161,13 @@
const startRecording = async () => { const startRecording = async () => {
startDurationCounter(); startDurationCounter();
stream = await navigator.mediaDevices.getUserMedia({ audio: true }); stream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
mediaRecorder = new MediaRecorder(stream); mediaRecorder = new MediaRecorder(stream);
mediaRecorder.onstart = () => { mediaRecorder.onstart = () => {
console.log('Recording started'); console.log('Recording started');