Skip to content

Instantly share code, notes, and snippets.

@meeDamian
Created December 28, 2012 10:03
Show Gist options
  • Save meeDamian/4396586 to your computer and use it in GitHub Desktop.
Save meeDamian/4396586 to your computer and use it in GitHub Desktop.
[ JAVA | Android | snippet ] This code enables you to record from camera
// via: https://code.google.com/p/android/issues/detail?id=9570
recorder = new MediaRecorder();
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
// The following line should not be necessary, or it should be possible to create
// a Surface without a foreground UI.
recorder.setPreviewDisplay(mSurface);
recorder.setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath() + "/testfile");
recorder.prepare();
recorder.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment