PnzrDrgoon
Lurker
Google has an example on how to record audio here:
Audio and Video | Android Developers
The problem with their example is they don't explain what to do to keep recording for a set time period. I've tried putting the thread to sleep for 10 seconds with Thread.sleep(10000); but that seems to make the recording stop.
Any help would be appreciated.
Edit:
Okay, so after some digging around I've tried to use
But after my 10 seconds are up the OnInfoListener event is never being fired. What am I doing wrong?
Audio and Video | Android Developers
The problem with their example is they don't explain what to do to keep recording for a set time period. I've tried putting the thread to sleep for 10 seconds with Thread.sleep(10000); but that seems to make the recording stop.
Any help would be appreciated.
PHP:
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
SLEEP HERE? BUSY WAITING? WHAT DO I DO HERE FOR 10 SECONDS?
recorder.prepare();
recorder.start();
Edit:
Okay, so after some digging around I've tried to use
PHP:
recorder.setMaxDuration(10000);//set max time length of recording
recorder.setOnInfoListener(new OnInfoListener()
{
public void onInfo(MediaRecorder mr, int what, int extra) {
mr.stop();
mr.release();
}
}
But after my 10 seconds are up the OnInfoListener event is never being fired. What am I doing wrong?