I want to stop recording a video after a certain time e.g. 5 seconds.
Do you know how to do that with a MediaRecorder
?
How to stop MediaRecorder after certain time in Android?
3.7k views Asked by mafioso At
2
There are 2 answers
2
On
mCountdowntimer=new CountDownTimer(countdownPeriod, 1000) {//countdown Period =5000
public void onTick(long millisUntilFinished) {
textView.setText("seconds remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
mediaplayer.stop(); }
}.start();
and must not forget to call release(); after calling stop();
You can use a handler to step the recording after that time.
Regarding the timer:
Where formatted_time is something like that: