Fixed Bug in VideoDetector
This commit is contained in:
parent
e088b0afa3
commit
847e90f5ac
@ -197,6 +197,9 @@ public class VideoDetector extends Detector {
|
|||||||
/** 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;
|
||||||
|
@ -37,10 +37,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@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();
|
||||||
@ -57,14 +53,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
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…
x
Reference in New Issue
Block a user