From cbab2281fc479c4e4083b009fe5c99a28d5eca38 Mon Sep 17 00:00:00 2001 From: Alexis THOMAS Date: Sat, 6 Nov 2021 01:33:50 +0100 Subject: [PATCH] fix(android): standard way to get video uri from intent see #210, and follow doc https://developer.android.com/training/camera/videobasics#TaskVideoView (removes partial changes done in #13 for old android and cordova versions) --- src/android/Capture.java | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/android/Capture.java b/src/android/Capture.java index f008eba9..c27eb4b2 100644 --- a/src/android/Capture.java +++ b/src/android/Capture.java @@ -285,17 +285,6 @@ private void captureAudio(Request req) { } } - private String getTempDirectoryPath() { - File cache = null; - - // Use internal storage - cache = cordova.getActivity().getCacheDir(); - - // Create the cache directory if it doesn't exist - cache.mkdirs(); - return cache.getAbsolutePath(); - } - /** * Sets up an intent to capture images. Result handled by onActivityResult() */ @@ -427,17 +416,8 @@ public void onImageActivityResult(Request req) { } public void onVideoActivityResult(Request req, Intent intent) { - Uri data = null; - - if (intent != null){ - // Get the uri of the video clip - data = intent.getData(); - } - - if( data == null){ - File movie = new File(getTempDirectoryPath(), "Capture.avi"); - data = Uri.fromFile(movie); - } + // Get the uri of the video clip + Uri data = intent.getData(); // create a file object from the uri if(data == null) {