Browse Source

Fixed Bug in VideoDetector

bk_video
Bastian Kohler 1 year ago
parent
commit
847e90f5ac

+ 3
- 0
app/src/main/java/com/example/ueberwachungssystem/Detection/VideoDetector.java View File

/** Stops the Recording */ /** Stops the Recording */
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
public void stopRecording(){ public void stopRecording(){
if(!isRecording)
return;

videoCapture.stopRecording(); videoCapture.stopRecording();
cameraProvider.unbind(videoCapture); cameraProvider.unbind(videoCapture);
isRecording = false; isRecording = false;

+ 3
- 7
app/src/main/java/com/example/ueberwachungssystem/MainActivity.java View File

@Override @Override
public void onDetection(@NonNull DetectionReport detectionReport) { public void onDetection(@NonNull DetectionReport detectionReport) {
Log.d("onDetection", detectionReport.toString()); Log.d("onDetection", detectionReport.toString());
if (detectionReport.detectionState)
vd.startRecording();
else
vd.stopRecording();
} }
}); });
vd.startDetection(); vd.startDetection();
if (toggleButton.isChecked()) if (toggleButton.isChecked())
{ {
//vd.startDetection(); //vd.startDetection();
vd.stopDetection();
//vd.stopDetection();
//vd.startRecording(); //vd.startRecording();
audioRecorder.startRecording();
//audioRecorder.startRecording();
} }
else { else {
//vd.stopDetection(); //vd.stopDetection();
vd.stopRecording(); vd.stopRecording();
audioRecorder.stopRecording();
//audioRecorder.stopRecording();
} }
} }
}); });

Loading…
Cancel
Save