title: How to directly stream out RTMP video from HTML without involving a middle server
body: <p>I thought it is straightforward to establish an RTMP output stream from the browser directly to an RTMP server. It was looking possible to me when I saw some streaming video API providers offer ready-made iFrame urls that capture the PC camera and establish a stream with their servers when embedded in Html. </p>
  
  <p>However - I was wrong.</p>
  
  <p>It's pretty easy to get your hands on the chunks. But how to push them to RTMP server?</p>
  
  <pre><code> navigator.getUserMedia({
         video: true,
         audio: true
   },
  
   function (stream) {
  
       var options = { mimeType: "video/webm; codecs=vp9" };
       mediaRecorder = new MediaRecorder(stream, options);
  
       mediaRecorder.ondataavailable = handleDataAvailable;
       mediaRecorder.start();
  
       function handleDataAvailable(event) {
  
         if (event.data.size &gt; 0) {
  
           console.log(recordedChunks);
  
      } 
  })
  </code></pre>