|
|
|
|
|
|
|
|
ActivityCompat.requestPermissions(MainActivity.this, |
|
|
ActivityCompat.requestPermissions(MainActivity.this, |
|
|
new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}, |
|
|
new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}, |
|
|
REQUEST_PERMISSION); |
|
|
REQUEST_PERMISSION); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
alarm_on = true; |
|
|
alarm_on = true; |
|
|
onAlarmStateChanged(); |
|
|
onAlarmStateChanged(); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { |
|
|
|
|
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
|
|
|
|
|
if (requestCode == REQUEST_PERMISSION) { |
|
|
|
|
|
boolean allPermissionsGranted = true; |
|
|
|
|
|
for (int grantResult : grantResults) { |
|
|
|
|
|
if (grantResult != PackageManager.PERMISSION_GRANTED) { |
|
|
|
|
|
allPermissionsGranted = false; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (allPermissionsGranted) { |
|
|
|
|
|
startRecording(); // Starte die Aufnahme, da alle Berechtigungen erteilt wurden |
|
|
|
|
|
} else { |
|
|
|
|
|
Toast.makeText(this, "Berechtigung verweigert.", Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void onAlarmStateChanged() { |
|
|
public void onAlarmStateChanged() { |
|
|
runOnUiThread(new Runnable() { |
|
|
runOnUiThread(new Runnable() { |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
waitTillThreadsStopped(); |
|
|
waitTillThreadsStopped(); |
|
|
|
|
|
boolean test = videoThread.isAlive(); |
|
|
File videoFile = new File(videoPath); //Speichere das aufgenommene Video |
|
|
File videoFile = new File(videoPath); //Speichere das aufgenommene Video |
|
|
File audioFile = new File(audioPath); //Speichere die aufgenommene Audio |
|
|
File audioFile = new File(audioPath); //Speichere die aufgenommene Audio |
|
|
|
|
|
|
|
|
if (videoFile.exists() && audioFile.exists()) { |
|
|
if (videoFile.exists() && audioFile.exists()) { |
|
|
//Wenn Video- und Audioaufzeichnung gestoppt und abgespeichert sind, beginne mit dem Mergeprozess der beiden |
|
|
//Wenn Video- und Audioaufzeichnung gestoppt und abgespeichert sind, beginne mit dem Mergeprozess der beiden |
|
|
|
|
|
Toast.makeText(MainActivity.this, String.valueOf(test) , Toast.LENGTH_SHORT).show(); |
|
|
mergeVideoWithAudio(); |
|
|
mergeVideoWithAudio(); |
|
|
} else { |
|
|
} else { |
|
|
Toast.makeText(MainActivity.this, "Dateien wurden nicht gefunden!", Toast.LENGTH_SHORT).show(); |
|
|
Toast.makeText(MainActivity.this, "Dateien wurden nicht gefunden!", Toast.LENGTH_SHORT).show(); |