Skip to content

Commit

Permalink
fix(android): standard way to get video uri from intent
Browse files Browse the repository at this point in the history
see apache#210, and follow doc https://developer.android.com/training/camera/videobasics#TaskVideoView
(removes partial changes done in apache#13 for old android and cordova versions)
  • Loading branch information
ath0mas committed Jul 30, 2023
1 parent 3ce9948 commit cbab228
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/android/Capture.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
*/
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cbab228

Please sign in to comment.