1

I am attempting to split a recording into 10 min movie clips while not interrupting the video recording. The application does not use any other activities to record, following the google tutorial for this. While recording, every 10 minutes I want to save the current 10min block to a file and continue recording. The next 10 minute block would be recorded at the 20min mark and so on.

EDIT: Added a snippet of code that I am currently using.

mMediaRecorder.setup(mCamera, mPreview);
    mMediaRecorder.setMaxDuration(10 * 60 * 1000);
    mMediaRecorder.setOnInfoListener(new MediaRecorder.OnInfoListener() {
        @Override
        public void onInfo(MediaRecorder mr, int what, int extra) {
            if(what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) {
                releaseMediaRecorder();
                prepareVideoRecorder();
                mMediaRecorder.start();
            }
        }
    });

This allows the functionality that I want, however, it is not seamless. The user sees the video pause briefly. Is there a way to allow the preview surface to continue running seamlessly while stoping and restarting the media recorder?

lostdev
  • 696
  • 6
  • 20
  • What is the actual error thrown by IllegalStateException shown as in your logcat? Also note: a media file isn't immediately usable after recording has been stopped. You need to actually wait for the system to finish writing the end-of-file markers which can take a few seconds (for which you can use a FileObserver to wait for write to finish: http://stackoverflow.com/a/7532572/1426565 ). You'd think that would be a callback for the MediaRecorder classes, but sadly it's not. – Cruceo Aug 21 '14 at 18:44
  • I updated the post with the code I currently use. The functions are pretty much exactly what's on the google tutorial found here .. http://developer.android.com/guide/topics/media/camera.html This works well enough, but I would like to improve the user experience by now having the preview surface stutter. – lostdev Aug 21 '14 at 20:36
  • did you find any solution to continuously save a video in 10-sec intervals while recording is on? – Abhishek Jan 16 '20 at 10:50
  • I also wonder if you found a solution for continuously saving the video, without interruption? – Tob237 Sep 18 '20 at 12:52

0 Answers0