Skip to content

Instantly share code, notes, and snippets.

@j-onathan
Created August 8, 2014 15:59
Show Gist options
  • Save j-onathan/3c6f38b703aa7f7508db to your computer and use it in GitHub Desktop.
Save j-onathan/3c6f38b703aa7f7508db to your computer and use it in GitHub Desktop.
protected void startRecording(String file){
if (!isRecording){
saveFile=file;
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(this.recording);
try {
recorder.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
isRecording = true;
recorder.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment