3

I just want to use media recorder API to record the stream which I'm using in WebRtc for react-native. Actually I want to save the stream to a file on the backend server. and hence i need to send the data of buffers through the sockets once the media recorder's function (ondataavailable) is available. I've implemented it in the Web (using React.js) This is the code I'm using to send the recorded chunks to the backend server

const mediaRecorder = new MediaRecorder(_stream.current, recorderOptions);
   
    mediaRecorder.ondataavailable = (event) => {
      
      if (event.data && event.data.size > 0) {
        socket.emit("message1", event.data);
      }
    };

Or any other solution would be highly recommended. Thanks

0 Answers0