Recording working but only on camera detection
This commit is contained in:
parent
b976e9ae32
commit
bd8371d96d
@ -73,7 +73,20 @@ public class DetectorService extends LifecycleService {
|
||||
@Override
|
||||
public void onDetection(@NonNull DetectionReport detectionReport) {
|
||||
//passToServiceListener(detectionReport);
|
||||
|
||||
if(detectionReport.detectionState){
|
||||
detectedVideo = true;
|
||||
videoDetector.startRecording();
|
||||
} else {
|
||||
detectedVideo = false;
|
||||
if(!(detectedVideo || detectedAudio || detectedMotion)) {
|
||||
videoDetector.stopRecording();
|
||||
}
|
||||
}
|
||||
|
||||
wifiCommunication.sendTrue(detectionReport.toMessage());
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
/** Motion Detection**/
|
||||
|
@ -134,7 +134,7 @@ public class VideoDetector extends Detector {
|
||||
if (isRecording){
|
||||
return;
|
||||
}
|
||||
|
||||
Toast.makeText(context, "video recording started", Toast.LENGTH_SHORT).show();
|
||||
videoCapture = setupVideoCapture();
|
||||
|
||||
final ListenableFuture<ProcessCameraProvider> cameraProviderFuture = ProcessCameraProvider.getInstance(context);
|
||||
|
@ -9,6 +9,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Toast;
|
||||
@ -25,12 +26,28 @@ import java.util.List;
|
||||
public class VideoListFragment extends Fragment {
|
||||
|
||||
private ListView listView;
|
||||
private Button button;
|
||||
private ArrayAdapter<String> adapter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.videolist_fragment, container, false);
|
||||
|
||||
|
||||
button = rootView.findViewById(R.id.button);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
File dir = getContext().getFilesDir();
|
||||
File[] files = dir.listFiles();
|
||||
for (File file: files) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
listView = rootView.findViewById(R.id.listView);
|
||||
adapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, getFileNames());
|
||||
listView.setAdapter(adapter);
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -13,4 +14,12 @@
|
||||
android:layout_height = "wrap_content"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Aufnahmen Löschen"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,13 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingVertical="100dp">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<VideoView
|
||||
android:id="@+id/videoView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
</FrameLayout>
|
Loading…
x
Reference in New Issue
Block a user