androidandroid-cameramediarecorderstagefright

How to set the max duration for camera preview and media recording in android


I am testing preview and recording use cases in Android. The camera preview is running for few seconds and getting terminated by itself (without pressing back button). I want to test continuous preview, is it possible to achieve this?

How to set the maximum duration of the media recorder? Could you please direct me to any resource which shows how to do that?

Thanks in advance.


Solution

  • MediaRecorder recorder;
    
    recorder.setMaxDuration(10000);