title: How to publish a live video stream from HTML and JavaScript?
body: <p>I have this piece of code which takes input the the camera and displays it within the web browser window (works only if served from a web server, not directly by opening a file):</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;video id="video" width="640" height="480" autoplay="true"&gt;&lt;/video&gt;
  
  &lt;script&gt;
      var video = document.getElementById('video');
      if (navigator.mediaDevices &amp;&amp; navigator.mediaDevices.getUserMedia) {
          navigator.mediaDevices.getUserMedia({video: true}).then(function (stream) {
              video.src = window.URL.createObjectURL(stream);
              video.play();
          });
      }
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>I'd like to live-stream the video it to a URL</strong> (example: to "/publish/?password=" as in <a href="https://github.com/vbence/stream-m" rel="nofollow noreferrer">https://github.com/vbence/stream-m</a>) </p>
  
  <p><strong>How do I code that?</strong></p>
  
  <p>Thanks!</p>