|
|
|
@ -557,9 +557,10 @@ public class CameraView extends FrameLayout { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
LOG.e("Permission error:", "When the session type is set to video,", |
|
|
|
|
"the RECORD_AUDIO permission should be added to the app manifest file."); |
|
|
|
|
throw new IllegalStateException(CameraLogger.lastMessage); |
|
|
|
|
CameraException cameraException = new CameraUnavailableException("Permission " + |
|
|
|
|
"error: When the session type is set to video, the RECORD_AUDIO " + |
|
|
|
|
"permission should be added to the app manifest file."); |
|
|
|
|
mCameraCallbacks.onError(cameraException); |
|
|
|
|
} catch (PackageManager.NameNotFoundException e) { |
|
|
|
|
// Not possible.
|
|
|
|
|
} |
|
|
|
@ -1002,7 +1003,11 @@ public class CameraView extends FrameLayout { |
|
|
|
|
*/ |
|
|
|
|
public void setJpegQuality(int jpegQuality) { |
|
|
|
|
if (jpegQuality <= 0 || jpegQuality > 100) { |
|
|
|
|
throw new IllegalArgumentException("JPEG quality should be > 0 and <= 100"); |
|
|
|
|
IllegalArgumentException illegalArgumentException = new |
|
|
|
|
IllegalArgumentException("JPEG quality should be > 0 and <= 100"); |
|
|
|
|
CameraException cameraException = new CameraConfigurationFailedException("Could not" + |
|
|
|
|
" set JpegQuality", illegalArgumentException); |
|
|
|
|
mCameraCallbacks.onError(cameraException); |
|
|
|
|
} |
|
|
|
|
mJpegQuality = jpegQuality; |
|
|
|
|
} |
|
|
|
@ -1165,15 +1170,16 @@ public class CameraView extends FrameLayout { |
|
|
|
|
* so callers should ensure they have appropriate permissions to write to the file. |
|
|
|
|
* Recording will be automatically stopped after durationMillis, unless |
|
|
|
|
* {@link #stopCapturingVideo()} is not called meanwhile. |
|
|
|
|
* Triggers error handler, if durationMillis is less than 500 milliseconds. |
|
|
|
|
* |
|
|
|
|
* @param file a file where the video will be saved |
|
|
|
|
* @param durationMillis video max duration |
|
|
|
|
* |
|
|
|
|
* @throws IllegalArgumentException if durationMillis is less than 500 milliseconds |
|
|
|
|
*/ |
|
|
|
|
public void startCapturingVideo(File file, long durationMillis) { |
|
|
|
|
if (durationMillis < 500) { |
|
|
|
|
throw new IllegalArgumentException("Video duration can't be < 500 milliseconds"); |
|
|
|
|
CameraException cameraException = new CapturingVideoFailedException("Video duration" + |
|
|
|
|
" can't be < 500 milliseconds"); |
|
|
|
|
mCameraCallbacks.onError(cameraException); |
|
|
|
|
} |
|
|
|
|
startCapturingVideo(file); |
|
|
|
|
mUiHandler.postDelayed(new Runnable() { |
|
|
|
|