|
|
|
|
|
|
|
|
private static final float ALARM_THRESHOLD = 0f; // Percent of pixels changed |
|
|
private static final float ALARM_THRESHOLD = 0f; // Percent of pixels changed |
|
|
private static final float AREA_THRESHOLD = 10f; |
|
|
private static final float AREA_THRESHOLD = 10f; |
|
|
private static final int DILATE_ITERATIONS = 2; |
|
|
private static final int DILATE_ITERATIONS = 2; |
|
|
private static final float START_DELAY = 20000; // milliseconds |
|
|
|
|
|
|
|
|
private static final float START_DELAY = 2000; // milliseconds |
|
|
private static final android.util.Size IMAGE_RES = new android.util.Size(640, 480); |
|
|
private static final android.util.Size IMAGE_RES = new android.util.Size(640, 480); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isRecording){ |
|
|
if (isRecording){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
Toast.makeText(context, "video recording started", Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
|
|
|
Toast.makeText(context, "Aufnahme gestartet", Toast.LENGTH_SHORT).show(); |
|
|
videoCapture = setupVideoCapture(); |
|
|
videoCapture = setupVideoCapture(); |
|
|
|
|
|
|
|
|
final ListenableFuture<ProcessCameraProvider> cameraProviderFuture = ProcessCameraProvider.getInstance(context); |
|
|
final ListenableFuture<ProcessCameraProvider> cameraProviderFuture = ProcessCameraProvider.getInstance(context); |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onVideoSaved(@NonNull VideoCapture.OutputFileResults outputFileResults) { |
|
|
public void onVideoSaved(@NonNull VideoCapture.OutputFileResults outputFileResults) { |
|
|
isRecording = false; |
|
|
isRecording = false; |
|
|
Toast.makeText(context, "video recording saved", Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
|
|
|
Toast.makeText(context, "Aufnahme gespeichert", Toast.LENGTH_SHORT).show(); |
|
|
} |
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
public void onError(int videoCaptureError, @NonNull String message, @Nullable Throwable cause) { |
|
|
public void onError(int videoCaptureError, @NonNull String message, @Nullable Throwable cause) { |
|
|
isRecording = false; |
|
|
isRecording = false; |
|
|
Toast.makeText(context, "video recording failed", Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
|
|
|
Toast.makeText(context, "Aufnahme fehlgeschlagen", Toast.LENGTH_SHORT).show(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
); |
|
|
); |