Fixed Exception on some devices when we use default videoCodec instead CamcorderProfile videoCodec. (#264)

Looks like passing camcorderProfile.videoCodec instead of MediaRecorder.VideoEncoder.DEFAULT avoids some exceptions.
pull/213/merge
Aleksandr 6 years ago committed by Mattia Iavarone
parent 4c6a8db0c3
commit 7f43a4a10b
  1. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java

@ -688,7 +688,11 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
mMediaRecorder.setOutputFormat(profile.fileFormat); mMediaRecorder.setOutputFormat(profile.fileFormat);
mMediaRecorder.setVideoFrameRate(profile.videoFrameRate); mMediaRecorder.setVideoFrameRate(profile.videoFrameRate);
mMediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight); mMediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
if (mVideoCodec == VideoCodec.DEFAULT) {
mMediaRecorder.setVideoEncoder(profile.videoCodec);
} else {
mMediaRecorder.setVideoEncoder(mMapper.map(mVideoCodec)); mMediaRecorder.setVideoEncoder(mMapper.map(mVideoCodec));
}
mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate); mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate);
if (mAudio == Audio.ON) { if (mAudio == Audio.ON) {
mMediaRecorder.setAudioChannels(profile.audioChannels); mMediaRecorder.setAudioChannels(profile.audioChannels);

Loading…
Cancel
Save