Skip to content

Instantly share code, notes, and snippets.

@kendhia
Created September 7, 2017 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kendhia/74e36b29b6930d7e88d256d749aa9741 to your computer and use it in GitHub Desktop.
Save kendhia/74e36b29b6930d7e88d256d749aa9741 to your computer and use it in GitHub Desktop.
public static String getAbsolutePathForVideoFromURI(@NonNull Context context, @NonNull Uri videoUri) {
if (ContentResolver.SCHEME_FILE.equals(videoUri.getScheme())) {
return videoUri.getPath();
} else if ("com.google.android.apps.photos.contentprovider".equals(videoUri.getAuthority())) {
String pathUri = videoUri.getPath();
videoUri = Uri.parse(pathUri.substring(pathUri.indexOf("content"), pathUri.lastIndexOf("/ORIGINAL")));
}
String id = getUriId(videoUri);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment