This commit is contained in:
Bastian Kohler 2023-05-31 14:28:28 +02:00
parent 63db527f64
commit 675d4423e4

View File

@ -1,5 +1,6 @@
package com.example.ueberwachungssystem; package com.example.ueberwachungssystem;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.hardware.Camera; import android.hardware.Camera;
import android.media.CamcorderProfile; import android.media.CamcorderProfile;
@ -7,6 +8,7 @@ import android.media.MediaPlayer;
import android.media.MediaRecorder; import android.media.MediaRecorder;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.WindowManager;
import android.widget.VideoView; import android.widget.VideoView;
import java.io.IOException; import java.io.IOException;
@ -17,6 +19,9 @@ public class Recorder {
private MediaRecorder mediaRecorder = null; private MediaRecorder mediaRecorder = null;
private SurfaceView surfaceView; private SurfaceView surfaceView;
private static final int SENSOR_ORIENTATION_DEFAULT_DEGREES = 90;
private static final int SENSOR_ORIENTATION_INVERSE_DEGREES = 270;
public Recorder (Context context) { public Recorder (Context context) {
this.context = context; this.context = context;
this.surfaceView = new SurfaceView(context); this.surfaceView = new SurfaceView(context);
@ -50,6 +55,7 @@ public class Recorder {
mediaRecorder.setOutputFile(context.getFilesDir() + "/video.mp4"); mediaRecorder.setOutputFile(context.getFilesDir() + "/video.mp4");
mediaRecorder.prepare(); mediaRecorder.prepare();
mediaRecorder.start(); mediaRecorder.start();
@ -58,6 +64,7 @@ public class Recorder {
} }
} }
public void stopRecording() { public void stopRecording() {
if (mediaRecorder != null) { if (mediaRecorder != null) {
try { try {