Send microphone byte over websocket

Viewed 188

I'm worked on Walkie-talkie and I'm using angular and WebSocket , and this is my code :

navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
                recorder = new MediaRecorder(stream);  
                if(recorder.state === "recording"){
                    recorder.stop();
                }
                else{
                    recorder.start(500);
                    recorder.addEventListener('dataavailable', (async event => {
                        if (typeof event.data === 'undefined') return;
                        if (event.data.size === 0) return;   

                        event.data.arrayBuffer().then(buffer =>
                            funSendsocketData(socketData, new Uint8Array(buffer))
                        );  
                    }));
                }
                
            });

when the voice received by the server the voice is very noisy anyone has any idea

0 Answers
Related