Java Code Examples for android.os.Environment.DIRECTORY_MOVIES

The following are Jave code examples for showing how to use DIRECTORY_MOVIES of the android.os.Environment class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: react-native-camera   File: RCTCameraModule.java   View Source Code Vote up 6 votes
private File getOutputMediaFile(int type) {
    // Get environment directory type id from requested media type.
    String environmentDirectoryType;
    if (type == MEDIA_TYPE_IMAGE) {
        environmentDirectoryType = Environment.DIRECTORY_PICTURES;
    } else if (type == MEDIA_TYPE_VIDEO) {
        environmentDirectoryType = Environment.DIRECTORY_MOVIES;
    } else {
        Log.e(TAG, "Unsupported media type:" + type);
        return null;
    }

    return getOutputFile(
            type,
            Environment.getExternalStoragePublicDirectory(environmentDirectoryType)
    );
}
 
Example 2
Project: androidCameraTest   File: PhotoIntentTest.java   View Source Code Vote up 6 votes
private File createImageFile() throws IOException {
    // Create an image file name
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = (isVideo ? "MPEG_" : "JPEG_") + timeStamp + "_";
    String dirType = isVideo ? Environment.DIRECTORY_MOVIES : Environment.DIRECTORY_PICTURES;
    File storageDir = isPublic ? getExternalStoragePublicDirectory(dirType) :
                                 getExternalFilesDir(dirType);
    if( !storageDir.exists() ) {
        storageDir.mkdirs();
    }
    File image = File.createTempFile(
            imageFileName,
            isVideo ? ".mp4" : ".jpg",
            storageDir
    );

    return image;
}
 
Example 3
Project: react-native-camera-face-detector   File: RCTCameraModule.java   View Source Code Vote up 6 votes
private File getOutputMediaFile(int type) {
    // Get environment directory type id from requested media type.
    String environmentDirectoryType;
    if (type == MEDIA_TYPE_IMAGE) {
        environmentDirectoryType = Environment.DIRECTORY_PICTURES;
    } else if (type == MEDIA_TYPE_VIDEO) {
        environmentDirectoryType = Environment.DIRECTORY_MOVIES;
    } else {
        Log.e(TAG, "Unsupported media type:" + type);
        return null;
    }

    return getOutputFile(
            type,
            Environment.getExternalStoragePublicDirectory(environmentDirectoryType)
    );
}
 
Example 4
Project: Cable-Android   File: StorageUtil.java   View Source Code Vote up 4 votes
public static File getVideoDir() throws NoExternalStorageException {
  return new File(getSignalStorageDir(), Environment.DIRECTORY_MOVIES);
}