title: capture video conference between 1:1 user and broadcast to an rtmp url
body: <p>I am currently working on nodejs and socket app that is currently doing 1:1 video conference that is using webrtc. Videos are two separate element in the html and i would like to merge them together so that i can broadcast to rtmp url for public view (2:many). Is this possible</p>
  <p>For webrtc, i followed this tutorial <a href="https://www.youtube.com/watch?v=DvlyzDZDEq4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=DvlyzDZDEq4</a>, and for broadcasting i am using ffmpeg which current does 1 video stream.</p>
  <p>Please confirm if this is doable</p>
  <p><strong>Update</strong></p>
  <p>I was able to merge the video using
  <a href="https://www.npmjs.com/package/video-stream-merger" rel="nofollow noreferrer">https://www.npmjs.com/package/video-stream-merger</a></p>
  <p>And now the final issue</p>
  <p>i am receiving merger.result which is merged stream and I tried to create a mediaRecorder object. Callback method for MediaRecorder ondataavailable is called only once but not every 250ms which i need to broadcast to youtube. How can i do this?</p>
  <pre><code>var merger = new VideoStreamMerger(v_opts);
  ...
  ...
  merger.start()
  myMediaRecorder = new MediaRecorder(merger.result);
  myMediaRecorder.start(250);
  myMediaRecorder.ondataavailable = function (e) {
      console.log(&quot;DataAvailable&quot;)
      //socket.emit(&quot;binarystream&quot;, e.data);
      state = &quot;start&quot;;
      //chunks.push(e.data);
  }
  </code></pre>