title: Firefox's MediaRecorder interface only providing new video data every two seconds
body: <p>I'm trying to send a video stream obtained via WebRTC's getUserMedia() method to the server for additional processing. Latency is important, as I wish to detect changes in the video stream and update the client immediately. For this particular use, a Firefox-only solution is acceptable, and so I'm investigating the <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder_API" rel="nofollow">MediaRecorder</a> interface. </p>
  
  <p>I've put together a simple test case, included below. There are no errors, and the ondataavailable callback is called every 500ms, as expected. However, for three out of four of these calls, the size of the data provided is zero. This suggests to me that the data is being grouped into chunks of about two seconds (possibly due to constraints of the video encoding being used).</p>
  
  <p>Is it possible to get MediaRecorder to provide data at a finer granularity? If not, what is the best way to get video data from the userMedia stream to the server with low latency? An interface specific to Chrome or Firefox would be fine, but one that worked in both would be even better.</p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;h1&gt;MediaRecorder Test&lt;/h1&gt;
      &lt;video id="video" width="640" style="border: 1px solid black"&gt;&lt;/video&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;script&gt;
   // The variable that holds the video stream
   var mediastream = null;
  
   // Start video capture (and provide a way to stop it)
   navigator.mozGetUserMedia ( { video: true, audio: false },
     function(stream_arg) {
       mediastream = stream_arg;
       var vendorURL = window.URL || window.webkitURL;
       video.src = vendorURL.createObjectURL(mediastream);
       video.play();
       recordStream();
     },
     function(err) { console.log("Error starting video stream: " + err); }
   );
  
   // Record the stream
   var recorder = null;
   function recordStream() {
     recorder = new MediaRecorder(mediastream);
     recorder.ondataavailable = function(ev) {
       console.log("Got: "+ev.data.size);
     };
     recorder.start(500);
   }
  &lt;/script&gt;
  </code></pre>