setMaxDuration() setMaxFileSize() setOnErrorListener() setOnInfoListener() setOrientationHint()
callback function for max duration and max file size.
MediaRecorder.OnInfoListener mInfoListener = new MediaRecorder.OnInfoListener() { @Override public void onInfo(MediaRecorder mr, int what, int extra) { // TODO Auto-generated method stub switch (what) { case MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED : _recorder.stop(); _recorder.reset(); _isRecording = false; Log.d("camera", "stop"); Log.d("camera", "onInfo=" + MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED); break; case MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED : _recorder.stop(); _recorder.reset(); _isRecording = false; Log.d("camera", "stop"); Log.d("camera", "onInfo=" + MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED); break; case MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN : Log.d("camera", "onInfo=" + MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN); break; } } };set max duration if duration is 30 second, call onInfo().
_recorder.setMaxDuration(30000); //max 30 secondsset max file size if file size is 40 M bytes, call onInfo().
_recorder.setMaxFileSize(40000000); //max 40M bytes
set orientation. it change orientation at playback only.
_recorder.setOrientationHint(0);source code here.
0 件のコメント:
コメントを投稿