From 8be83cba183fae36b2de8453c8fe8a299645b314 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 6 Sep 2022 10:27:55 +0200 Subject: [PATCH] Switch to video time limit --- .../eu/faircode/email/FragmentCompose.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 9ff0eb76a2..888f61b154 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -341,6 +341,8 @@ 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 @@ -2623,13 +2625,6 @@ 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(); @@ -2637,11 +2632,10 @@ 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); - 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 + 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); startActivityForResult(capture, REQUEST_CAPTURE_VIDEO); }