Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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