Fixed gradle plugin version, changed throwing error to warning for setAudio mode

pull/33/head
Andrii Miroshnychenko 8 years ago committed by Andrew Miroshnychenko
parent 20d33a32ae
commit 383686c65e
  1. 2
      build.gradle
  2. 10
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java

@ -7,7 +7,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta4' classpath 'com.android.tools.build:gradle:2.3.3'
// https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en // https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
// https://www.theguardian.com/technology/developer-blog/2016/dec/06/how-to-publish-an-android-library-a-mysterious-conversation // https://www.theguardian.com/technology/developer-blog/2016/dec/06/how-to-publish-an-android-library-a-mysterious-conversation
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

@ -294,10 +294,12 @@ class Camera1 extends CameraController {
@Override @Override
void setAudio(Audio audio) { void setAudio(Audio audio) {
if (mIsCapturingVideo) { if (mAudio != audio) {
throw new IllegalStateException("Can't change audio while recording a video."); if (mIsCapturingVideo) {
LOG.w("Changing audio mode while recording. Changes will take place starting from next video");
}
mAudio = audio;
} }
mAudio = audio;
} }
@Override @Override
@ -606,7 +608,7 @@ class Camera1 extends CameraController {
if (mAudio == Audio.ON) { if (mAudio == Audio.ON) {
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER); mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mMediaRecorder.setProfile(profile); mMediaRecorder.setProfile(profile);
}else{ } else {
// Set all values contained in profile except audio settings // Set all values contained in profile except audio settings
mMediaRecorder.setOutputFormat(profile.fileFormat); mMediaRecorder.setOutputFormat(profile.fileFormat);
mMediaRecorder.setVideoEncoder(profile.videoCodec); mMediaRecorder.setVideoEncoder(profile.videoCodec);

Loading…
Cancel
Save