import android.content.Context; | import android.content.Context; | ||||
import android.media.MediaPlayer; | import android.media.MediaPlayer; | ||||
import android.media.MediaRecorder; | import android.media.MediaRecorder; | ||||
import android.widget.Toast; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
mediaRecorder.release(); | mediaRecorder.release(); | ||||
mediaRecorder = null; | mediaRecorder = null; | ||||
isRecording = false; | isRecording = false; | ||||
Toast.makeText(context, "audio recording saved", Toast.LENGTH_SHORT).show(); | |||||
} | } | ||||
} | } | ||||
@Override | @Override | ||||
public void onVideoSaved(@NonNull VideoCapture.OutputFileResults outputFileResults) { | public void onVideoSaved(@NonNull VideoCapture.OutputFileResults outputFileResults) { | ||||
isRecording = false; | isRecording = false; | ||||
Toast.makeText(context, "recording saved", Toast.LENGTH_SHORT).show(); | |||||
Toast.makeText(context, "video recording saved", Toast.LENGTH_SHORT).show(); | |||||
} | } | ||||
@Override | @Override | ||||
public void onError(int videoCaptureError, @NonNull String message, @Nullable Throwable cause) { | public void onError(int videoCaptureError, @NonNull String message, @Nullable Throwable cause) { | ||||
isRecording = false; | isRecording = false; | ||||
Toast.makeText(context, "recording failed", Toast.LENGTH_SHORT).show(); | |||||
Toast.makeText(context, "video recording failed", Toast.LENGTH_SHORT).show(); | |||||
} | } | ||||
} | } | ||||
); | ); |
{ | { | ||||
//vd.startDetection(); | //vd.startDetection(); | ||||
//vd.stopDetection(); | //vd.stopDetection(); | ||||
//vd.startRecording(); | |||||
//audioRecorder.startRecording(); | |||||
vd.startRecording(); | |||||
audioRecorder.startRecording(); | |||||
} | } | ||||
else { | else { | ||||
//vd.stopDetection(); | //vd.stopDetection(); | ||||
vd.stopRecording(); | vd.stopRecording(); | ||||
//audioRecorder.stopRecording(); | |||||
audioRecorder.stopRecording(); | |||||
} | } | ||||
} | } | ||||
}); | }); |