Revert "Switch to video time limit"

This reverts commit 8be83cba18.
This commit is contained in:
M66B 2022-09-06 18:25:21 +02:00
parent c553bf2562
commit aadc56ccb4
1 changed files with 12 additions and 6 deletions

View File

@ -341,8 +341,6 @@ public class FragmentCompose extends FragmentBase {
private static final int REQUEST_SEND = 15;
private static final int REQUEST_REMOVE_ATTACHMENTS = 16;
private static final int VIDEO_CAPTURE_TIME_LIMIT = 30; // seconds
private static ExecutorService executor = Helper.getBackgroundExecutor(1, "compose");
@Override
@ -2625,6 +2623,13 @@ public class FragmentCompose extends FragmentBase {
}
private void onActionVideo(Context context) {
Long limit = null;
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
if (identity != null && identity.max_size != null) {
limit = 80 * identity.max_size / 100;
Log.i("Video size limit=" + Helper.humanReadableByteCount(limit));
}
File dir = new File(context.getFilesDir(), "video");
if (!dir.exists())
dir.mkdir();
@ -2632,10 +2637,11 @@ public class FragmentCompose extends FragmentBase {
Uri videoUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, file);
// https://developer.android.com/reference/android/provider/MediaStore#ACTION_VIDEO_CAPTURE
Intent capture = new Intent(MediaStore.ACTION_VIDEO_CAPTURE)
.putExtra(MediaStore.EXTRA_OUTPUT, videoUri)
.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0) // 0=low; 1=high
.putExtra(MediaStore.EXTRA_DURATION_LIMIT, VIDEO_CAPTURE_TIME_LIMIT);
Intent capture = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
capture.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
if (limit != null)
capture.putExtra(MediaStore.EXTRA_SIZE_LIMIT, limit);
capture.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); // 0=low, 1=high
startActivityForResult(capture, REQUEST_CAPTURE_VIDEO);
}