title: Cant Record Stream Using MediaRecorder In Server?
body: <p>First I am trying to make a Webrtc peer connection from the browser to the server using SFU model.</p>
  <p>Here is the post request which makes the webrtc peer connection from the browser to the server(SFU)</p>
  <pre><code>app.post(&quot;/broadcast&quot;, async ({ body }, res) =&gt; {
    const peer = new webrtc.RTCPeerConnection({
      iceServers: [
        {
          urls: &quot;stun:stun.stunprotocol.org&quot;,
        },
      ],
    });
    peer.ontrack = (e) =&gt; handleTrackEvent(e, peer); &lt;-- Important
    const desc = new webrtc.RTCSessionDescription(body.sdp);
    await peer.setRemoteDescription(desc);
    const answer = await peer.createAnswer();
    await peer.setLocalDescription(answer);
    const payload = {
      sdp: peer.localDescription,
    };
  
    res.json(payload);
  });
  </code></pre>
  <p>In the handleTrackEvent function, I am getting the stream which I want to start record and save in the server's local storage.</p>
  <pre><code>function handleTrackEvent(e, peer) {
    console.log(e.streams);
    senderStream = e.streams[0];
    var recorder = new MediaStreamRecorder(e.streams);
    recorder.recorderType = MediaRecorderWrapper;
    recorder.mimeType = &quot;video/webm&quot;;
    recorder.ondataavailable = (blob) =&gt; {
      console.log(blob);
    };
    recorder.start(5 * 1000); &lt;-- Error generator
  }
  </code></pre>
  <p>But when try to start the recording and get the blob in 5 sec intervals, it gives me &quot;MediaRecorder Not Found&quot; ...</p>
  <pre><code>Passing following params over MediaRecorder API. { mimeType: 'video/webm' }
  /Users/tecbackup/webrtc-peer/node_modules/msr/MediaStreamRecorder.js:672
              mediaRecorder = new MediaRecorder(mediaStream);
              ^
  
  ReferenceError: MediaRecorder is not defined
  </code></pre>
  <p>I am very new to webrtc, I need some suggestion to save the live stream from the browser to the server....In future, if find the blob, then I will save the blobs sequentially in a mp4 file in the server. Then, on runtime i start pressing ffmpeg in that mp4 file to get 240p, 360p, 720p ts files for hls streaming</p>