title: Pause & Resume with Android MediaRecorder (API level < 24)
body: <p>While using <code>MediaRecorder</code>, we don't have pause/resume for API level below 24.
  So there can be a way to do this is:</p>
  
  <ol>
  <li>On pause event stop the recorder and create the recorded file.</li>
  <li>And on resume start recording again and create another file and keep doing so until user presses stop. </li>
  <li>And at last merge all files.</li>
  </ol>
  
  <p>Many people asked this question on SO, but couldn't find anyway to solve this. People talk about creating multiple media files by stopping recording on pause action and restarting on resume. So my question is How can we merge/join all media file programmatically?</p>
  
  <p><strong>Note:</strong> in my case MPEG4 container - m4a for audio and mp4 for video.</p>
  
  <p>I tried using <code>SequenceInputStream</code> to merge multiple InputStream of respective generated recorded files. But it always results the first file only. </p>
  
  <p><strong>Code Snippet:</strong></p>
  
  <pre><code>Enumeration&lt;InputStream&gt; enu = Collections.enumeration(inputStreams);
          SequenceInputStream sqStream = new SequenceInputStream(enu);
          while ((oneByte = sqStream.read(buffer)) != -1) {
              fileOutputStream.write(buffer, 0, oneByte);
  
          }
          sqStream.close();
          while (enu.hasMoreElements()) {
              InputStream element = enu.nextElement();
              element.close();
          }
          fileOutputStream.flush();
          fileOutputStream.close();
  </code></pre>