I am using a media recorder to record video in an Android application.
mMediaRecorder.setCamera(mServiceCamera); mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); //mMediaRecorder.setVideoSize(mPreviewSize.width, mPreviewSize.height); mMediaRecorder.setVideoFrameRate(30); mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT); mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); String file_name = Environment.getExternalStorageDirectory().getPath() +"/myVideo.mp4"; mMediaRecorder.setOutputFile(file_name); mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface()); mMediaRecorder.prepare(); mMediaRecorder.start();
The problem is the line
mMediaRecorder.setVideoSize(mPreviewSize.width, mPreviewSize.height);
On HTC and Xperia, setVideoSize works fine (it will work only if I don't comment on this line). But on Nexus and Note, setVideoSize will not work (will work only if I comment on this line).
What to do so that the application runs on all of these devices correctly?
android camera mediarecorder
Deepzz
source share