MediaRecorder Starts With A 1 Sec Delay. How Do I Get Rid Of The Silence?
I am trying to use MediaRecorder in a Service to record sounds. But it creates a 1 sec delay (silence) at the start. how to i get rid of this? I tried using RehearsalAudioRecorder
Solution 1:
I found a solution with the RehearsalAudioRecorder
public void onStart(Intent intent, int startId) {
boolean isStart = intent.getBooleanExtra("state", false);
if (isStart) {
acquireWakeLock();
int i = 0;
do {
if (mRecorder != null)
mRecorder.release();
mRecorder = new RehearsalAudioRecorder(false, 0, 0, 0, 0);
} while ((++i < 44100)
& !(mRecorder.getState() == RehearsalAudioRecorder.State.INITIALIZING));
mRecorder.setOutputFile(intent.getStringExtra("audioFile"));
mRecorder.prepare();
mRecorder.start();
} else if (!isStart) {
if(mRecorder != null) {
mRecorder.stop();
mRecorder.release();
mRecorder = null;
}
releaseWakeLock();
}
}
Post a Comment for "MediaRecorder Starts With A 1 Sec Delay. How Do I Get Rid Of The Silence?"