title: MediaStreamRecorder stops recording when browser window minimized
body: <p>I am using <a href="https://github.com/streamproc/MediaStreamRecorder/blob/master/MediaStreamRecorder.js" rel="nofollow noreferrer">MediaStreamRecorder</a> which follows the <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder" rel="nofollow noreferrer">MediaRecorder API</a> for recording cross-browser audio and video streams.</p>
  
  <p>The problem that I am facing is that the <code>MediaStreamRecorder</code> stops firing its <code>ondataavailable</code> event whenever the browser window is minimized. Once you minimized it stops triggering the <code>ondataavailable</code> event and doesn't fire even if I comeback to the same windows unless or until I stops the recording and restart it again.</p>
  
  <p>It doesn't give any exception in the browser console. Everything works fine until you minimizes the browser window. Once you did that, it stops executing the code inside the function that executes on <code>ondataavailable</code> event.</p>
  
  <pre><code>var ws;
  
  function start() {
  
      ws = new WebSocket("wss://xyz/");
  
      ws.onopen = function () {
          console.log("WebSocket has been opened!");
      };
  
      ws.onmessage = function (message) {
          console.log("A messsage is received from WebSocket Server.", message);
      };
  
      ws.onclose = function (e) {
          console.log('WebSocket is closed. Reconnection will be attempted in 5 second.', e.reason);
          setTimeout(function () {
              start();
          }, 5000);
      };
  
      ws.onerror = function (err) {
          console.error('WebSocket encountered an error: ', err.message, 'Closing WebSocket');
          ws.close();
      };
  
  }
  
  start();
  
  
  function startRecording(localStream, remoteStream) {
  
      if (localStream != null &amp;&amp; remoteStream != null) {
  
          multiStreamRecorder = new MultiStreamRecorder([localStream, remoteStream], "video/webm");
          multiStreamRecorder.mimeType = "video/webm";
  
          multiStreamRecorder.ondataavailable = function (blob) {
  
              console.log("sending blob to websocket server");
              ws.send(blob);
  
          };
  
          multiStreamRecorder.start(1500);
  
      }
      else{
          console.error("One or more streams are null.");
      }
  
  }
  </code></pre>