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. 6
      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.setVideoFrameRate(profile.videoFrameRate);
mMediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
mMediaRecorder.setVideoEncoder(mMapper.map(mVideoCodec));
if (mVideoCodec == VideoCodec.DEFAULT) {
mMediaRecorder.setVideoEncoder(profile.videoCodec);
} else {
mMediaRecorder.setVideoEncoder(mMapper.map(mVideoCodec));
}
mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate);
if (mAudio == Audio.ON) {
mMediaRecorder.setAudioChannels(profile.audioChannels);

Loading…
Cancel
Save