that_person

Android Ex: Recording Audio/Video (via http://goo.gl/efrwVp)

Aug 8th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. protected void startRecording(String file){
  2.     if (!isRecording){
  3.         saveFile=file;
  4.         recorder = new MediaRecorder();
  5.         recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  6.         recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
  7.         recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  8.         recorder.setOutputFile(this.recording);
  9.         try {
  10.             recorder.prepare();
  11.         } catch (IllegalStateException e) {
  12.             // TODO Auto-generated catch block
  13.             e.printStackTrace();
  14.         } catch (IOException e) {
  15.             // TODO Auto-generated catch block
  16.             e.printStackTrace();
  17.         }
  18.         isRecording = true;
  19.         recorder.start();
  20.     }
  21. }
Add Comment
Please, Sign In to add comment