Skip to content

Instantly share code, notes, and snippets.

@a-chernykh
Created June 28, 2014 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save a-chernykh/085820f646ad6d5710ab to your computer and use it in GitHub Desktop.
Save a-chernykh/085820f646ad6d5710ab to your computer and use it in GitHub Desktop.
MediaRecorder example
MediaRecorder mediaRecorder = new MediaRecorder();
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
profile.videoFrameWidth = 1280;
profile.videoFrameHeight = 720;
mediaRecorder.setCamera(Camera.open());
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(profile);
mediaRecorder.setOutputFile("/path/to/video.mp4");
mediaRecorder.prepare();
mediaRecorder.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment