Capture and store video of few seconds
<p>I am trying to capture video streaming and got to work out the below (From this blog <a href="https://davidwalsh.name/browser-camera" rel="nofollow">https://davidwalsh.name/browser-camera</a>)</p>

<p>HTML code</p>

<pre><code>&lt;video id="video" width="640" height="480" autoplay&gt;&lt;/video&gt;
</code></pre>

<p>JS code</p>

<pre><code>// Grab elements, create settings, etc.
var video = document.getElementById('video');

// Get access to the camera!
if(navigator.mediaDevices &amp;&amp; navigator.mediaDevices.getUserMedia) {
    // Not adding `{ audio: true }` since we only want video now
    navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
        video.src = window.URL.createObjectURL(stream);
        video.play();
    });
}
</code></pre>

<p>Snapping a photo I can do from here (which anyways I am doing using <code>Jquery-Webcam</code> plugin).</p>

<p>Question: Following the above technique, How can I capture a video stream of say 50seconds? and save that to disk?</p>

<p>I know there are third party API (commercial) present for this stuff like <a href="https://tokbox.com/developer/sdks/dot-net/" rel="nofollow">OpenTok</a> but keeping those as last resort.</p>

<p>Any idea? Please share. Also no shy but my JavaScript skill is pretty beginner level, so a little code snippet example would be really appreciated and if not; pointing to documentation from where I could work stuff out; would also be great. </p>