Giuseppe
Giuseppe

Reputation: 1089

How to limit record time with AudioRecord as MediaRecorder with setMaxDuration

I need to stop AudioRecord after 2 minutes from the starting time. With MediaRecorder I use setMaxDuration and this work well, but I need a good approach with AudioRecord too.

Thank's for help

Upvotes: 3

Views: 2462

Answers (1)

5hssba
5hssba

Reputation: 8079

You can try like this..

handler=new Handler();
 Runnable r=new Runnable() 
{
 public void run() 
{
  recorder.stop();
   recorder.release(); 
  } 

};
handler.postDelayed(r, 120000);

Upvotes: 4

Related Questions