|
|
@ -1284,10 +1284,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver { |
|
|
|
* |
|
|
|
* |
|
|
|
* @param file a file where the video will be saved |
|
|
|
* @param file a file where the video will be saved |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void takeVideo(@Nullable File file) { |
|
|
|
public void takeVideo(@NonNull File file) { |
|
|
|
if (file == null) { |
|
|
|
|
|
|
|
file = new File(getContext().getFilesDir(), "video.mp4"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mCameraController.takeVideo(file); |
|
|
|
mCameraController.takeVideo(file); |
|
|
|
mUiHandler.post(new Runnable() { |
|
|
|
mUiHandler.post(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1307,11 +1304,8 @@ public class CameraView extends FrameLayout implements LifecycleObserver { |
|
|
|
* |
|
|
|
* |
|
|
|
* @param file a file where the video will be saved |
|
|
|
* @param file a file where the video will be saved |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void takeVideoSnapshot(@Nullable File file) { |
|
|
|
public void takeVideoSnapshot(@NonNull File file) { |
|
|
|
if (getWidth() == 0 || getHeight() == 0) return; |
|
|
|
if (getWidth() == 0 || getHeight() == 0) return; |
|
|
|
if (file == null) { |
|
|
|
|
|
|
|
file = new File(getContext().getFilesDir(), "video.mp4"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mCameraController.takeVideoSnapshot(file, AspectRatio.of(getWidth(), getHeight())); |
|
|
|
mCameraController.takeVideoSnapshot(file, AspectRatio.of(getWidth(), getHeight())); |
|
|
|
mUiHandler.post(new Runnable() { |
|
|
|
mUiHandler.post(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|