Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teocci/99bd9cdbac5bcd1923a334fdd928f932 to your computer and use it in GitHub Desktop.
Save teocci/99bd9cdbac5bcd1923a334fdd928f932 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