It may seem a dumb question, I have been working on this all night and could not get a webm video recorded from my mobile.
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.WEBM);
//mMediaRecorder.setOutputFormat(outFormat);
//CamcorderProfile camPro = CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_480P);
//camPro.fileFormat = MediaRecorder.OutputFormat.WEBM;
//camPro.videoFrameRate = 30;
mMediaRecorder.setCaptureRate(30f);
//camPro.videoFrameWidth = 360;
//camPro.videoFrameHeight = 640;
//camPro.videoBitRate = 2000000;
//camPro.audioCodec = MediaRecorder.AudioEncoder.VORBIS;
mMediaRecorder.setVideoSize(640,360);
mMediaRecorder.setVideoEncodingBitRate(2000000);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.VORBIS);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.VP8);
//camPro.videoCodec = MediaRecorder.VideoEncoder.VP8;
mMediaRecorder.setVideoFrameRate(30);
//mMediaRecorder.setProfile(camPro);
I've commented the camcorder profile lines as i suppose only one has to be used. I also saw a note saying API level 21 is required for it, So I am on my moto G with lollipop 5.0.2.
The error I am getting is Camera died Error 100. Sometimes the media recorder.prepare() happens but then media recorder.start() throws an error. I am confused as to what should be done. Once I got no errors. But I only had a file of 6.19KB which couldn't be played.