Browse Source

refactor

bk_recording
Bastian Kohler 1 year ago
parent
commit
675d4423e4
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      app/src/main/java/com/example/ueberwachungssystem/Recorder.java

+ 7
- 0
app/src/main/java/com/example/ueberwachungssystem/Recorder.java View File

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;
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;


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);
mediaRecorder.setOutputFile(context.getFilesDir() + "/video.mp4"); mediaRecorder.setOutputFile(context.getFilesDir() + "/video.mp4");





mediaRecorder.prepare(); mediaRecorder.prepare();
mediaRecorder.start(); mediaRecorder.start();


} }
} }



public void stopRecording() { public void stopRecording() {
if (mediaRecorder != null) { if (mediaRecorder != null) {
try { try {

Loading…
Cancel
Save